🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

O Level Python Paper July 2024

Question: 1 Report Error

कोड की कौन सी पंक्ति 'grapes' की key और 15 के value के साथ fruits dictionary में एक आइटम को सही ढंग से जोड़ती है?

Which line of code correctly adds an item to the fruits dictionary with a key of ‘grapes’ and a value of 15?

fruits = {'apples': 1, 'bananas': 4, 'pears': 17, 'oranges': 14}
A)
B)
C)
D)
Explanation

To add an item to the fruits dictionary with the key 'grapes' and the value 15, you should use the following syntax:

fruits['grapes'] = 15

This correctly adds the key 'grapes' with the value 15 to the dictionary.

Answer: (B) fruits['grapes'] = 15

Correct Answer: B) fruits['grapes'] = 15


Question: 2 Report Error

नीचे दिए गए कोड का आउटपुट क्या है?

What is the output of below code?

print(3-2*2*3+99/11) 
A)
B)
C)
D)
Explanation

The expression is:

print(3 - 2 * 2 * 3 + 99 / 11)

Step 1: Follow the order of operations (PEMDAS/BODMAS).

  • Parentheses
  • Exponents
  • Multiplication and Division (from left to right)
  • Addition and Subtraction (from left to right)

Step 2: Break down the expression.

  1. First, handle the multiplication and division.

    • 2 * 2 = 4
    • 4 * 3 = 12
    • 99 / 11 = 9

    Now the expression becomes:

    3 - 12 + 9
  2. Now, perform the addition and subtraction from left to right:

    • 3 - 12 = -9
    • -9 + 9 = 0

Final result: 0

Correct Answer: A) 0.0


Question: 3 Report Error

क्या पायथन कोड संकलित या व्याख्यायित है?

Is python code compiled or interpreted?

A)
B)
C)
D)
Explanation

Python is an interpreted language, but it has some features of compiled languages as well. Here's how it works:

1. Python as an Interpreted Language:

  • Interpreter: Python code is executed by an interpreter, which means the source code is executed line-by-line, at runtime, rather than being converted into machine code ahead of time.
  • This makes Python easier to debug and allows for quick testing and prototyping since you can run the code directly without a separate compilation step.

2. How Python Executes Code:

  • Step 1: When you run a Python program, the Python interpreter first converts the code into an intermediate form called bytecode.
  • Step 2: This bytecode is then executed by the Python Virtual Machine (PVM).

The bytecode is a lower-level representation of your code, which can be executed efficiently by the interpreter. This is why Python is sometimes said to be compiled to bytecode, but it is still ultimately interpreted when run.

3. What Happens Under the Hood:

  • When you run a Python script, the interpreter performs the following:
    • Parsing: The Python source code (.py file) is parsed and translated into an intermediate bytecode (.pyc or .pyo files).
    • Execution: This bytecode is then executed by the Python Virtual Machine (PVM), which is the interpreter itself.

Correct Answer: B) Both compiled and interpreted.


Question: 4 Report Error

एल्गोरिथम का वह भाग जिसे निश्चित संख्या में बार-बार दोहराया जाता है, को इस प्रकार वर्गीकृत किया गया है

Part of algorithm which is repeated for fixed number of times is classified as

A)
B)
C)
D)
Explanation

Part of an algorithm which is repeated for the fixed number of times is classified as Iteration. In this, a set of instructions are repeated again and again. In computer programming, a loop is a kind of iteration in which instructions sequence is executed repeatedly. 

Correct Answer: A) Iteration


Question: 5 Report Error

फ़ंक्शन pow(x,y,z) का मूल्यांकन इस प्रकार किया जाता है:

The function pow(x,y,z) is evaluated as:

A)
B)
C)
D)
Explanation

The pow(x, y, z) function in Python is evaluated as:

(xy) % z

This means that it computes xyx^y (x raised to the power y), and then takes the result modulo z.

So the correct answer is:
(C) (xy) % z

Correct Answer: C) (x**y) % z


Question: 6 Report Error

________एक डेटा फ़ाइल है।

________is a data file.

A)
B)
C)
D)
Explanation

A data file can refer to both binary files and text files, as both types of files are used to store data. The difference between the two lies in how the data is encoded and interpreted:

  • Text File: A file that contains human-readable data in a plain text format (e.g., .txt, .csv). Data is stored as characters that can be easily interpreted and read by both humans and machines.

  • Binary File: A file that contains data in a format that is not human-readable. It can store any kind of data (e.g., images, videos, executable files) in binary format (e.g., .jpg, .exe, .mp3). The data is represented in 0s and 1s and typically requires specific software or tools to interpret.

Correct Answer: C) Both Binary File and Text file


Question: 9 Report Error

कौन सा कथन फ़ाइल से एक पंक्ति लौटाएगा (फ़ाइल ऑब्जेक्ट 'f‟ है)?

Which statement will return one line from a file (file object is 'f‟) ?

A)
B)
C)
D)
Explanation
  • When you call f.readline(), it reads the next line from the file object f. It reads until it reaches the end of the line, including the newline character (\n), but it does not return the newline character at the end of the string.
  • If the end of the file is reached, f.readline() returns an empty string ('').

Correct Answer: B) f.readline()


Question: 10 Report Error

निम्नलिखित का आउटपुट क्या होगा?

What will be the output of the following ?

import sys 
sys.stdout.write('Welcome\n') 
sys.stdout.write('All\n')
A)
B)
C)
D)
Explanation
  • The first line, sys.stdout.write('Welcome\n'), will print "Welcome" followed by a newline character (\n), meaning it will move the cursor to the next line.

  • The second line, sys.stdout.write('All\n'), will print "All" followed by a newline as well.

Correct Answer: A) Welcome All


Question: 11 Report Error

बाइनरी फ़ाइल डेटा को पढ़ने के लिए ___________ फ़ंक्शन का उपयोग किया जाता है।

To read binary files data ___________ function is used.

A)
B)
C)
D)
Explanation

In Python, the method load() is typically associated with deserializing or loading data from a file or another storage medium into a Python object. It is most commonly used with libraries like json, pickle, or yaml for reading data from files.

Correct Answer: D) load()


Question: 14 Report Error

निम्नलिखित स्यूडोकोड का आउटपुट क्या होगा, जहां ^ XOR ऑपरेशन का प्रतिनिधित्व करता है?

What will be the output of the following pseudocode, where ^ represent XOR operation?

Integer a, b, c
Set b=5,a=1
c=a^b
print c
A)
B)
C)
D)
Explanation

Sure! Here's a quick explanation:

  • a = 1 in binary: 0001
  • b = 5 in binary: 0101

XOR operation (^) compares bits:

  • 0 ^ 0 = 0
  • 0 ^ 1 = 1
  • 1 ^ 0 = 1
  • 1 ^ 1 = 0

When we XOR 0001 and 0101, the result is 0100, which is 4 in decimal.

Thus, the output is 4.

Answer: (A) 4.

Correct Answer: A) 4


Question: 15 Report Error

निम्नलिखित पायथन कोड का आउटपुट क्या होगा?

What will be the output of the following Python code?

>>>t1 = (1, 2, 4, 3)
>>>t2 = (1, 2, 3, 4)
>>>t1 < t2
A)
B)
C)
D)
Explanation

The output will be (B) False.

Explanation:

  • Python compares tuples element by element.
  • In this case, t1 = (1, 2, 4, 3) and t2 = (1, 2, 3, 4).
  • Python first compares 1 with 1 (equal), then 2 with 2 (equal).
  • Next, it compares 4 (from t1) with 3 (from t2). Since 4 > 3, Python concludes t1 > t2.

So, the comparison t1 < t2 is False.

Correct Answer: B) False


Question: 17 Report Error

यदि list1=[10,20,30], तो ऑपरेशन list1*2 _____ लौटाता है।

if list1=[10,20,30], then operation list1*2 returns _____.

A)
B)
C)
D)
Explanation

The correct answer is (A) [10,20,30,10,20,30].

Explanation:

  • When you multiply a list by a number in Python, the list repeats that many times.
  • In this case, list1 = [10, 20, 30] and you perform list1 * 2.
  • This operation results in the list being repeated twice, so the output will be [10, 20, 30, 10, 20, 30].

Correct Answer: A) [10,20,30,10,20,30]


Question: 19 Report Error

एक स्ट्रिंग x=”hello” दी गई है तो x.count('l') का आउटपुट क्या है?

Given a string x=”hello” What is the output of x.count(‘l’) ?

A)
B)
D)
Explanation

The correct answer is (A) 2.

Explanation:

  • The count() method in Python returns the number of times a specified value appears in the string.
  • In the string x = "hello", the character 'l' appears twice.
  • Therefore, x.count('l') will return 2.

Correct Answer: A) 2


Question: 22 Report Error

निम्नलिखित में से कौन dictionary में कुंजी "tiger" के लिए कुंजी-मूल्य जोड़ी को हटा देगा?

Which of the following will delete the key-value pair for the key "tiger" in the dictionary?

dic = {"lion":"wild", "tiger":"wild", "cat":"domestic", "dog":"domestic"} 
A)
B)
C)
D)
Explanation

The correct answer is (A) del dic["tiger"].

Explanation:

  • del dic["tiger"] is the correct way to delete the key-value pair for "tiger" from the dictionary.
  • It removes the key "tiger" and its associated value from the dictionary dic.

Other options are incorrect:

  • (B) dic["tiger"].delete(): There's no delete() method for dictionary values.
  • (C) delete(dic["tiger"]): There's no delete() function in Python for dictionaries.
  • (D) del(dic["tiger"]): This works but is less common. The more common form is del dic["tiger"].

So, (A) is the correct choice!

Correct Answer: A) del dic["tiger"]


Question: 25 Report Error

फोरट्रान का अर्थ है:

FORTRAN stands for:

A)
B)
C)
D)

Question: 29 Report Error

2+2**3/2 ​​के मूल्यांकन का परिणाम क्या है?

What is the result of evaluating 2 + 2 ** 3 / 2?

A)
B)
C)
Explanation

The correct answer is (B) 6.

Here’s the simple explanation:

The expression is:
2 + 2 ** 3 / 2

  1. Exponentiation first:
    2 ** 3 is 8.

  2. Then division:
    8 / 2 is 4.0.

  3. Finally addition:
    2 + 4.0 is 6.0.

So the result is 6.

Correct Answer: B) 6


Question: 30 Report Error

डेटा किस प्रकार का है:

What type of data is :

arr = [(1, 1), (2, 2), (3, 3)]
A)
B)
C)
D)

Question: 31 Report Error

निम्नलिखित का आउटपुट क्या होगा?

What will be the output of the following ?

print(sum(1,2,3)) 
A)
B)
C)
D)
Explanation

The output is (A) Error because the sum() function expects an iterable (like a list or tuple) as its first argument. You passed separate numbers instead of an iterable.

Correct usage:

print(sum([1, 2, 3]))  # This would return 6

Correct Answer: A) Error


Question: 36 Report Error

नेमस्पेस का क्रम क्या है जिसमें पायथन एक पहचानकर्ता की तलाश करता है?

What is the order of namespaces in which Python looks for an identifier?

A)
B)
C)
D)

Question: 39 Report Error

निम्नलिखित कोड का परिणाम क्या है ?

What is the output of the following code ?

a = {1: "A", 2: "B", 3: "C"} 
b = {4: "D", 5: "E"} 
a.update(b) 
print(a) 
A)
B)
C)
D)
Explanation

The output will be:

(B) {1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'}

Explanation:

  • The update() method adds key-value pairs from dictionary b into dictionary a.
  • After calling a.update(b), the dictionary a will now include the key-value pairs from b. So, the updated dictionary a will be {1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'}.

Correct Answer: B) {1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'}


Question: 42 Report Error

निम्नलिखित में से कौन सा विकल्प सही है?

Which of the following options is correct?

A)
B)
C)
D)

Question: 46 Report Error

निम्नलिखित पायथन अभिव्यक्ति का मूल्य क्या होगा?

What will be the value of the following Python expression?

4+2**5//10
A)
B)
C)
Explanation

The expression 4 + 2**5 // 10 follows the order of operations:

  1. 2 raised to the power of 5 gives 32 (2**5 = 32).
  2. Integer division of 32 by 10 results in 3 (32 // 10 = 3).
  3. Finally, add 4 to 3: 4 + 3 = 7.

Thus, the output is 7.

Correct Answer: B) 7


Question: 53 Report Error

पिप का मतलब पाइथॉन क्या है?

What does pip stand for python?

A)
B)
C)
D)

Question: 54 Report Error

निम्नलिखित का आउटपुट क्या है?

What is the output of the following ?

i = 2 
while True:
    if i%3 == 0:
       break 
    print(i,end=" " )
    i += 2 

A)
B)
C)
D)
Explanation

The given code prints values of i starting from 2 and increases i by 2 on each iteration. It prints i until i is divisible by 3. Here's the breakdown:

  1. i = 2: 2 % 3 != 0, prints 2, then i becomes 4.
  2. i = 4: 4 % 3 != 0, prints 4, then i becomes 6.
  3. i = 6: 6 % 3 == 0, the loop breaks.

Output: 2 4

So, the answer is (B) 2 4.

Correct Answer: B) 2 4


Question: 56 Report Error

अभिव्यक्ति का मूल्यांकन करें (9//4*3-6*3//4)

Evaluate the expression (9//4*3-6*3//4)

A)
B)
C)
D)
Explanation

Let's break down the expression step by step:

Expression: (9//43 - 63//4)

  1. 9 // 4 = 2 (Floor division of 9 by 4 gives 2)
  2. 2 * 3 = 6
  3. 6 * 3 = 18
  4. 18 // 4 = 4 (Floor division of 18 by 4 gives 4)
  5. Now, subtract: 6 - 4 = 2

So, the result of the expression is 2.

Answer: (D) 2

Correct Answer: D) 2


Question: 57 Report Error

फ़्लोचार्ट का प्राथमिक उद्देश्य क्या है?

What is the primary purpose of a flowchart?

A)
B)
C)
D)

Question: 60 Report Error

निम्नलिखित कथन में 'f' क्या है?

What is ‘f’ in the following statement ?


f=open(“Data.txt”, “r”) 

A)
B)
C)
D)
Explanation

In the statement f = open("Data.txt", "r"):

  • f is the file handle. It acts as a reference to the file object, allowing you to perform actions like reading from or writing to the file.

So, the correct answer is:

(B) File Handle (file object/file pointer).

Correct Answer: B) File Handle (file object/file pointer)


Question: 64 Report Error

निम्नलिखित में से कौन सा मॉड्यूलर प्रोग्रामिंग का लाभ नहीं है?

Which of the following is not a benefit of modular programming?

A)
B)
C)
D)

Question: 65 Report Error

निम्नलिखित का आउटपुट क्या होगा?

What will be the output of the following?

import numpy as np
a = np.array([1,5,4,7,8])
a = a + 1
print(a[1])
A)
B)
C)
D)
Explanation

Let's break it down:

  1. You have an array a = np.array([1, 5, 4, 7, 8]).
  2. Then, you add 1 to each element of the array: a = a + 1. This results in a = [2, 6, 5, 8, 9].
  3. The code then prints a[1], which is the element at index 1 in the array. After the addition, a[1] is 6.

So, the correct answer is:

(C) 6.

Correct Answer: C) 6


Question: 66 Report Error

इस बाइनरी नंबर का मूल्य क्या है? 101001

what is value of this binary no. 101001

A)
B)
C)
D)
Explanation

To convert the binary number 101001 to its decimal equivalent:

  • The binary number 101001 can be broken down as:

    1×25+0×24+1×23+0×22+0×21+1×201 \times 2^5 + 0 \times 2^4 + 1 \times 2^3 + 0 \times 2^2 + 0 \times 2^1 + 1 \times 2^0
  • This simplifies to:

    1×32+0×16+1×8+0×4+0×2+1×1=32+8+1=411 \times 32 + 0 \times 16 + 1 \times 8 + 0 \times 4 + 0 \times 2 + 1 \times 1 = 32 + 8 + 1 = 41

So, the decimal value of the binary number 101001 is 41.

The correct answer is:

(B) 41.

Correct Answer: B) 41


Question: 68 Report Error

सीएसवी का पूर्ण रूप है

The full form of CSV is

A)
B)
C)
D)

Question: 70 Report Error

आउटपुट: SMTWTFS [-3:-1]

Output: SMTWTFS [-3:-1]

A)
B)
C)
D)
Explanation

The given string is "SMTWTFS". The slice operation [-3:-1] means:

  • The index -3 refers to the 3rd element from the end, which is "T".
  • The index -1 refers to the last element, which is "S", but since the slice goes up to (but does not include) the last index, it will stop at "F" (the second-to-last element).

So, the result of "SMTWTFS"[-3:-1] is "TF".

Thus, the correct answer is:

(D) TF.

Correct Answer: D) TF


Question: 71 Report Error

निम्नलिखित का आउटपुट क्या है?

What is the output of the following ?

x=123 
for i in x: 
   print(i) 

A)
B)
C)
D)
Explanation

The code you've provided is:

x = 123 
for i in x: 
   print(i)

The error occurs because x is an integer, and integers are not iterable in Python. Python allows iteration over sequences like lists, strings, and tuples, but not directly over integers.

Thus, trying to loop over an integer like this will raise a TypeError.

Correct answer: (C) Error.

Correct Answer: C) Error


Question: 72 Report Error

छद्म कोड को इस नाम से भी जाना जाता है:

Pseudo code is also known as:

A)
B)
C)
D)

Question: 73 Report Error

>>> फ्लोट('12.6') का आउटपुट क्या है

What is the output of >>> float('12.6')

A)
B)
C)
D)
Explanation

The float() function is used to convert a string or number into a floating-point number.

For the expression float('12.6'), the string '12.6' will be converted into the float 12.6.

Correct answer: (A) 12.6.

Correct Answer: A) 12.6


Question: 74 Report Error
Question: 75 Report Error

नीचे दिए गए कोड स्निपेट में var का डेटाटाइप क्या होगा?

What will be the datatype of the var in the below code snippet?

var = 10
print(type(var))
var = "Hello"
print(type(var))

A)
B)
C)
D)
Explanation

In the given code snippet:

  1. var = 10: Initially, var is assigned the value 10, which is an integer, so its type is int.
  2. var = "Hello": Then, var is assigned the value "Hello", which is a string, so its type becomes str.

Thus, the data type of var changes from int to str as the value is reassigned.

Correct answer: (D) int and str.

Correct Answer: D) int and str


Question: 77 Report Error

निम्नलिखित पायथन कोड का आउटपुट क्या होगा?

What will be the output of the following Python code ?

from math import factorial 
print(math.factorial(5)) 

A)
B)
C)
D)
Explanation

In the code, you imported the factorial function directly, but then tried to use it with math.factorial(5). Since you didn't import math fully, you can't use math.factorial().

The correct code would be:

from math import factorial
print(factorial(5))

So, the error happens because of the incorrect use of math.factorial.

Answer: (D) Error, the statement should be: print(factorial(5)).

Correct Answer: D) Error, the statement should be : print(factorial(5))


Question: 80 Report Error

निम्नलिखित पायथन कोड का आउटपुट क्या होगा?

What will be the output of the following Python code?

def maximum(x, y):
    if x > y:
        return x
    elif x == y:
        return 'The numbers are equal'
    else:
        return y
 print(maximum(2, 3))
A)
B)
C)
D)
Explanation

The function maximum(2, 3) compares the values 2 and 3:

  • Since 2 is less than 3, it will return y (which is 3).

Thus, the output is 3.

Answer: (B) 3.

Correct Answer: B) 3


Question: 82 Report Error

निम्नलिखित पायथन कोड का आउटपुट क्या होगा?

What will be the output of the following Python code?

if (9 < 0) and (0 < -9):
    print("hello")
elif (9 > 0) or False:
    print("good")
else:
    print("bad")

A)
B)
C)
D)
Explanation

Sure! Let's break it down:

  1. First condition: (9 < 0) and (0 < -9)

    • 9 < 0 is False.
    • 0 < -9 is also False.
    • So, the entire condition is False.
  2. Second condition: (9 > 0) or False

    • 9 > 0 is True.
    • False is False.
    • But since it's an or condition, if either part is true, the result is True.
  3. Since the second condition is True, the output will be "good", and it skips the else part.

Answer: (C) good.

Correct Answer: C) good


Question: 83 Report Error

tell() विधि का क्या महत्व है?

What is the significance of the tell() method?

A)
B)
C)
D)

Question: 86 Report Error

गलत कथन को इंगित करें:

Point out the incorrect statement:

A)
B)
C)
D)

Question: 88 Report Error

निम्नलिखित पायथन फ़ंक्शन का आउटपुट क्या होगा?

What will be the output of the following Python function?

complex(1+2j)
A)
B)
C)
D)
Explanation

The function complex() in Python is used to create a complex number.

  • The argument passed to complex() is expected to be in the form of two parts: a real part and an imaginary part.
  • In the given code, complex(1+2j) is actually passing a complex number 1+2j as an argument to the complex() function.

When you call complex(1+2j), it will return the same complex number, i.e., 1+2j, as the argument is already a valid complex number.

Answer: (D) 1+2j.

Correct Answer: D) 1+2j


Question: 90 Report Error

निम्नलिखित पायथन फ़ंक्शन का आउटपुट क्या होगा?

What will be the output of the following Python code?

sys.stdout.write(' Hello\n')
sys.stdout.write('Python\n')

A)
B)
C)
D)
Explanation

The code uses sys.stdout.write() to print text:

  1. sys.stdout.write(' Hello\n') prints " Hello" and moves to the next line because of the \n.
  2. sys.stdout.write('Python\n') then prints "Python" and moves to the next line.

Thus, the output is:

 Hello
Python

Correct answer: (D) Hello Python

Correct Answer: D) Hello Python


Question: 91 Report Error

आप किसी फ़ाइल का नाम कैसे बदलते हैं?

How do you rename a file?

A)
B)
C)
D)

Question: 94
Verified by Expert

आउटपुट क्या होगा:

What will be the output:

print(7//2)
print(7/2)
A)
B)
C)
D)
Explanation

Let's break down the two print statements:

  1. 7//2: This uses floor division (//), which divides and then rounds down to the nearest integer.
    So, 7//2 results in 3.

  2. 7/2: This uses regular division (/), which gives a float result.
    So, 7/2 results in 3.5.

Correct answer: (A) 3 and 3.5

Correct Answer: A) 3 and 3.5


Question: 97 Report Error

आउटपुट निर्धारित करें:

Determine the output:

for i in range(20, 30, 10) :
        j=i/2
        print(j)

A)
B)
C)
D)
Explanation

The range(20, 30, 10) produces values 20 (and stops before 30). In the loop:

  • When i = 20, j = 20 / 2 = 10.0.
  • The output is 10.0.

So, the answer is (C) 10.0.

Correct Answer: C) 10.0


Related Papers



















































Latest Updates