कम्प्युटर र सूचना प्रविधि (प्राविधिक)
कम्प्युटर र सूचना प्रविधि (प्राविधिक)
Computer & IT (Technical) · ५,०७६ प्रश्न
५,०७६ प्रश्न उपलब्ध। मोड छान्नुहोस्:
कम्प्युटर र IT: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
What is the output of the Python code: d = {}; d.setdefault('k', []).append(1); d.setdefault('k', []).append(2); print(d) ?
सही उत्तर: क) {'k': [1, 2]}
setdefault() inserts [] only if the key is missing and returns the stored list, so both appends go into the same list.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, s = 0; for i in range(5): if i == 3: break; s += i — and the for loop has an else clause doing s += 100. What is s after the loop?
सही उत्तर: ख) 3
The loop adds 0, 1 and 2, then break is executed at i = 3, so the else clause is skipped; s = 3.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(int(3.9) + round(3.5)) ?
सही उत्तर: ग) 7
int() truncates 3.9 to 3, and round(3.5) rounds to the nearest even integer, 4, so the sum is 7.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print('Hello'[1:4:2]) ?
सही उत्तर: ग) el
The slice takes indices 1 and 3 (start 1, stop before 4, step 2), which are e and l.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(f'{3.14159:.2f}', f'{7:03d}') ?
सही उत्तर: घ) 3.14 007
:.2f rounds to two decimal places and :03d pads the integer with zeros to width 3.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(list(map(int, '123'))) ?
सही उत्तर: क) [1, 2, 3]
map() applies int to each character of the string '123'.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, x = 10 is set at module level and def f(): x = 20 is defined. After calling f(), what does print(x) display?
सही उत्तर: ख) 10
Assigning to x inside f creates a new local variable; without the global keyword the module-level x is unchanged.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: a = [1, 2, 3, 4, 5]; a[1:3] = [9]; print(a) ?
सही उत्तर: ख) [1, 9, 4, 5]
Slice assignment replaces the two elements at indices 1 and 2 with the single element 9, so the list shrinks.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print([i * j for i in range(1, 3) for j in range(1, 3)]) ?
सही उत्तर: ग) [1, 2, 2, 4]
The first for is the outer loop: i = 1 gives 1, 2 and i = 2 gives 2, 4.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(not 0 and 5) ?
सही उत्तर: घ) 5
not binds more tightly than and: not 0 is True, and True and 5 returns its second operand, 5.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।