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

O Level Python Paper July 2022 | Set 2

Question: 1 Report Error

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

What will be output for the following code ?

import numpy as np
a = np.array([[1,2,3],[0,1,4],[11,22,33]])
print (a.size)
A)
B)
C)
D)
Explanation

In the given code:

import numpy as np
a = np.array([[1, 2, 3], [0, 1, 4], [11, 22, 33]])
print(a.size)

Explanation:

  • a is a 2D NumPy array with the shape (3, 3) — it has 3 rows and 3 columns.
  • The .size attribute of a NumPy array gives the total number of elements in the array.

Since the array a has 3 rows and 3 columns, the total number of elements is:

3 * 3 = 9

Answer: (C) 9

Correct Answer: C) 9


Question: 2 Report Error
Question: 4 Report Error

Numpy सारणी में प्रयुक्त शून्य () फ़ंक्शन का उद्देश्य क्या है?

What is the purpose of zeros() function used in Numpy array ?

A)
B)
C)
D)

Question: 5 Report Error

NumPY का मतलब क्या है?

NumPY stands for?

A)
B)
C)
D)

Question: 6 Report Error

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

What does the following code print ?

if 2 + 5 == 8:
    print("TRUE")
else:
    print("FALSE")
print("TRUE") 
A)
B)
C)
D)

Question: 7 Report Error

lstrip() विधि का उपयोग इसके लिए किया जाता है:

lstrip() method is used for :

A)
B)
C)
D)

Question: 8 Report Error

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

What will be the output of the following?

print((range(4)))
A)
B)
C)
D)
Explanation

In Python 3, range(4) produces a range object, which is a sequence of numbers from 0 to 3, but not a list. So, when you print range(4), it shows the object representation, like range(0, 4).

Answer: (C) range(0,4)

Correct Answer: C) range(0,4)


Question: 14 Report Error

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

What will be the output of the following code ?

f=open("demo.txt","w+")
f.write("Welcome to Python")
f.seek(5)
a=f.read(5)
print(a)
A)
B)
C)
D)
Explanation

The code works as follows:

  1. The file "demo.txt" is opened in write and read mode (w+).
  2. The string "Welcome to Python" is written into the file.
  3. After writing, f.seek(5) moves the file pointer to position 5 (the sixth character, which is 'o' in the word "Welcome").
  4. f.read(5) reads the next 5 characters from the current position.

So, the output will be the next 5 characters starting from position 5, which is "me to".

Therefore, the correct answer is:

(B) me to

Correct Answer: B) me to


Question: 15 Report Error

तलाश() का सिंटैक्स है: file_object.seek(offset [, reference_point]) Reference_point क्या दर्शाता है?

The syntax of seek() is: file_object.seek(offset [, reference_point]) What does the reference_point indicate?

A)
B)
C)
D)

Question: 21 Report Error

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

What will be the output of the following ?

import numpy as np
a = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]])
print(a[2,2])
A)
B)
C)
D)
Explanation

The code creates a 3x4 matrix a. When you access a[2,2], it refers to the element at row 2, column 2 (remember, Python uses 0-based indexing).

Here’s the matrix:

Row 0: [1, 2, 3, 4]
Row 1: [5, 6, 7, 8]
Row 2: [9, 10, 11, 12]

So, a[2,2] gives the value 11.

Answer: (B) 11

Correct Answer: B) 11


Question: 22 Report Error

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

What is the output of the following code ?

def add(a, b):
     return a+5, b+5
result = add(3, 2)
print(result)
A)
B)
C)
D)
Explanation

Let's break down the code:

The function add(a, b) takes two arguments, a and b, and returns two values: a+5 and b+5.

In this case, the function is called with a = 3 and b = 2. So:

  • a + 5 = 3 + 5 = 8
  • b + 5 = 2 + 5 = 7

The function returns the tuple (8, 7).

When you print the result, it will display the tuple (8, 7).

Answer: (C) (8, 7).

Correct Answer: C) (8,7)


Question: 26 Report Error

मान लीजिए q= [3, 4, 5, 20, 5, 25, 1, 3], तो q.pop(1) के बाद q सूची के आइटम क्या होंगे?

Assume q= [3, 4, 5, 20, 5, 25, 1, 3], then what will be the items of q list after q.pop(1) ?

A)
B)
C)
D)
Explanation

The pop() method removes an item from the list at the specified index and returns the removed item.

In this case, q.pop(1) removes the item at index 1 from the list q.

Here's the list before and after using pop(1):

  • Initial list: q = [3, 4, 5, 20, 5, 25, 1, 3]
  • After q.pop(1), the item at index 1 (which is 4) is removed, so the list becomes: q = [3, 5, 20, 5, 25, 1, 3]

Thus, the list after q.pop(1) is [3, 5, 20, 5, 25, 1, 3].

Answer: (C) [3, 5, 20, 5, 25, 1, 3].

Correct Answer: C) [3, 5, 20, 5, 25, 1, 3]


Question: 28 Report Error

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

What is the output of the following code?

import numpy as np
a = np.array([1,2,3,5,8])
b = np.array([0,1,5,4,2])
c = a + b
c = c*a
print (c[2])
A)
B)
C)
D)
Explanation

Let's simplify the explanation:

  1. Arrays:

    a = [1, 2, 3, 5, 8]
    b = [0, 1, 5, 4, 2]
    
  2. Adding arrays a and b:

    c = a + b  # [1+0, 2+1, 3+5, 5+4, 8+2] = [1, 3, 8, 9, 10]
    
  3. Multiplying c by a:

    c = c * a  # [1*1, 3*2, 8*3, 9*5, 10*8] = [1, 6, 24, 45, 80]
    
  4. Print the third element (c[2]):

    print(c[2])  # This is 24
    

Output: 24

Answer: (B) 24

Correct Answer: B) 24


Question: 29 Report Error

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

What is the output of the following code ?

import numpy as np
a = np.array([[1,2,3]])
print(a.shape)
A)
B)
C)
D)
Explanation

Let's break it down:

  1. Array a:

    a = np.array([[1, 2, 3]])
    

    This creates a 2D array with one row and three columns:

    [[1, 2, 3]]
    
  2. Shape of a:

    print(a.shape)
    

    The shape of a is (1, 3) because it has 1 row and 3 columns.

Output: (1, 3)

Answer: (C) (1, 3)

Correct Answer: C) (1, 3)


Question: 31 Report Error

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

What is the output of the following code ?

ms = ('A', 'D', 'H', 'U', 'N', 'I', 'C')
print(ms[1:4])
A)
B)
C)
D)
Explanation

Sure! Here's a quick breakdown:

  1. Tuple ms:

    ms = ('A', 'D', 'H', 'U', 'N', 'I', 'C')
    

    It contains 7 elements: 'A', 'D', 'H', 'U', 'N', 'I', 'C'.

  2. Slicing ms[1:4]:

    • This gets elements from index 1 to 3 (the 4th element is excluded).
    • Index 1 = 'D'
    • Index 2 = 'H'
    • Index 3 = 'U'

So, ms[1:4] gives ('D', 'H', 'U').

Answer: (A) ('D', 'H', 'U').

Correct Answer: A) ('D', 'H', 'U')


Question: 32 Report Error

>>>‟2‟+‟3‟ का आउटपुट क्या है

What is the output of >>>‟2‟+‟3‟

A)
B)
C)
D)
Explanation

The code:

'2' + '3'

concatenates the two strings '2' and '3'. Since both are strings, it doesn't perform arithmetic addition but rather combines them into one string.

Output: '23'

Answer: (C) '23'

Correct Answer: C) ‟23‟


Question: 33 Report Error

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

What will be the output of the following Python program ?

def addItem(listParam):
    listParam += [1]
mylist = [1, 2, 3, 4]
addItem(mylist)
print(len(mylist)) 
A)
B)
C)
D)
Explanation

The code adds 1 to the list mylist by using += inside the addItem function. After calling addItem(mylist), the list becomes [1, 2, 3, 4, 1]. The length of the updated list is 5.

Answer: (A) 5

Correct Answer: A) 5


Question: 36 Report Error

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

What will be the output of the following Python code?

from math import *
floor(3.7)
A)
B)
C)
D)
Explanation

The floor() function in Python returns the largest integer less than or equal to the given number.

In this case, floor(3.7) will return 3 because 3 is the greatest integer less than or equal to 3.7.

Answer: (A) 3

Correct Answer: A) 3


Question: 38 Report Error

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

What is the output of the following ?

print(int())
A)
B)
D)
Explanation

In Python, calling int() without any arguments returns the default value of 0.

So, print(int()) will output 0.

Answer: (C) 0

Correct Answer: C) 0


Question: 39 Report Error

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

What is the output of the following code ?

a = set('dcma')
b = set('mlpc')
print(a^b)
A)
B)
C)
D)

Question: 40 Report Error

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

What is the output of the following statement ?

print ((2, 4) + (1, 5))
A)
B)
C)
D)
Explanation

The statement is performing tuple concatenation:

  • (2, 4) is a tuple.
  • (1, 5) is another tuple.
  • The + operator is used to concatenate both tuples.

So, the result will be (2, 4, 1, 5).

Thus, the output is:

(C) (2, 4, 1, 5).

Correct Answer: C) (2, 4, 1, 5)


Question: 41 Report Error

Python में किसी फ़ंक्शन को कैसे घोषित किया जाता है?

How is a function declared in Python ?

A)
B)
C)
D)

Question: 42 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 sys.stdout.write() method in Python writes a string to the standard output (usually the console) without automatically adding a newline. The \n character in the first statement is used to print a newline after "Welcome."

So, the output will be:

Welcome
All

Thus, the correct answer is:

(A) Welcome All

Correct Answer: A) Welcome All


Question: 44 Report Error

किसी फ़ाइल का नाम बदलने के लिए प्रयुक्त सिंटैक्स:

The syntax used to rename a file :

A)
B)
C)
D)

Question: 46 Report Error

निम्नलिखित कोड से कितने नंबर प्रिंट होंगे?

How many numbers will be printed by the following code ?

def fun(a,b):
    for x in range(a,b+1):
        if x%3==0:
            print(x, end=" ")
fun(100,120) 
A)
B)
C)
D)
Explanation

The code checks for numbers divisible by 3 between 100 and 120. The numbers divisible by 3 in this range are:

102, 105, 108, 111, 114, 117, 120.

There are 7 such numbers, so the output will print 7 numbers.

Answer: (A) 7

Correct Answer: A) 7


Question: 47 Report Error

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

What does the following code print?

x = 'mohan'
for i in range(len(x)):
    x[i].upper()
print (x)
A)
B)
C)
D)
Explanation

The code doesn't change the string x because strings are immutable in Python. The .upper() method creates a new string but doesn't modify the original string. Therefore, x remains 'mohan'.

So, the output is: (A) mohan.

Correct Answer: A) mohan


Question: 49 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 down the code:

  1. The array a is created with the values [1, 5, 4, 7, 8].
  2. The operation a = a + 1 increments each element of the array by 1. So, the updated array will be [2, 6, 5, 8, 9].
  3. When print(a[1]) is called, it prints the element at index 1 of the updated array, which is 6.

Thus, the correct output is: (C) 6.

Correct Answer: C) 6


Question: 50 Report Error

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

What is the output of the following code?

dict={"Joey":1,"Rachel":2}
dict.update({"Phoebe":2})
print(dict)
A)
B)
C)
D)
Explanation

The code initializes a dictionary with two key-value pairs: {"Joey": 1, "Rachel": 2}. Then, dict.update({"Phoebe": 2}) adds a new key "Phoebe" with value 2 to the dictionary.

The final dictionary becomes:

{"Joey": 1, "Rachel": 2, "Phoebe": 2}

So, the output is: (A) {"Joey":1, "Rachel":2, "Phoebe":2}.

Correct Answer: A) {"Joey":1,"Rachel":2,"Phoebe":2}


Question: 51 Report Error

परीक्षण को इस नाम से जाना जाता है:

Testing is known as :

A)
B)
C)
D)

Question: 53 Report Error

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

What is the output of below program ?

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(x, y) compares two values x and y.

  1. If x > y, it returns x.
  2. If x == y, it returns the string 'The numbers are equal'.
  3. Otherwise, it returns y.

In this case, we call maximum(2, 3):

  • 2 is less than 3, so the function will return 3.

Hence, the output will be (B) 3

Correct Answer: B) 3


Question: 54 Report Error

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

What will be the output after the following statements?

for i in range(1,6):
    print(i, end='')
    if i == 3:
        break 
A)
B)
C)
D)
Explanation

The code prints numbers from 1 to 3. When i == 3, the break statement stops the loop. So, the output is:

1 2 3.

Correct Answer: B) 1 2 3


Question: 57 Report Error

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

What will be the output of the following ?

import numpy as np
print(np.maximum([2, 3, 4], [1, 5, 2]))
A)
B)
C)
D)
Explanation

Sure!

np.maximum([2, 3, 4], [1, 5, 2]) compares the two lists element by element and returns the larger value at each position.

  • max(2, 1) = 2
  • max(3, 5) = 5
  • max(4, 2) = 4

So, the output is [2 5 4].

Answer: (D) [2 5 4].

Correct Answer: D) [2 5 4]


Question: 58 Report Error

आयात के " from... import......" के बारे में निम्नलिखित में से कौन सा गलत है?

Which of the following is false about “from .... import ......” form of import?

A)
B)
C)
D)

Question: 61 Report Error

निम्नलिखित अभिव्यक्ति किस मूल्य का मूल्यांकन करती है?

What value does the following expression evaluate to ?

print(5 + 8 * ((3* 5)-9) /10)
A)
B)
C)
D)
Explanation

 

The expression is:

5 + 8 * ((3 * 5) - 9) / 10

Step-by-step:

  1. 3 * 5 = 15
  2. 15 - 9 = 6
  3. 8 * 6 = 48
  4. 48 / 10 = 4.8
  5. 5 + 4.8 = 9.8

So, the result is 9.8.

Answer: (B) 9.8

Correct Answer: B) 9.8


Question: 64 Report Error

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

What will be the output of the following ?

import numpy as np
a = np.array( [2, 3, 4, 5] )
b = np.arange(4)
print(a+b)
A)
B)
C)
D)
Explanation

Sure!

  • a = [2, 3, 4, 5]
  • b = [0, 1, 2, 3] (from np.arange(4))

Adding a and b element-wise:

  • 2 + 0 = 2
  • 3 + 1 = 4
  • 4 + 2 = 6
  • 5 + 3 = 8

So, the result is [2 4 6 8].

Answer: (D) [2 4 6 8].

Correct Answer: D) [2 4 6 8]


Question: 65 Report Error

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

What is the output of below program ?

def say(message, times = 1):
      print(message * times)

say('Hello')
say('World', 5)
A)
B)
C)
D)
Explanation

Sure!

  • say('Hello') prints 'Hello' (default times = 1).
  • say('World', 5) prints 'World' five times: 'WorldWorldWorldWorldWorld'.

Output: Hello WorldWorldWorldWorldWorld.

Answer: (A) Hello WorldWorldWorldWorldWorld.

Correct Answer: A) Hello WorldWorldWorldWorldWorld


Question: 67 Report Error

आउटपुट क्या है?

What is the output ?

def calc(x):
    r=2*x**2
    return r
print(calc(5)) 
A)
B)
C)
D)
Explanation

Sure!

The function calculates 2 * x**2.

For x = 5:

  • 5**2 = 25
  • 2 * 25 = 50

So, the output is 50.

Answer: (B) 50.

Correct Answer: B) 50


Question: 68 Report Error

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

What will be the output of the following Python code ?

def printMax(a, b):
    if a > b:
        print(a, 'is maximum')
    elif a == b:
        print(a, 'is equal to', b)
    else:
        print(b, 'is maximum')
printMax(3, 4)
A)
B)
C)
D)
Explanation

Sure!

  • The function checks if a > b or a == b.
  • Since 3 is less than 4, it goes to the else block and prints 4 is maximum.

So, the output is 4 is maximum.

Answer: (C) 4 is maximum.

Correct Answer: C) 4 is maximum


Question: 69 Report Error

निम्नलिखित अभिव्यक्ति किस मूल्य का मूल्यांकन करती है?

What value does the following expression evaluate to ?

x = 5
while x < 10:
print(x, end='')
A)
B)
C)
D)
Explanation

Sure!

Since x is always 5 and there's no change to x inside the loop, the condition x < 10 will always be true. This causes the loop to run infinitely.

So, the result is an infinite loop.

Answer: (C) Infinite loop.

Correct Answer: C) Infinite loop


Question: 70 Report Error

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

What is the output of the following code ?

x = 50
def func (x) :
    x = 2
func (x)
print ('x is now', x) 
A)
B)
C)
D)
Explanation

Sure!

Inside the function, x is set to 2, but this only affects the local x. The global x remains 50.

So, the output is x is now 50.

Answer: (A) x is now 50.

Correct Answer: A) x is now 50


Question: 71 Report Error

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

What is the output of the following code ?

def disp(*arg):
      for i in arg:
           print(i)
disp(name="Rajat", age="20")
A)
B)
C)
D)
Explanation

Sure!

The function disp(*arg) expects positional arguments, but you passed keyword arguments (name="Rajat", age="20"). This causes a TypeError.

Answer: (A) TypeError.

Correct Answer: A) TypeError


Question: 73 Report Error

निम्नलिखित फ़ंक्शन का रिटर्न प्रकार क्या है?

What is the return type of following function ?

def func1():
       return “mnp‟,22
A)
B)
C)
D)
Explanation

Let's analyze the function:

def func1():
    return "mnp", 22
  • The function is returning two values: "mnp" and 22, separated by a comma.
  • In Python, when multiple values are returned separated by a comma, they are returned as a tuple.

So, the return type of the function is tuple.

Answer: (D) tuple.

Correct Answer: D) tuple


Question: 74 Report Error

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

What is the output of the following code ?

def fun(a, b=6):
    a=a+b
    print(a)
fun(5, 4) 
A)
B)
C)
D)
Explanation

Sure!

The function adds a and b.

In fun(5, 4), a = 5 and b = 4, so 5 + 4 = 9.

The output is 9.

Answer: (B) 9.

Correct Answer: B) 9


Question: 76 Report Error

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

What will be the output of the following Python code?

from math import pow
print(math.pow(2,3))
A)
B)
C)
D)
Explanation

Sure!

You imported pow directly, so you should use pow(2, 3) instead of math.pow(2, 3).

Using math.pow(2, 3) causes an error.

Answer: (D) Error, the statement should be: print(pow(2, 3)).

Correct Answer: D) Error, the statement should be: print(pow(2, 3))


Question: 77 Report Error

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

What will be the output of the following expression ?

x = 4
print(x<<2)
A)
B)
C)
D)
Explanation

Sure!

The << operator shifts the bits to the left.

For x = 4 (binary 100), x << 2 shifts the bits two places left, giving 10000, which is 16.

Answer: (B) 16.

Correct Answer: B) 16


Question: 78 Report Error

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

What is the output of the following code ?

import numpy as np
y = np.array([[11, 12, 13, 14], [32, 33, 34, 35]])
print(y.ndim)
A)
B)
C)
Explanation

Let's analyze the code:

import numpy as np
y = np.array([[11, 12, 13, 14], [32, 33, 34, 35]])
print(y.ndim)
  • y is a 2D array with 2 rows and 4 columns.
  • The ndim attribute in NumPy returns the number of dimensions of the array.

Since y is a 2D array, y.ndim will return 2.

Answer: (B) 2.

Correct Answer: B) 2


Question: 80 Report Error

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

What will be the output of the following expression ?

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

Sure!

  • 7 // 2 gives 3 because floor division rounds down.
  • -7 // 2 gives -4 because floor division rounds down towards the more negative number.

Answer: (C) 3 -4.

Correct Answer: C) 3 -4


Question: 81 Report Error

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

What will be the output of the following pseudo-code ?

Integer a
     Set a = 4
Do
     print a + 2
    a = a- 1
while (a not equals 0)
end while
A)
B)
C)
D)
Explanation

Sure!

  • The loop starts with a = 4 and prints a + 2.
  • In each iteration, a decreases by 1 until a reaches 0.
  • The printed values are: 6 (4 + 2), 5 (3 + 2), 4 (2 + 2), and 3 (1 + 2).

Answer: (B) 6 5 4 3.

Correct Answer: B) 6 5 4 3


Question: 82 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

Sure!

The update() method adds all key-value pairs from dictionary b to dictionary a.

So, a becomes {1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'}.

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

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


Question: 86 Report Error

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

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

Integer a, b, c
Set b = 4, a = 3
c = a ^ b
Print c
A)
B)
C)
D)
Explanation

Sure!

  • a = 3 (binary 0011) and b = 4 (binary 0100).
  • XOR (^) gives 1 when bits are different, 0 when the same.

So, 3 ^ 4 = 7 (binary 0111).

Answer: (D) 7.

Correct Answer: D) 7


Question: 90 Report Error

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

What will be the output of the following ?

def iq(a,b):
    if(a==0):
        return b
    else:
        return iq(a-1,a+b)
print(iq(3,6)) 
A)
B)
C)
D)
Explanation

Sure!

The function iq recursively calls itself, reducing a and adding a to b each time.

  • iq(3, 6)iq(2, 9)
  • iq(2, 9)iq(1, 11)
  • iq(1, 11)iq(0, 12)

When a = 0, it returns b, which is 12.

Answer: (D) 12.

Correct Answer: D) 12


Question: 93 Report Error

निम्नलिखित कोड खंड क्या प्रिंट करेगा?

What will following code segment print ?

a = True 
b = False
c = False
if not a or b:
    print(1)
elif not a or not b and c:
    print (2)
elif not a or b or not b and a:
    print (3)
else:
    print (4) 
A)
B)
C)
D)
Explanation

Sure!

  • First condition not a or b: False or FalseFalse
  • Second condition not a or not b and c: False or (True and False)False
  • Third condition not a or b or not b and a: False or False or TrueTrue

So, it prints 3.

Answer: (B) 3.

Correct Answer: B) 3


Question: 94 Report Error

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

What will be the output after the following statements?

x = 2
if x < 5:
    print(x)
else:
    pass 
A)
B)
C)
D)
Explanation

Sure!

Since x = 2 and x < 5 is True, it prints x, which is 2.

Answer: (C) 2.

Correct Answer: C) 2


Question: 95 Report Error

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

What will be the output of the following pseudocode ?

Integer a, b
Set a = 9, b = 5
a = a mod (a - 3)
b = b mod (b – 3)
Print a + b
A)
B)
C)
D)
Explanation

Sure!

  • a = 9 mod (9 - 3) = 9 mod 6 = 3
  • b = 5 mod (5 - 3) = 5 mod 2 = 1
  • So, a + b = 3 + 1 = 4.

Answer: (A) 4.

Correct Answer: B) 5


Related Papers



















































Latest Updates