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

O Level Python Paper January 2022

Question: 1 Report Error

इनमें से कौन सा कोर डेटा प्रकार नहीं है?

Which of these is not a core data type ?

A)
B)
C)
D)
Explanation

Lists, Dictionary, और Tuples पायथन के Built-in core data types हैं। जबकि Class का उपयोग उपयोगकर्ता द्वारा परिभाषित (User-defined) डेटा प्रकार या ऑब्जेक्ट बनाने के लिए किया जाता है।

Correct Answer: D) Class


Question: 2 Report Error

नीचे दिया गया ऑब्जेक्ट किस डेटा प्रकार का है?

What data type is the object below?

L=[1, 23, 'hello', 1]
A)
B)
C)
D)
Explanation

The given object is:

L = [1, 23, 'hello', 1]

Explanation:

  • The object L is enclosed in square brackets ([]), which denotes a list in Python.
  • A list in Python is an ordered collection that can contain items of different data types, including integers, strings, and others.

Answer:

(A) Lists

    • पायथन में स्क्वायर ब्रैकेट [] का उपयोग लिस्ट को दर्शाने के लिए किया जाता है। लिस्ट में अलग-अलग प्रकार के डेटा (जैसे यहाँ integer और string) रखे जा सकते हैं।

Correct Answer: A) Lists


Question: 3 Report Error

निम्नलिखित में से कौन सा फ़ंक्शन पायथन में स्ट्रिंग को फ्लोट में परिवर्तित करता है?

Which of the following functions converts a string to a float in python ?

A)
B)
C)
D)
Explanation
    • float() फ़ंक्शन किसी स्ट्रिंग या संख्या को फ्लोटिंग-पॉइंट (दशमलव) संख्या में बदलता है।

Correct Answer: C) float(x)


Question: 4 Report Error

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

What is the output of the following program ?

def  myfunc(a):
    a=a+2
    a=a*2 
    return a 
print myfunc(2) 
A)
B)
C)
D)
Explanation

Let's analyze the given Python code:

def myfunc(a):
    a = a + 2
    a = a * 2
    return a

print(myfunc(2))

Step-by-Step Explanation:

  1. Function Definition:

    • The function myfunc(a) takes one argument a.
    • Inside the function:
      • First, a = a + 2 increases a by 2.
      • Then, a = a * 2 doubles the new value of a.
    • Finally, the function returns the value of a.
  2. Function Call:

    • The function is called with a = 2, so:
      • a = 2 + 2a = 4
      • a = 4 * 2a = 8
    • The function then returns 8.
  3. Output:

    • The print(myfunc(2)) will print the returned value, which is 8.

Answer:

(A) 8

  • प्रक्रिया: $a = 2 \rightarrow a = 2 + 2 = 4 \rightarrow a = 4 * 2 = 8$

Correct Answer: A) 8


Question: 5 Report Error

अभिव्यक्ति 3*1**3 का आउटपुट क्या है?

What is the output of the expression : 3*1**3 ?

A)
B)
C)
D)
Explanation

Let's break down the expression:

3 * 1 ** 3

Step-by-Step Explanation:

  1. Operator Precedence:

    • The ** operator (exponentiation) has higher precedence than multiplication (*).
    • So, the expression is evaluated as: 3 * (1 ** 3).
  2. Evaluate 1 ** 3:

  3.  

    • 1 ** 3 means 1 raised to the power of 3, which is 1.
  4. Evaluate the final multiplication:

    • Now the expression becomes 3 * 1, which equals 3.

Answer:

(C) 3

  • पायथन में घातांक (Exponentiation **) की प्राथमिकता गुणा (*) से अधिक होती है।

  • गणना: $3 * (1 ** 3) \rightarrow 3 * 1 = 3$

Correct Answer: C) 3


Question: 6 Report Error

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

What is the output of the following program ?

i=0
while i<3:
     print(i)
     i+=1
else: 
     print 0
A)
B)
C)
D)
Explanation

The program prints the values of i from 0 to 2 inside the while loop, and then prints 0 from the else block after the loop finishes.

Output:

(B) 0 1 2 0

while लूप 0, 1, 2 प्रिंट करेगा। जब कंडीशन i < 3 गलत हो जाएगी, तब else ब्लॉक चलेगा और 0 प्रिंट करेगा

Correct Answer: B) 0 1 2 0


Question: 7 Report Error

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

What is the output of the following program ?

print "Hello World"[::-1] 
A)
B)
C)
D)
Explanation

The given Python code is:

print "Hello World"[::-1]

Explanation:

  • "Hello World" is a string.
  • [::-1] is a slicing operation that reverses the string.
    • The slice notation [::-1] means "take the string and step backwards by 1, effectively reversing it."

So, reversing "Hello World" gives: "dlroW olleH"

Output:

(A) dlroWolleH

Note: In Python 3, print requires parentheses, so the correct code would be print("Hello World"[::-1]). However, based on the given code, it seems to be Python 2, where print doesn't need parentheses.

[::-1] स्लाइसिंग ऑपरेटर है जो स्ट्रिंग को पूरी तरह से उलट (Reverse) देता है

Correct Answer: A) dlroWolleH


Question: 8 Report Error

एक ऐसा फ़ंक्शन दिया गया है जो कोई मान नहीं लौटाता है, शेल पर निष्पादित होने पर क्या मान दिखाया जाता है?

Given a function that does not return any value, what value is shown when executed at the shell ?

A)
B)
C)
D)
Explanation

पायथन में यदि कोई फ़ंक्शन return स्टेटमेंट का उपयोग नहीं करता है, तो वह डिफ़ॉल्ट रूप से None ऑब्जेक्ट लौटाता है

Correct Answer: D) None


Question: 9 Report Error

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

What is the output of the following program ?

print 0.1+0.2==0.3
A)
B)
C)
D)
Explanation

Let's analyze the given Python program:

print 0.1 + 0.2 == 0.3

Explanation:

  • In Python, floating-point numbers like 0.1, 0.2, and 0.3 cannot always be represented precisely due to the way floating-point arithmetic works in computers.
  • When you compute 0.1 + 0.2, it may result in a value slightly different from 0.3 because of precision errors in floating-point representation.

Specifically:

  • 0.1 + 0.2 results in 0.30000000000000004, which is not exactly equal to 0.3.

Thus, the expression 0.1 + 0.2 == 0.3 evaluates to False.

Output:

(B) False

यह फ्लोटिंग-पॉइंट अंकगणित की सीमा के कारण होता है। बाइनरी में $0.1$ और $0.2$ को सटीक रूप से नहीं दर्शाया जा सकता, जिससे $0.1 + 0.2$ का मान लगभग $0.30000000000000004$ आता है।

Correct Answer: B) False


Question: 10 Report Error

एक स्ट्रिंग s="Welcome" दी गई है, निम्नलिखित में से कौन सा कोड गलत है?

Given a string s="Welcome", which of the following code is incorrect ?

A)
B)
C)
D)
Explanation

Here’s a quick breakdown:

  • (A) s[0] is correct; it prints the first character "W".
  • (B) s.lower() is correct; it converts the string to "welcome".
  • (C) s[1] = 'r' is incorrect because strings are immutable in Python (you can't change individual characters).
  • (D) s.strip() is correct; it removes any leading or trailing spaces (if any).

Answer:

(C) s[1] = 'r' is incorrect.

    • पायथन में स्ट्रिंग्स Immutable (अपरिवर्तनीय) होती हैं। आप किसी स्ट्रिंग के एक विशिष्ट कैरेक्टर को असाइनमेंट के ज़रिए नहीं बदल सकते।

Correct Answer: C) s[1]='r'


Related Papers



















































Latest Updates