O Level Python Paper January 2024
a*=8 ______ के समान है
a*=8 same as ______
The expression a *= 8 is shorthand for a = a * 8.
So, the correct answer is:
Answer: (D) a = a * 8
Correct Answer: D) a=a*8
165 और 268 के बीच की सीमा में निम्नलिखित में से कौन सी एकमात्र सही फाइबोनैचि संख्या है?
Which of the following is the only correct Fibonacci number in the range between 165 and 268?
The Fibonacci sequence starts as: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, ...
Looking at the options:
- 144 is less than 165.
- 233 is between 165 and 268.
- 377 is greater than 268.
- 200 is not a Fibonacci number.
Thus, the correct Fibonacci number between 165 and 268 is 233.
Answer: (B) 233
Correct Answer: B) 233
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
What will be the output of the following Python code?
print(-22 % 3)
इस कोड का आउटपुट क्या है:
What is the output of this code:
def add(x, y):
return x + y;
print(add(3, 4))
The function add(x, y) returns the sum of x and y.
When calling add(3, 4), it will return 3 + 4 = 7.
So, the output will be 7.
Answer: (C) 7
Correct Answer: C) 7
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
What will be the output of the following Python code?
def sum(x):
return x * x
print(sum(4))
The function sum(x) returns the square of the input x, as it calculates x * x.
When calling sum(4), it will compute 4 * 4 = 16.
So, the output will be 16.
Answer: (B) 16
Correct Answer: B) 16
यदि A = 16 और B = 15 है तो नीचे दिए गए व्यंजक का मूल्यांकन करें।
Evaluate the expression given below if A = 16 and B = 15.
A % B // A
- Modulo (
%):16 % 15 = 1 - Floor division (
//):1 // 16 = 0
So, the result is 0.
Answer: (B) 0
Correct Answer: B) 0
निम्नलिखित अभिव्यक्ति का परिणाम क्या होगा?
What will be the result of the following expression?
“4 + 5”
The expression "4 + 5" is a string. When the + operator is used with strings, it performs concatenation, not addition.
So, "4" + "5" will result in the string "45", not the sum of the numbers 4 and 5.
Answer: (A) 45
Correct Answer: A) 45
इसका आउटपुट क्या होगा: print(5&3)
what will the output of : print(5&3)
The bitwise AND of 5 (0101) and 3 (0011) results in 0001, which is 1 in decimal.
Answer: (A) 1
Correct Answer: A) 1
print(math.fabs(-3.4)) निष्पादित करने पर क्या प्रदर्शित होता है?
What is displayed on executing print(math.fabs(-3.4))?
The math.fabs() function returns the absolute value of a number, meaning it removes the negative sign if the number is negative.
So, math.fabs(-3.4) will return 3.4.
Answer: (B) 3.4
Correct Answer: B) 3.4
निम्नलिखित पायथन कोड स्निपेट का आउटपुट क्या होगा?
What will be the output of the following Python code snippet?
print('Ab!2'.swapcase())
The swapcase() method changes uppercase letters to lowercase and vice versa. So, 'Ab!2' becomes 'aB!2'.
Answer: (C) aB!2
Correct Answer: C) aB!2
यदि x = math.factorial(0) है तो x का मान क्या है?
What is the value of x if x = math.factorial(0)?
The factorial of 0 is defined as 1. This is a standard mathematical definition.
So, if x = math.factorial(0), the value of x will be 1.
Answer: (B) 1
Correct Answer: B) 1
आउटपुट क्या है
What is the output
>>>max("what are you")
The max() function returns the largest element in an iterable based on its lexicographical order (alphabetical order).
For the string "what are you", the largest character (based on ASCII values) is 'y'.
So, the output will be:
Answer: (D) y
Correct Answer: B) u
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
What will be the output of the following Python code?
import numpy as np
arr = np.array([1, 2, 3])
print(arr.shape)
The shape attribute of a NumPy array returns a tuple that represents the dimensions of the array.
For the array arr = np.array([1, 2, 3]), it is a one-dimensional array with 3 elements.
So, arr.shape will return (3,), indicating a 1-dimensional array with 3 elements.
Answer: (A) (3,)
Correct Answer: A) (3,)
निम्नलिखित स्निपेट का आउटपुट क्या है:
What is the output of following snippet:
x=10
y=3
print(divmod(x,y))
The divmod(x, y) function returns a tuple with the quotient and remainder of x divided by y.
For x = 10 and y = 3, the result is (3, 1).
Answer: (A) (3, 1)
Correct Answer: A) (3, 1)
आउटपुट क्या होगा >>>"abcd"[2:]
What will be the output >>>"abcd"[2:]
The slice "abcd"[2:] starts from index 2 and includes everything after it, which is "cd".
Answer: (C) cd
Correct Answer: C) cd
(-3)**2 का आउटपुट क्या है?
What is the output of (-3)**2?
The expression (-3)**2 means raising -3 to the power of 2.
When you square a negative number, the result is positive, so:
(-3)**2 = 9
Answer: (B) 9
Correct Answer: B) 9
मान लीजिए L [2, 3, 8, 4, 5] है, L[-1] क्या है?
Suppose L is [2, 3, 8, 4, 5], What is L[-1]?
In Python, negative indexing means counting from the end of the list. So, L[-1] refers to the last element of the list.
For the list L = [2, 3, 8, 4, 5], the last element is 5.
Answer: (B) 5
Correct Answer: B) 5
निम्नलिखित में से कौन सी त्रुटि दिए गए कोड द्वारा लौटाई जाती है?
Which of the following error is returned by the given code ?
>>> f = open(“test.txt”,”w”)
>>> f.write(345)
In Python, the write() method expects a string as an argument, but 345 is an integer. Therefore, attempting to write an integer directly to a file will cause a TypeError.
Answer: (B) Type Error
Correct Answer: B) Type Error
निम्नलिखित कोड का आउटपुट लिखें:
Write the output of the following code :
>>> L=[‘w’,’e’,’l’,’c’,’o’,’m’,’e’]
>>> print(len(L))
The list L contains the following characters: ['w', 'e', 'l', 'c', 'o', 'm', 'e']. It has 7 elements.
The len() function returns the number of elements in the list.
So, the output will be:
Answer: (A) 7
Correct Answer: A) 7
यदि x=1 है तो निम्नलिखित पायथन कोड स्निपेट का आउटपुट क्या होगा?
What will be the output of the following Python code snippet if x=1?
x<<2
The << operator shifts the bits to the left. For x = 1, the binary representation of 1 is 0001. Shifting it left by 2 positions gives 0100, which equals 4.
Answer: (D) 4
Correct Answer: D) 4
निम्नलिखित function का अध्ययन कीजिए: इस कोड का आउटपुट क्या होगा?
Study the following function: What will be the output of this code?
import math
abs(math.sqrt(36))
The function math.sqrt(36) computes the square root of 36, which is 6.0. The abs() function returns the absolute value of a number, and since 6.0 is already positive, abs(6.0) will still be 6.0.
So, the output will be:
Answer: (D) 6.0
Correct Answer: D) 6.0