O Level Python Paper July 2025
q = [3,4,5,20,5,25,13] के लिए, q.pop(1) का output क्या होगा?
What will be the output of q.pop(1) for q = [3,4,5,20,5,25,13]?
In Python, pop(index) removes the element at the given index from the list and returns it.
Python में pop(index) method किसी सूची (list) से दिए गए index पर मौजूद element को हटाता है और उसे return करता है।
Index positions in the list are:
Index: 0 1 2 3 4 5 6
Value: 3 4 5 20 5 25 13
So, q.pop(1) will remove and return the element at index 1, which is 4.
अब q.pop(1) का मतलब है index 1 पर स्थित element को हटाना और return करना।
Index 1 पर value है: 4
इसलिए, यह statement 4 return करेगा और list से 4 हटा दिया जाएगा।
Correct Answer: B) 4
निम्नलिखित expression का सही मान क्या होगा?
What is the correct value of the following expression?
2 + 3 * 4 - 6
Expression:2 + 3 * 4 - 6
➡️ पहले गुणा (Multiplication) होगा (BODMAS नियम के अनुसार):3 * 4 = 12
➡️ फिर जोड़ (Addition):2 + 12 = 14
➡️ फिर घटाना (Subtraction):14 - 6 = 8
In English:
Using operator precedence (multiplication before addition and subtraction):2 + 3 * 4 - 6 = 8
Correct Answer: B) 8
निम्न NumPy कोड का आउटपुट क्या होगा?
What will be the output of the following NumPy code?
x = np.arange(1, 11, 2)
print(x)
x = np.arange(1, 11, 2)
print(x)
np.arange(start, stop, step)
→ यहाँ:
start = 1,
stop = 11 (stop शामिल नहीं होता),
step = 2
इसलिए यह 1 से शुरू होकर हर बार 2 जोड़ता है जब तक 11 से कम है:
➡️ Output: [1, 3, 5, 7, 9]
In English:
np.arange(1, 11, 2) generates numbers from 1 to 10 with a step of 2.
Correct Answer: B) [1 3 5 7 9]
math.log(64,2) का आउटपुट क्या होगा?
What will be the output of math.log(64,2)?
import math
math.log(64, 2)
यह फंक्शन देता है:
➡️ 64 का base 2 में लॉगरिदम, यानी:
log2(64)=6(क्योंकि 2^6=64)
In English:
math.log(64, 2) returns the base-2 logarithm of 64.
Since 2^6 , the output is 6
Correct Answer: C) 6
Python में print(5*(2//3)) का आउटपुट क्या होगा?
What will be the output of print(5*(2//3)) in Python?
print(5 * (2 // 3))
2 // 3 → Floor division है, जो पूर्णांक भाग (integer part) देता है:
🔸 2 // 3 = 0 (क्योंकि 2 को 3 से divide करने पर भाग 0 आता है)
फिर:
5 * 0 = 0
In English:
// is floor division.
2 // 3 = 0, so 5 * 0 = 0
Correct Answer: A) 0
Python में list comprehension का syntax कैसा होता है?
What does list comprehension syntax look like in Python?
List comprehension का उपयोग Python में नई लिस्ट बनाने के लिए किया जाता है, सरल और कॉम्पैक्ट तरीके से।
✅ Syntax:
🧪 Example:
In English:
List comprehension provides a concise way to create lists.
Syntax: [expression for item in list]
Correct Answer: A) [expression for item in list]
Python में कितने comparison operators होते हैं?
How many comparison operators are there in Python?
Python में 6 Comparison Operators होते हैं:
| Operator | Meaning (अर्थ) | Example |
|---|---|---|
== |
बराबर है या नहीं | 5 == 5 → True |
!= |
बराबर नहीं है | 5 != 3 → True |
> |
बड़ा है | 5 > 3 → True |
< |
छोटा है | 3 < 5 → True |
>= |
बड़ा या बराबर | 5 >= 5 → True |
<= |
छोटा या बराबर | 3 <= 5 → True |
In English:
Python has 6 comparison operators used to compare values.
Correct Answer: B) 6
q = [3,4,5,20,5,25,13] के लिए, q.pop(1) का output क्या होगा?
What will be the output of q.pop(1) for q = [3,4,5,20,5,25,13]?
q = [3, 4, 5, 20, 5, 25, 13]
print(q.pop(1))
*pop(1) → Index 1 पर जो एलिमेंट है, उसे remove करता है और return करता है।
*Indexing 0 से शुरू होती है:
Index: 0 1 2 3 4 5 6
List: [3, 4, 5, 20, 5, 25, 13]
*Index 1 पर value है → 4
➡️ Output: 4
q.pop(1) removes and returns the element at index 1, which is 4.
Correct Answer: B) 4
भाषा दक्षता (language efficiency) कैसे प्राप्त की जा सकती है?
Language efficiency can be achieved through:
भाषा दक्षता (Language Efficiency) का मतलब है — कोड को कम समय और संसाधनों में प्रभावी तरीके से चलाना। इसे प्राप्त किया जा सकता है:
-
जब हम कोड को बार-बार उपयोग कर सकें, यानी Reusability हो।
🔁 Reusability से:
-
समय बचता है
-
कोड छोटा और कुशल होता है
-
एरर की संभावना कम होती है
In English:
Language efficiency refers to writing code that is effective and resource-efficient.
✅ Achieved through Reusability, which avoids redundancy and promotes optimized code.
Correct Answer: A) Reusability (पुन: प्रयोग)
"Welcome to the course of Python.".find('of', 0, 20) का output क्या होगा?
What will be the output of "Welcome to the course of Python.".find('of', 0, 20)?
"Welcome to the course of Python.".find('of', 0, 20)
.find(substring, start, end)
यह method substring को दिए गए start से end index के बीच ढूंढता है।
अगर substring मिलती है, तो उसकी index return करता है,
अगर नहीं मिलती तो -1 return करता है — न कि None.
👉 इसलिए सही output होगा: -1, लेकिन यह विकल्पों में नहीं है।
🔁 Corrected Answer:
✅ None is incorrect. The actual output is -1.
Correct Answer: D) None
Python में child class parent class की properties कैसे access करती है?
How does a child class access the properties of a parent class in Python?
Python में जब कोई child class (उपवर्ग) किसी parent class (मूल वर्ग) की properties और methods को access करता है, तो इसे inheritance कहते हैं।
🔹 यह Object-Oriented Programming (OOP) की एक मुख्य विशेषता है।
🧪 उदाहरण (Example):
In English:
Inheritance allows a child class to access and reuse the attributes and methods of a parent class in Python.
Correct Answer: B) Inheritance / इनहेरिटेंस
निम्नलिखित Python अभिव्यक्ति में x का मान क्या होगा?
What will be the value of x in the following Python expression?
x = int(43.55+2/2)
print(x)
x = int(43.55 + 2 / 2)
print(x)
Step-by-step:
1. पहले डिविज़न (/) होता है:
2 / 2 = 1.0
2. फिर जोड़:
43.55 + 1.0 = 44.55
3. int() से कनवर्जन:
int(44.55) → Decimal हटाकर केवल integer हिस्सा लेता है, यानी 44
✅ Final Answer: 44
Correct Answer: B) 44
6 का factorial (6!) क्या होगा?
What is the value of 6 factorial (6!)?
Factorial (n!) का मतलब होता है:
n!=n×(n−1)×(n−2)×⋯×1
तो, 6! =
6×5×4×3×2×1=720
In English:
6! means:
6×5×4×3×2×1=720
Correct Answer: A) 720
निम्नलिखित कोड का आउटपुट क्या होगा?
What will be the output of the following code?
t = (1,2)
print(2*t)
t = (1, 2)
print(2 * t)
* जब आप एक tuple को किसी integer से multiply करते हैं, तो वह tuple उसी क्रम में बार-बार दोहराया जाता है।
उदाहरण:
python
2 * (1, 2) → (1, 2, 1, 2)
In English:
Multiplying a tuple by an integer repeats its contents:
python
(1, 2) * 2 = (1, 2, 1, 2)
Correct Answer: B) (1,2,1,2)
ऐसी functions जो कोई मान (value) वापस नहीं करती हैं, उन्हें क्या कहा जाता है?
Functions that do not return any value are known as:
-
ऐसे functions जो कोई value return नहीं करते, उन्हें void functions कहा जाता है।
-
ये सिर्फ कोई काम (task) करते हैं, लेकिन return statement नहीं होता या
returnके साथ कोई value नहीं देते।
🧪 उदाहरण (Example):
यह function सिर्फ print करता है, कोई value वापस नहीं करता।
In English:
Functions that do not return a value are called void functions.
They may perform an action (like printing), but do not return anything.
Correct Answer: B) void functions
Python में "A" + "BC" का आउटपुट क्या होगा?
What will be the output of "A" + "BC" in Python?
"A" + "BC"
यह string concatenation (जोड़) है।
"A" और "BC" को जोड़ने पर बनेगा:
arduino
"ABC"
कोई स्पेस नहीं जोड़ा जाता जब तक आप manually न डालें।
✅ In English:
In Python, "A" + "BC" simply joins the two strings:
➡️ Output: "ABC"
Correct Answer: A) ABC
NumPy में multidimensional array को क्या कहते हैं?
What is a multidimensional array in NumPy called?
In NumPy, a multidimensional array is called an ndarray, which stands for "N-dimensional array". It can store data in 1D, 2D, 3D or more dimensions.
Hindi:
NumPy में multidimensional array को ndarray कहते हैं। इसका मतलब है "N-dimensional array", जो 1D, 2D, 3D या उससे ज्यादा dimensions में डेटा स्टोर कर सकता है।
Correct Answer: B) ndarray
निम्न Python code का आउटपुट क्या होगा?
What will be the output of the following Python code?
for i in [1, 2, 3, 4][::-1]:
print(i)
Code:
✅ English:
-
[1, 2, 3, 4][::-1]means the list is reversed. -
So the loop becomes:
for i in [4, 3, 2, 1], and it prints each number on a new line.
✅ Hindi:
-
[1, 2, 3, 4][::-1]का मतलब है लिस्ट को उल्टा कर देना। -
इसलिए loop चलता है:
for i in [4, 3, 2, 1], और हर नंबर नई लाइन में print होता है।
Correct Answer: B) 4,3,2,1
निम्नलिखित कोड चलाने पर अंतिम बार क्या मुद्रित होता है?
What is the last thing printed when the following code is run?
number = 0
while number <= 10:
print("Number: ", number)
number = number + 1
number = 0
while number <= 10:
print("Number: ", number)
number = number + 1
✅ English:
The loop starts with number = 0 and runs as long as number <= 10.
So it prints from Number: 0 to Number: 10.
After printing Number: 10, number becomes 11, and the loop stops.
Hence, the last printed line is: Number: 10
✅ Hindi:
यह loop तब तक चलता है जब तक number <= 10 होता है।
शुरुआत number = 0 से होती है और हर बार 1 बढ़ता है।
आखिरी बार number = 10 पर print होता है, फिर number = 11 हो जाता है और loop बंद हो जाता है।
Correct Answer: A) Number: 10
नीचे दिए गए Python कोड का आउटपुट क्या होगा?
What will be the output of the following Python code?
def cube(x):
return (x*x*x)
x = cube(3)
print(x)
The function cube(x) returns the cube of a number.cube(3) = 3 × 3 × 3 = 27
Hindi:cube(x) फ़ंक्शन किसी संख्या का घन (cube) लौटाता है।cube(3) = 3 × 3 × 3 = 27
✅ Output: 27
Correct Answer: B) 27
Python में print(~100) का आउटपुट क्या होगा?
What will be the output of print(~100) in Python?
In Python, ~ is the bitwise NOT operator.
It flips all the bits of the number using this formula:
x=−x−1\text{~x} = -x - 1
So,
100=−100−1=−101\text{~100} = -100 - 1 = -101
Hindi:
Python में ~ एक bitwise NOT ऑपरेटर है।
यह संख्या के सभी बिट्स को उल्टा कर देता है और फॉर्मूला होता है:
x=−x−1\text{~x} = -x - 1
इसलिए,
100=−100−1=−101\text{~100} = -100 - 1 = -101
✅ Final Output: -101
Correct Answer: A) -101
इस Python कोड का आउटपुट क्या होगा?
What will be the output of this Python code?
str="Hello python"
print(str[-7:-4:1])
-
The string is:
"Hello python" -
Negative index
-7refers to character'o'
(full string index:H(0) e(1) l(2) l(3) o(4) (5) p(6) y(7) t(8) h(9) o(10) n(11)) -
str[-7:-4:1]means: start from index -7 to index -4 (excluding -4), step 1 -
So it picks:
'o' (index -7), ' ' (index -6), 'p' (index -5) -
Output:
'o p'
2. हिंदी में:
-
स्ट्रिंग है:
"Hello python" -
-7index है'o'(जो"Hello "के बाद आता है) -
-4index है'y', लेकिन slicing में आखिरी index शामिल नहीं होता -
तो characters मिलेंगे:
'o',' ','p' -
Output होगा:
'o p'
✅ Final Output: o p
Correct Answer: B) o p
निम्नलिखित कोड चलाने के बाद a,b,c का मान क्या होगा?
What is the value of a,b,c after executing the following code?
a,b,c=23,15,16
b,c,a=a+6,b+3,c+6
print(a,b,c)
Step-by-step:
-
Initial values:
a = 23,b = 15,c = 16
Now:
Assignment happens simultaneously using original values.
So final values:
👉 a = 22, b = 29, c = 18
And the print(a, b, c) gives:
👉 22 18 29
हिंदी में:
-
शुरुआती मान:
a = 23,b = 15,c = 16
फिर यह होता है:
-
b = a + 6 → 23 + 6 = 29 -
c = b + 3 → 15 + 3 = 18 -
a = c + 6 → 16 + 6 = 22
ध्यान दें कि यह सभी calculations original values से होती हैं।
👉 Final values: a = 22, b = 29, c = 18
👉 Print करता है: 22 18 29
Correct Answer: C) 29 18 22
pickle module क्या करता है?
What does the pickle module do in Python?
The pickle module in Python is used to serialize (convert to byte stream) and deserialize (reconstruct from byte stream) Python objects. This is useful for saving objects to a file or sending them over a network.
📌 Example:
हिंदी में:
Python में pickle module का उपयोग Python objects को serialize (byte stream में बदलना) और deserialize (byte stream से वापस object बनाना) करने के लिए किया जाता है। इसका उपयोग डेटा को फाइल में सुरक्षित रखने या नेटवर्क पर भेजने के लिए किया जाता है।
Correct Answer: C) Serialize and deserialize Python objects
निम्नलिखित कोड का आउटपुट क्या होगा?
What will be the output of the following code?
x=10
y=5
x,y=y,x
print(x,y)
-
Initially:
x = 10,y = 5 -
x, y = y, xswaps the values ofxandy -
So now:
x = 5,y = 10 -
Output: 5 10
हिंदी में:
-
शुरू में:
x = 10,y = 5 -
फिर
x, y = y, xसे दोनों की values आपस में बदल जाती हैं -
अब:
x = 5,y = 10 -
इसलिए output होगा: 5 10
Correct Answer: B) 5 10
22//3 + 3/3 का आउटपुट क्या होगा?
What will be the output of: 22//3 + 3/3 ?
Step-by-step Calculation:
-
22 // 3→ Floor division
⟶ 22 divided by 3 is 7.33, floor value = 7 -
3 / 3→ True division
⟶ 3 divided by 3 = 1.0
Now:
✅ Output is a float because 1.0 is float, so result becomes float too.
Correct Answer: B) 8.0
EOF का full form क्या है?
What is the full form of EOF?
EOF stands for End Of File.
It indicates the end of data in a file or stream when reading.
Example: When reading a file in Python, the program reaches EOF when there's no more data to read.
EOF का मतलब है एंड ऑफ़ फ़ाइल।
यह दर्शाता है कि फ़ाइल या डेटा स्ट्रीम में अब और डेटा नहीं बचा है।
Correct Answer: B) End Of File / एंड ऑफ़ फ़ाइल
random.shuffle() method किस data type की value accept करता है?
random.shuffle() method accepts the value of which data type?
random.shuffle() सिर्फ list पर काम करता है क्योंकि list mutable होती है (उसे बदला जा सकता है)।
Strings और tuples immutable होते हैं, इसलिए उन्हें shuffle नहीं कर सकते सीधे।
random.shuffle()works only with lists because lists are mutable (can be changed).
Strings and tuples are immutable, so they can’t be shuffled directly.
अगर string या tuple को shuffle करना हो, तो पहले उसे list में बदलें।
Correct Answer: C) List / लिस्ट
Python में यदि return statement के साथ कोई value नहीं दी जाए, तो वह क्या लौटाता है?
In Python, if a return statement has no value, what does it return?
Python में, अगर return statement के साथ कोई value नहीं दी जाती, तो वह None लौटाता है।
In Python, if a
returnstatement has no value, it implicitly returnsNone.
🔹 उदाहरण / Example:
यहाँ return के साथ कोई value नहीं है, इसलिए function का output होगा: None
Correct Answer: C) None
'abcdefg'[2:5] का output क्या होगा?
What is the output of 'abcdefg'[2:5]?
Python में slicing का syntax होता है:
यहाँ:
-
startindex से शुरू होता है (include होता है), -
लेकिन
endindex तक नहीं जाता (exclude होता है)।
उदाहरण:
-
Index 2 →
'c' -
Index 3 →
'd' -
Index 4 →
'e' -
Index 5 → excluded
इसलिए output होगा: 'cde'
Correct Answer: A) cde
पायथन कोड का आउटपुट क्या है?
What is the output of Python code?
my_list = [3,1,4,1,5]
print(max (my_list)) my_list = [3, 1, 4, 1, 5]
print(max(my_list))
अब max() function list में सबसे बड़ी value देता है:
List = [3, 1, 4, 1, 5]
Maximum value = 5
Correct Answer: B) 5
Python में highest precedence किस operator की होती है?
Which operator has the highest precedence in Python?
Python में operator precedence (आपरेटर की प्राथमिकता) यह तय करती है कि expressions में कौन सा ऑपरेटर पहले evaluate होगा।
| Operator | Description | Precedence |
|---|---|---|
** |
Exponentiation (घात) | 🔝 Highest |
*, / |
Multiplication/Div | Medium |
+, - |
Addition/Subtraction | Lower |
and |
Logical AND | Even Lower |
उदाहरण / Example:
So, correct answer is: C) **
Correct Answer: C) **
अगर a और b एक जैसे shape की numpy arrays हैं, तो np.stack((a,b)) का क्या काम है?
If a and b are numpy arrays with the same shape, what does np.stack((a,b)) do?
जब दो numpy arrays a और b की shape एक जैसी होती है, और हम लिखते हैं:
तो यह दोनों arrays को एक नई axis पर जोड़ देता है — यानी एक higher-dimensional array बनती है।
🔹 उदाहरण / Example:
Output:
➡ अब result.shape होगा: (2, 3)
क्योंकि a और b एक-साथ stacked हो गए हैं — एक नए axis के along।
Correct Answer: A) दोनों arrays को जोड़कर एक नई array बनाता है / Joins both arrays into a new array along a new axis
4 + 2**5 // 10 का output क्या होगा?
What is the output of 4 + 2**5 // 10?
4 + 2**5 // 10
Python में operator precedence के अनुसार:
** (Exponentiation) सबसे पहले होता है
फिर // (Floor Division)
फिर + (Addition)
🔹 Step-by-step Evaluation:
python
2**5 = 32 # Step 1: Exponentiation
32 // 10 = 3 # Step 2: Floor division
4 + 3 = 7 # Step 3: Addition
✅ Final Output: 7
Correct Answer: B) 7
2**3 + 5**2 का मान क्या होगा?
What is the value of 2**3 + 5**2?
2**3 + 5**2
🔹 Step-by-step Evaluation:
2**3 = 8
5**2 = 25
8 + 25 = 33
✅ Final Answer: 33
Correct Answer: B) 33
अगर s = "Information" हो, तो print(s[2:8]) का output क्या होगा?
If s = "Information", what is the output of print(s[2:8])?
s = "Information"
print(s[2:8])
Python slicing syntax:
python
s[start : end]
*Start index = 2 → include होता है
*End index = 8 → exclude होता है
🔹 Indexing of "Information":
| Index | Character |
|---|---|
| 0 | I |
| 1 | n |
| 2 | f |
| 3 | o |
| 4 | r |
| 5 | m |
| 6 | a |
| 7 | t |
| 8 | i |
➡ So, s[2:8] gives: 'format'
🔸 लेकिन ध्यान दें कि index 2 पर 'f' है, ना कि 'n'।
तो s[2:8] = 'format'
✅ Correct Answer: A) format
Correct Answer: A) format
Python में == ऑपरेटर का उपयोग किसलिए होता है?
What is the purpose of == operator in Python?
Python में == operator का उपयोग दो values की बराबरी जांचने (equality check) के लिए किया जाता है।
In Python, the
==operator is used to compare two values and check if they are equal.
🔹 उदाहरण / Example:
Correct Answer: B) Comparison (बराबरी जांचने) के लिए
Python रनटाइम पर गुमनाम (anonymous) functions बनाने के लिए जिस construct का उपयोग करता है, उसे क्या कहा जाता है?
Python supports the creation of anonymous functions at runtime, using a construct called —–
Python में anonymous functions (जिनका कोई नाम नहीं होता) बनाने के लिए lambda keyword का उपयोग किया जाता है।
In Python, the construct used to create anonymous functions at runtime is called
lambda.
🔹 Example / उदाहरण:
यहाँ lambda x, y: x + y एक anonymous function है जिसे हमने add नाम से reference दे दिया है।
Correct Answer: C) lambda
निम्नलिखित कोड का आउटपुट क्या होगा?
What will be the output of the following code?
word = "Snow world"
print(word[4:7])
Python में slicing का syntax होता है:
-
Start index शामिल होता है (inclusive)
-
End index शामिल नहीं होता (exclusive)
String:"Snow world"
Indexes:Index Character 0 S 1 n 2 o 3 w 4 ␣ (space) 5 w 6 o 7 r 8 l 9 d word[4:7]का मतलब है:-
Index 4 →
' '(space) -
Index 5 →
'w' -
Index 6 →
'o' -
Index 7 → excluded
➡ इसलिए Output:
' wo'(space + 'w' + 'o') -
Correct Answer: C) wo
किस NumPy function से array का median निकाला जाता है?
Which NumPy function is used to find the median of an array?
NumPy में array का median (मध्य मान) निकालने के लिए इस्तेमाल होता है:
np.median()calculates the middle value of a sorted NumPy array.
अगर elements की संख्या even हो, तो यह बीच के दो values का average देता है।
🔹 उदाहरण / Example:
(क्योंकि sorted array: [2, 5, 8, 10], बीच के दो: 5 और 8, median = (5+8)/2 = 6.5)
Correct Answer: B) np.median()
Logical OR operator का symbol क्या है?
What is the symbol of logical OR operator in Python?
Python में logical OR operator का symbol है:
orका उपयोग दो conditions में से कोई एक True होने पर True return करने के लिए किया जाता है।
🔹 उदाहरण / Example:
यहाँ a > 3 is True, तो पूरी condition True मानी जाएगी।
Correct Answer: B) or
Python में "A" + "BC" का आउटपुट क्या होगा?
What will be the output of "A" + "BC" in Python?
Python में + operator को strings के साथ इस्तेमाल करने पर यह concatenation (जोड़ना) करता है।
"A" + "BC"means: दोनों strings को जोड़ना
Output: "ABC"
🔹 Example:
Correct Answer: A) ABC
Python में नीचे दिए गए कोड का परिणाम क्या होगा?
What will be the result of the following Python code?
x = (1, 2, 3)
x[0] = 3
x = (1, 2, 3)
x[0] = 3
यहाँ x एक tuple है, और tuples immutable होते हैं, यानी एक बार बनने के बाद उसके elements को बदला नहीं जा सकता।
➡ जब आप x[0] = 3 करने की कोशिश करेंगे, तो Python एक TypeError देगा।
🔹 Error message (Approximate):
plaintext
TypeError: 'tuple' object does not support item assignment
Correct Answer: C) TypeError
Python में function के अंदर define किया गया variable क्या कहलाता है?
What is a variable defined inside a function in Python called?
Python में यदि कोई variable function के अंदर define किया जाता है, तो उसे local variable कहा जाता है।
A variable defined inside a function is called a local variable because its scope is limited to that function only.
🔹 Example / उदाहरण:
Correct Answer: B) local variable
Binary संख्या 110001 का decimal में मान क्या होगा?
What is the decimal value of binary number 110001?
Binary संख्या 110001 को Decimal में बदलने के लिए हम powers of 2 का उपयोग करते हैं।
Binary: 1 1 0 0 0 1
Positions (powers of 2):
अब इन्हें जोड़ते हैं:
✅ Final Answer: (b) 49
Correct Answer: B) 49
Python में break और continue का अंतर क्या है?
What is the difference between break and continue in Python?
Python में break और continue दोनों का उपयोग loops (जैसे for, while) में किया जाता है, लेकिन उनका काम अलग होता है:
✅ break:
-
Loop को पूरी तरह से रोक देता है
-
यानी जहां
breakमिला, वहीं से loop बंद हो जाता है
✅ continue:
-
उस iteration को छोड़ देता है और अगली iteration पर चला जाता है
-
Loop चलता रहता है
Correct Answer: B) break exits loop, continue skips current iteration
Python में कौन सा keyword function define करने के लिए प्रयोग होता है?
Which keyword is used to define a function in Python?
Python में किसी function को define करने के लिए def keyword का उपयोग किया जाता है।
defstands for define, and it's the correct Python syntax to create a function.
🔹 Example / उदाहरण:
def greet():
print("Hello, World!")
greet()
# Output: Hello, World!
Correct Answer: C) def
Python में print(9//4*3 - 6*3//4) का आउटपुट क्या होगा?
What will be the output of print(9//4*3 - 6*3//4) in Python?
🔹 Expression:
print(9 // 4 * 3 - 6 * 3 // 4)
Python में operator precedence के अनुसार:
-
//(floor division) और*पहले होते हैं (left to right), -
फिर
-(subtraction)🔹 Step-by-Step Evaluation:
-
9 // 4 = 2 -
2 * 3 = 6 -
6 * 3 = 18 -
18 // 4 = 4 -
अब expression बन गया:
6 - 4 = 2
✅ Final Output: 2
-
Correct Answer: B) 2
Python में factorial निकालने के लिए सबसे अच्छा तरीका क्या है?
What is the best way to calculate factorial in Python?
Python में factorial निकालने के कई तरीके हैं, लेकिन एक classical और elegant तरीका है — recursive function का उपयोग करना।
A recursive function is a function that calls itself to solve smaller instances of the same problem — perfect for factorials.
🔹 Recursive factorial function का उदाहरण:
def factorial(n):
if n == 0 or n == 1:
return 1
else:
return n * factorial(n - 1)
print(factorial(5)) # Output: 120
Correct Answer: B) Using a recursive function
Python में type() function का क्या काम है?
What does the type() function do in Python?
Python में type() function का उपयोग किसी object या variable का data type पता करने के लिए किया जाता है।
type()function returns the class/type of the object you pass to it.
🔹 Example / उदाहरण:
x = 10
print(type(x)) # Output: <class 'int'>
y = "Hello"
print(type(y)) # Output: <class 'str'>
Correct Answer: B) Return the data type of an object
Python में नीचे दिए गए कोड का आउटपुट क्या होगा?
What will be the output of the following Python code?
L = [1, 2, 3, 4, 5]
print([x & 1 for x in L])
Given Code:
Correct Answer: B) [1, 0, 1, 0, 1]
Python में range(5) का आउटपुट क्या होगा?
What will range(5) generate?
Python में range(n) एक sequence generate करता है:
range(n)→ 0 से लेकर n-1 तक के numbers बनाता है (n शामिल नहीं होता)
🔹 Example / उदाहरण:
for i in range(5):
print(i, end=' ')
Output:
Correct Answer: A) 0 1 2 3 4
इस पायथन कोड को चलाने पर निम्नलिखित में से कौन सा कथन मुद्रित नहीं होगा?
Which of the following statements won’t be printed when this Python code is run?
for letter in 'Python':
if letter == 'h':
continue
print('Current Letter : ' + letter)
Code:
Correct Answer: C) Current Letter : h
Python में truncation करने के लिए कौन सा method प्रयोग किया जाता है?
Which method is used to truncate a number in Python?
Truncation का मतलब है किसी decimal संख्या से fractional हिस्सा हटा देना — यानी केवल integer part को रखना, बिना round किए।
Python में truncation के लिए इस्तेमाल होता है:
math.trunc()
🔹 Example / उदाहरण:
Correct Answer: D) math.trunc()
Python में write() function क्या return करता है?
What does the write() function return in Python?
Python में जब आप किसी file में कुछ लिखते हैं:
f = open("demo.txt", "w")
chars_written = f.write("Hello")
print(chars_written) # Output: 5
➡ write() function उस string में लिखे गए characters की संख्या return करता है।
🔹 Example:
f = open("file.txt", "w")
result = f.write("Python")
print(result)
# Output: 6 (क्योंकि "Python" में 6 characters हैं)
Correct Answer: C) Number of characters written
निम्न Python कोड के आउटपुट में types क्या होंगी?
What will be the types printed by the following Python code?
print(type(5/2))
print(type(5//2))
🔹 Explanation (Bilingual):
Python में division operators के दो प्रकार हैं:
-
/(Normal Division) -
//(Floor Division)
🔸 5 / 2 → Normal Division
-
यह हमेशा float result देता है
-
5 / 2 = 2.5 -
👉
type(5 / 2)→float
🔸 5 // 2 → Floor Division
-
यह integer result देता है (decimal को हटा देता है नीचे की ओर)
-
5 // 2 = 2 -
👉
type(5 // 2)→int
🔹 Code:
print(type(5/2)) # Output: <class 'float'>
print(type(5//2)) # Output: <class 'int'>
Correct Answer: C) float and int
Python में किसी variable (identifier) को खोजने का क्रम क्या है?
What is the order in which Python searches for an identifier?
Python में जब किसी variable (identifier) को access किया जाता है, तो interpreter उसे LEGB rule के अनुसार खोजता है:
LEGB = Local → Enclosing → Global → Built-in
🔸 1. Local (L):
Current function/block के अंदर define हुआ variable
🔸 2. Enclosing (E):
अगर function किसी और function के अंदर है, तो outer function का scope
🔸 3. Global (G):
Module level (script level) पर defined variables
🔸 4. Built-in (B):
Python के inbuilt functions/objects (जैसे len, print, sum)
🔹 Example:
x = "global"
def outer():
x = "enclosing"
def inner():
x = "local"
print(x) # Searches: Local → Enclosing → Global → Built-in
inner()
outer()
Output: local
Correct Answer: B) Local → Enclosing → Global → Built-in
नीचे दिए गए में से कौन सा loop कम से कम एक बार ज़रूर execute होता है, चाहे condition false हो?
Which of the following loops always executes the loop body at least once, even if the condition is false?
do-while loop एक ऐसा loop होता है जो कम से कम एक बार ज़रूर चलता है, चाहे उसकी condition शुरू में false ही क्यों न हो।
क्योंकि
do-whileloop में पहले loop body execute होती है, फिर condition check होती है।
🔹 Python में do-while नहीं होता:
-
Python में directly
do-whileloop का support नहीं है। -
लेकिन अन्य भाषाओं (जैसे C, C++, Java) में
do-whileऐसा ही काम करता है।do {
// code block
} while (condition);यह block एक बार ज़रूर चलेगा, फिर condition check होगी।
Correct Answer: C) do-while loop
नीचे दिए गए Python कोड का आउटपुट क्या होगा?
What will be the output of the following Python code?
x = 15
def f1(a, b=x):
print(a, b)
f1(4)
x = 15
def f1(a, b=x):
print(a, b)
f1(4)
इस कोड में function f1 दो arguments लेता है:
-
a→ required argument -
b→ default argument, जिसकी value हैx, और उस समयx = 15
🔍 क्या होता है:
-
जब function
f1(4)को call किया गया, तो:-
a = 4 -
bको कोई value नहीं दी गई, इसलिए इसका default value (x = 15) इस्तेमाल होगा
-
➡ Output: 4 15
❗ Important Note:
Default arguments को function definition के समय evaluate किया जाता है, call के समय नहीं।
Correct Answer: A) 4 15
Python में pow(2, 3, 5) का परिणाम क्या होगा?
What will be the result of pow(2, 3, 5) in Python?
pow() function in Python, when provided with three arguments, calculates (base ** exponent) % modulus.
pow(2, 3, 5):
baseis 2exponentis 3modulusis 5
2 ** 3 is calculated, which equals 8.Then,
8 % 5 is calculated, which is the remainder when 8 is divided by 5. This remainder is 3.
pow(2, 3, 5) in Python is 3.
Correct Answer: C) 3
Python list की index() विधि का क्या उद्देश्य है?
What is the purpose of the index() method in a Python list?
Python में list.index(item) method का उपयोग list में दिए गए item का पहला index पता करने के लिए किया जाता है।
It returns the index (position) of the first occurrence of the specified value.
🔹 Example / उदाहरण:
fruits = ['apple', 'banana', 'cherry', 'banana']
print(fruits.index('banana')) # Output: 1
➡ क्योंकि 'banana' सबसे पहले index 1 पर आता है।
Correct Answer: C) किसी item का पहला index ढूँढना (To find the first index of an item)
NumPy में array बनाने के लिए कौन सा function उपयोग किया जाता है?
Which function is used to create an array in NumPy?
NumPy में array बनाने के लिए array() function का उपयोग किया जाता है।
🔹 Example / उदाहरण:
import numpy as np
arr = np.array([1, 2, 3, 4])
print(arr)
Output:
Correct Answer: A) array()
Python में nested function क्या होती है?
What is a nested function in Python?
Python में nested function का मतलब होता है:
एक function के अंदर दूसरा function define करना।
🔹 Example / उदाहरण:
def outer():
def inner():
print("Hello from inner function")
inner()
outer()
यहाँ inner() function, outer() के अंदर defined है — यही nested function कहलाता है।
Correct Answer: A) A function inside another function
a और b वेरिएबल का डेटा टाइप क्या होगा?
What will be the data types of variables a and b?
var a = 10
var b = "Manish"
a = 10
b = "Manish"
इसमें:
-
aको assign किया गया है10→ यह एक integer है -
bको assign किया गया है"Manish"→ यह एक string है
🔍 Data types:
Correct Answer: B) Int and str
यदि x = 1 है, तो x << 2 का परिणाम क्या होगा?
If x = 1, then what will be the result of x << 2?
<< is the left shift operator in Python.
It shifts the bits of a number to the left by the given number of positions.
🔸 Given:
x = 1
x << 2
Means: Shift bits of 1 to the left by 2 positions
🔍 Binary Calculation:
-
1in binary =0001 -
Shift left by 2:
0001→0100
That is:
1 << 2 = 1 × 2² = 4
Correct Answer: A) 4
निम्नलिखित कोड का आउटपुट क्या होगा?
What will be the output of the following code?
print(-18//4)
Given code:
Correct Answer: B) -5
1011 का आउटपुट क्या होगा?
What will be the output of: 1011 ?
The expression 1011 by itself (without any prefix or context) in Python is simply treated as a decimal integer.
print(1011)
Python इसे एक decimal number मानेगा — यानी:
➡ 1011 (base 10) = 1011
लेकिन अगर आप यह पूछ रहे हैं कि binary 1011 का decimal में क्या मान होगा, तो:
0b1011 → Binary literal
Then:
Correct Answer: C) Error
NumPy में identity matrix बनाने के लिए क्या उपयोग किया जाता है?
Which NumPy function is used to create an identity matrix?
Identity matrix एक square matrix होती है जिसमें:
-
main diagonal में सभी values =
1 -
बाकी सभी values =
0
🔹 NumPy में इसे बनाने के लिए:
import numpy as np
matrix = np.identity(3)
print(matrix)
Output:
[[1. 0. 0.]
[0. 1. 0.]
[0. 0. 1.]]
Correct Answer: B) np.identity()
Flowchart में निर्णय (decision) के लिए कौन सा symbol उपयोग किया जाता है?
In a flowchart, which symbol is used for division (decision making)?
Flowchart में विभिन्न कार्यों को दर्शाने के लिए अलग-अलग symbols का उपयोग किया जाता है:
| Symbol | उपयोग (Use) |
|---|---|
| 🟦 Parallelogram | Input/Output दिखाने के लिए |
| ▭ Rectangle | किसी Process/Step को दिखाने के लिए |
| ⬭ Oval | Start या End को दर्शाने के लिए |
| 🔷 Diamond | Decision (जैसे Yes/No, True/False) को दिखाने के लिए ✅ |
🔸 उदाहरण / Example:
🔷
Is age > 18?
/ \
Yes No
/ \
Process A Process B
यहां निर्णय लेने के लिए Diamond symbol का उपयोग किया गया है।
Correct Answer: D) Diamond (Decision के लिए)
निम्नलिखित NumPy कोड का आउटपुट क्या होगा?
What is the output of the following NumPy code?
arr = np.array([1,2,3,4,5])
print(np.sum(arr))
Given NumPy code:
import numpy as np
arr = np.array([1, 2, 3, 4, 5])
print(np.sum(arr))
🔸 np.sum(arr) क्या करता है?
यह function array के सभी elements का योग (sum) करता है:
1 + 2 + 3 + 4 + 5 = 15
✅ Final Output: 15
Correct Answer: B) 15
Python में नीचे दिए गए कोड का आउटपुट क्या होगा?
What will be the output of the following Python code?
L = [1, 2, 3, 4, 5]
print([x & 1 for x in L])
Given code:
L = [1, 2, 3, 4, 5]
print([x & 1 for x in L])
यह एक list comprehension है, जिसमें x & 1 का इस्तेमाल हो रहा है।
🔸 क्या होता है x & 1?
यह एक bitwise AND operation है, जो x के last bit की जांच करता है:
-
यदि number odd है, तो
x & 1 = 1 -
यदि number even है, तो
x & 1 = 0x Binary x & 1 Result 1 0001 0001 1 2 0010 0000 0 3 0011 0001 1 4 0100 0000 0 5 0101 0001 1 🔸 Output:
[1, 0, 1, 0, 1]
Correct Answer: B) [1, 0, 1, 0, 1]
इस कोड का आउटपुट क्या होगा?
What will be the output of this code?
a = 5
b = 1
c = 1 ^ 5
print(c)
1 ^ 5 = 6 # Bitwise XOR
Because:
1 = 0001
5 = 0101
------------
XOR = 0110 → 6
✅ Output: 6
Correct Answer: D) 6
क्या NumPy module को ऐसे import करना सही है?
Is it correct to import NumPy module like this?
import numpy as np
import numpy as np
यह एक सही और standard तरीका है NumPy को import करने का।
-
यहाँ
numpyको short namenpदिया गया है, -
जिससे बाद में
np.array(),np.sum()आदि functions आसानी से इस्तेमाल किए जा सकते हैं।
🔸 Example:
import numpy as np
arr = np.array([1, 2, 3])
print(np.sum(arr)) # Output: 6
Correct Answer: A) Yes, completely correct
कौन सा ऑपरेटर _gt_() overload किया जाता है?
Which operator is overloaded by the method _gt_() ?
Python में special methods (जिसे dunder methods भी कहते हैं, जैसे __gt__()), operators को overload करने के लिए इस्तेमाल होते हैं।
-
__gt__()का मतलब है:
➤ "greater than" (>) operator को overload करना"
🔸 Example:
class MyNumber:
def __init__(self, value):
self.value = value
def __gt__(self, other):
return self.value > other.value
a = MyNumber(10)
b = MyNumber(5)
print(a > b) # True → because __gt__() is called
Correct Answer: B) > (greater than)
Python में single line comment लिखने के लिए कौन सा symbol प्रयोग होता है?
Which symbol is used to write a single line comment in Python?
Python में single-line comment लिखने के लिए # symbol का उपयोग किया जाता है।
🔸 Example:
यह एक comment है
print("Hello, world!") # यह भी एक inline comment है
# के बाद लिखा गया टेक्स्ट Python द्वारा ignore कर दिया जाता है।
Correct Answer: C) #
NumPy में array बनाने के लिए निम्न में से कौन सा method प्रयोग कर सकते हैं?
Which of the following can be used to create NumPy arrays?
-
np.empty()→ Empty array (uninitialized) -
np.ones()→ Array filled with 1s -
np.zeros()→ Array filled with 0s
All are used to create NumPy arrays.
Correct Answer: D) All of the above
Python फाइल की सही extension क्या है?
What is the correct extension of a Python file?
Python फाइल की extension .py होती है।
Correct Answer: B) .py
Python में कौन सा loop entry control loop है?
Which of the following is an entry control loop in Python?
-
Python में
forऔरwhileदोनों ही entry control loops हैं।
इसका मतलब है कि ये loops condition पहले चेक करते हैं, फिर loop body execute होती है। -
Python में
do-whileloop नहीं होता।
Correct Answer: D) both for and while
Python में date और time को specific format में string में बदलने के लिए कौन सा method प्रयोग होता है?
In Python, which method is used to format date and time as a string?
✅ Correct Answer: B) strftime
✔ Used to: Convert date/time to a formatted string in Python.
Correct Answer: B) strftime
Python में identifier (जैसे variable, function name) की अधिकतम लंबाई कितनी हो सकती है?
What is the maximum length of an identifier in Python?
Python में identifier (जैसे variable या function name) की कोई fixed maximum length limit नहीं है।
-
आप बहुत लंबा नाम रख सकते हैं (जितना system memory allow करे)।
-
लेकिन readability के लिए नाम छोटे और समझने लायक होने चाहिए।
Correct Answer: D) None / कोई नहीं
मान्य निर्देशों (instructions) के निर्माण को नियंत्रित करने वाले formal grammar rules को क्या कहते हैं?
The formal grammar rules governing the construction of valid instructions are called:
-
Syntax: किसी programming language के rules होते हैं जो बताते हैं कि instructions कैसे लिखे जाएँ ताकि कंप्यूटर उन्हें समझ सके।
-
यदि syntax गलत है, तो syntax error आता है।
Correct Answer: A) Syntax / सिंटैक्स
Python dictionary में data कैसे store होता है?
How is data stored in a Python dictionary?
In Python, a dictionary stores data as key-value pairs, where each unique key maps to a specific value.
Python में dictionary data को कुंजी-मूल्य जोड़े (key-value pairs) के रूप में संग्रहित करती है, जहाँ हर कुंजी एक विशिष्ट मान (value) से जुड़ी होती है।
Example / उदाहरण:
student = {"name": "Amit", "age": 20}
Here, "name" is a key and "Amit" is its value.
यहाँ "name" कुंजी है और "Amit" उसका मान है।
Correct Answer: C) Key-value pairs / कुंजी-मूल्य जोड़े
EOL का full form क्या है?
What is the full form of EOL?
-
English:
EOL stands for End Of Line, which indicates the end of a line of text in programming or text files. -
हिंदी (Hindi):
EOL का मतलब होता है एंड ऑफ़ लाइन, जो प्रोग्रामिंग या टेक्स्ट फाइल में एक लाइन के अंत को दर्शाता है।
Correct Answer: A) End Of Line / एंड ऑफ़ लाइन
Python में कौन सा valid arithmetic operator नहीं है?
Which of the following is NOT a valid Python arithmetic operator?
-
English:
&&is not a valid arithmetic operator in Python. It is used in some other languages (like C, C++, Java) for logical AND.
In Python, logical AND is written asand. -
हिंदी (Hindi):
&&Python में एक वैध गणितीय (arithmetic) ऑपरेटर नहीं है। यह कुछ अन्य भाषाओं (जैसे C, C++, Java) में logical AND के लिए इस्तेमाल होता है।
Python में logical AND के लिएandलिखा जाता है।
✅ Valid Arithmetic Operators in Python:
-
+→ Addition (जोड़) -
-→ Subtraction (घटाव) -
*→ Multiplication (गुणा) -
/→ Division (विभाजन) -
//→ Floor Division (पूर्णांक विभाजन) -
%→ Modulus (शेषफल) -
**→ Exponentiation (घात)
Correct Answer: D) &&
range(0) की value क्या है?
What is the value of range(0)?
-
English:
range(0)creates a range object that starts at 0 and ends before 0 — which means it contains no values.
Sorange(0)is equivalent torange(0, 0)→ an empty range. -
हिंदी (Hindi):
range(0)एक ऐसा range object बनाता है जो 0 से शुरू होता है और 0 से पहले खत्म हो जाता है — यानी इसमें कोई भी मान नहीं होता।
इसलिएrange(0)का मतलब हैrange(0, 0)→ एक खाली range।
🔍 Output Example:
print(list(range(0))) # Output: []
यह एक empty list देगा क्योंकि range में कोई भी नंबर नहीं है।
Correct Answer: B) range(0,0)
Python में console से input लेने के लिए कौन सा function प्रयोग होता है?
Which function is used to accept console input in Python?
Short Explanation (Bilingual):
-
English:
input()is used to take user input from the console in Python. -
हिंदी: Python में console से इनपुट लेने के लिए
input()का उपयोग किया जाता है।
Example:
name = input("Enter your name: ")
Correct Answer: B) input()
Python में इस code का output क्या होगा?
What will be the output?
a = 9
b = 1
print(a | b)
-
English:
|is bitwise OR.9 | 1→1001 | 0001=1001→ 9 -
हिंदी:
|बिटवाइज़ OR होता है।9 | 1= 9
Correct Answer: C) 9
नीचे दिए गए function का output क्या होगा?
What will be the output of the following function?
def C2F(c):
return c*9/5+32
print(C2F(100))
print(C2F(0))
The function converts Celsius to Fahrenheit using the formula:F = (C × 9/5) + 32
C2F(100) → (100 × 9/5) + 32 = 180 + 32 = 212.0
C2F(0) → (0 × 9/5) + 32 = 0 + 32 = 32.0
हिंदी:
यह function Celsius को Fahrenheit में बदलता है:
फार्मूला है → (C × 9/5) + 32
C2F(100) = 212.0
C2F(0) = 32.0
✅ Output: 212.0, 32.0
Correct Answer: B) 212.0, 32.0
नीचे में से कौन सा popular assembler नहीं है?
Which of the following is NOT a popular assembler?
-
English:
NASM, GAS, and ASM are popular assemblers used for low-level programming.
C++ is a high-level programming language, not an assembler. -
हिंदी:
NASM, GAS, और ASM लोकप्रिय असेंबलर हैं।
C++ एक उच्च स्तरीय प्रोग्रामिंग भाषा है, असेंबलर नहीं।
Correct Answer: D) C++
नीचे में से कौन सा popular assembler नहीं है?
Which of the following is NOT a popular assembler?
NASM, GAS, and ASM are popular assemblers used for low-level programming.
C++ is a high-level programming language, not an assembler.
हिंदी:
NASM, GAS, और ASM लोकप्रिय असेंबलर हैं।
C++ एक उच्च स्तरीय प्रोग्रामिंग भाषा है, असेंबलर नहीं।
Correct Answer: D) C++
NumPy का full form क्या है?
What is the full form of NumPy?
-
NumPy stands for Numerical Python. It is a powerful Python library used for numerical computations, arrays, matrices, etc.
-
हिंदी:
NumPy का पूरा नाम है Numerical Python। यह एक शक्तिशाली लाइब्रेरी है जो संख्यात्मक गणना (numerical computation), arrays और matrices के लिए उपयोग होती है।
Correct Answer: B) Numerical Python / न्यूमेरिकल पायथन
Append mode में file खोलने के लिए कौन सा mode इस्तेमाल होता है?
Which mode is used to open a file in append mode?
-
English:
'a'mode is used to open a file in append mode, which adds data to the end of the file without deleting existing content. -
हिंदी:
'a'मोड का उपयोग append mode में फाइल खोलने के लिए होता है। इसमें नया डेटा फाइल के अंत में जोड़ा जाता है, और पुराना डेटा मिटता नहीं है।
Correct Answer: B) 'a'
int('101') का output क्या होगा?
What will be the output of int('101')?
-
English:
int('101')converts the string'101'into an integer → 101 (base 10). -
हिंदी:
int('101')एक string'101'को पूराांक (integer) में बदलता है → 101 (दशमलव प्रणाली में)।
Correct Answer: A) 101
नीचे दिए गए में से कौन सा immutable object है?
Which of the following is an immutable object?
-
English:
A tuple is an immutable object in Python — meaning its values cannot be changed after creation. -
हिंदी:
Tuple Python में एक immutable वस्तु है — यानी इसे एक बार बनाने के बाद बदला नहीं जा सकता।
Correct Answer: C) Tuple / टपल
Python में खुद से बनाए गए function को क्या कहते हैं?
What do we call a function whose name is chosen by the programmer?
-
English:
A user-defined function is a function created by the programmer, with a name chosen by the user. -
हिंदी:
User-defined function वह फंक्शन होता है जिसे प्रोग्रामर खुद बनाता है, और उसका नाम भी खुद तय करता है।
📌 Example / उदाहरण:
def greet():
print("Hello!")
यह greet() एक user-defined function है।
Correct Answer: B) User-defined function / यूज़र-डिफ़ाइंड फंक्शन
print(len('hello')) का output क्या होगा?
What will be the output of print(len('hello'))?
-
English:
len('hello')returns the number of characters in the string'hello'.
It has 5 characters: h, e, l, l, o -
हिंदी:
len('hello')string'hello'में मौजूद अक्षरों की संख्या लौटाता है।
इसमें 5 अक्षर हैं: h, e, l, l, o
Correct Answer: B) 5
"abcde"[::-1] का output क्या होगा?
What will be the output of "abcde"[::-1]?
-
English:
"abcde"[::-1]uses string slicing with a step of-1, which means the string is reversed. -
हिंदी:
"abcde"[::-1]में slicing का step-1है, जो string को उल्टा (reverse) कर देता है।
🔄 Result:
"abcde"[::-1] → "edcba"
Correct Answer: B) edcba
File object के कौन से attributes होते हैं?
Which are attributes related to file objects?
-
English:
In Python, a file object has attributes like:-
name→ name of the file -
closed→ returns True if file is closed -
mode→ mode in which file was opened (e.g.,'r','w','a')
-
-
हिंदी:
Python में file object के पास ये attributes होते हैं:-
name→ फाइल का नाम -
closed→ फाइल बंद है या नहीं (True/False) -
mode→ फाइल किस mode में खोली गई थी ('r','w', आदि)
-
Correct Answer: A) name, closed, mode
Python में set को जोड़ने के लिए कौन सी method प्रयोग होती है?
Which method is used to add an element to a set in Python?
-
English:
In Python, to add an element to a set, the method used isadd(). -
हिंदी:
Python में किसी set में element जोड़ने के लिएadd()method का उपयोग किया जाता है।
🔹 Example / उदाहरण:
my_set = {1, 2, 3}
my_set.add(4)
print(my_set) # Output: {1, 2, 3, 4}
Correct Answer: A) add()
math module से factorial(5) का output क्या होगा?
What will be the output of factorial(5) from the math module?
-
English:
math.factorial(5)calculates 5! (5 factorial), which is:5 × 4 × 3 × 2 × 1 = 120 -
हिंदी:
math.factorial(5)का मतलब है 5 का factorial, यानी:5 × 4 × 3 × 2 × 1 = 120
✅ Example:
import math
print(math.factorial(5)) # Output: 120
Correct Answer: A) 120
Python का कौन सा शब्द keyword नहीं है?
Which of the following is NOT a Python keyword?
-
English:
True,None, andpassare Python keywords.valueis not a keyword; it's just a normal identifier/name. -
हिंदी:
True,None, औरpassPython के keywords हैं।valueकोई keyword नहीं है, बल्कि एक सामान्य नाम है।
Correct Answer: D) value