NIELIT M3-R5 Python MCQ Exam Online Test

NIELIT M3-R5 Python MCQ Exam Online Test

421.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a=(1,2,3,4)
>>> del(a[2])
A) Now, a=(1,2,4)
B) Now, a=(1,3,4)
C) Now a=(3,4)
D) Error as tuple is immutable ✔️

422.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a=(2,3,4)
>>> sum(a,3)
A) Too many arguments for sum() method
B) The method sum() doesn’t exist for tuples
C) 12 ✔️
D) 9

423.Is the following Python code valid?
>>> a=(1,2,3,4)
>>> del a
A) No because tuple is immutable
B) Yes, first element in the tuple is deleted
C) Yes, the entire tuple is deleted ✔️
D) No, invalid syntax for del method

424.What type of data is: a=[(1,1),(2,4),(3,9)]?
A) Array of tuples
B) List of tuples ✔️
C) Tuples of lists
D) Invalid type

425.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a=(0,1,2,3,4)
>>> b=slice(0,2)
>>> a[b]
A) Invalid syntax for slicing
B) [0,2]
C) (0,1) ✔️
D) (0,2)

426.Suppose s is “\t\tWorld\n”, what is s.strip()?
A) \t\tWorld\n
B) \t\tWorld\n
C) \t\tWORLD\n
D) World ✔️

427.Is the following Python code valid?
निम्नलिखित पायथन कोड मान्य है?
>>> a=(1,2,3)
>>> b=(‘A’,’B’,’C’)
>>> c=tuple(zip(a,B))
A) Yes, c will be ((1, ‘A’), (2, ‘B’), (3, ‘C’)) ✔️
B) Yes, c will be ((1,2,3),(‘A’,’B’,’C’))
C) No because tuples are immutable
D) No because the syntax for zip function isn’t valid

428.Is the following Python code valid?
निम्नलिखित पायथन कोड मान्य है?
>>> a,b,c=1,2,3
>>> a,b,c
A) Yes, [1,2,3] is printed
B) No, invalid syntax
C) (1,2,3) ✔️
D) 1 is printed

429.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
a = (‘check’,)
n = 2
for i in range(int(n)):
a = (a,)
print(A)

A) Error, tuples are immutable
B) ((‘check’,),) ✔️
(((‘check’,),),)
C) ((‘check’,)’check’,)
D) ((‘check’,)’check’,)
(((‘check’,)’check’,)’check’,)

430.Is the following Python code valid?
निम्नलिखित पायथन कोड मान्य है?
>>> a,b=1,2,3
A) Yes, this is an example of tuple unpacking.
a=1 and b=2
B) Yes, this is an example of tuple unpacking.
a=(1,2) and b=3
C) No, too many values to unpack ✔️
D) Yes, this is an example of tuple unpacking.
a=1 and b=(2,3)

431.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a=(1,2)
>>> b=(3,4)
>>> c=a+b
>>> c

A) (4,6)
B) (1,2,3,4) ✔️
C) Error as tuples are immutable
D) None

432.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a,b=6,7
>>> a,b=b,a
>>> a,b
A) (6,7)
B) Invalid syntax
C) (7,6) ✔️
D) Nothing is printed

433.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> import collections
>>> a=collections.namedtuple(‘a’,[‘i’,’j’])
>>> obj=a(i=4,j=7)
>>> obj
A) a(i=4, j=7) ✔️
B) obj(i=4, j=7)
C) (4,7)
D) An exception is thrown

434.Tuples can’t be made keys of a dictionary.
Tuples को शब्दकोश की कुंजी नहीं बनाया जा सकता है।
A) True
B) False ✔️

435.Is the following Python code valid?
निम्नलिखित पायथन कोड मान्य है?
>>> a=2,3,4,5
>>> a
A) Yes, 2 is printed
B) Yes, [2,3,4,5] is printed
C) No, too many values to unpack
D) Yes, (2,3,4,5) is printed ✔️

436.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
B = [[3, 3, 3],
[4, 4, 4],
[5, 5, 5]]
zip(A, B)

A) Address of the zip object ✔️
B) Address of the matrices A and B
C) No output
D) [3, 6, 9, 16, 20, 24, 35, 40, 45]

437.Which of the following is a Python tuple?
निम्नलिखित में से कौन पायथन ट्यूपल है?
A) [1, 2, 3]
B) (1, 2, 3) ✔️
C) {1, 2, 3}
D) {}

438.Suppose t = (1, 2, 4, 3), which of the following is incorrect?
मान लीजिए टी = (1, 2, 4, 3), निम्न में से कौन गलत है?
A) print(t[3])
B) t[3] = 45 ✔️
C) print(max(t))
D) print(len(t))

439.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>>t=(1,2,4,3)
>>>t[1:3]
A) (1, 2)
B) (1, 2, 4)
C) (2, 4) ✔️
D) (2, 4, 3)

440.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>>t=(1,2,4,3)
>>>t[1:-1]
A) (1, 2)
B) (1, 2, 4)
C) (2, 4) ✔️
D) (2, 4, 3)

441.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>>t = (1, 2, 4, 3, 8, 9)
>>>[t[i] for i in range(0, len(t), 2)]
A) [2, 3, 9]
B) [1, 2, 4, 3, 8, 9]
C) [1, 4, 8] ✔️
D) (1, 4, 8)

442.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
d = {“john”:40, “peter”:45}
d[“john”]
A) 40 ✔️
B) 45
C) “john”
D) “peter”

443.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>>t = (1, 2)
>>>2 * t
A) (1, 2, 1, 2) ✔️
B) [1, 2, 1, 2]
C) (1, 1, 2, 2)
D) [1, 1, 2, 2]

444.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>>t1 = (1, 2, 4, 3)
>>>t2 = (1, 2, 3, 4)
>>>t1 < t2
A) True
B) False ✔️
C) Error
D) None

445.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>>my_tuple = (1, 2, 3, 4)
>>>my_tuple.append( (5, 6, 7) )
>>>print len(my_tuple)
A) 1
B) 2
C) 5
D) Error ✔️

446.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
numberGames = {}
numberGames[(1,2,4)] = 8
numberGames[(4,2,1)] = 10
numberGames[(1,2)] = 12
sum = 0
for k in numberGames:
sum += numberGames[k]
print len(numberGames) + sum
A) 30
B) 24
C) 33 ✔️
D) 12

447.What is the data type of (1)?
(1) का डेटा प्रकार क्या है?
A) Tuple
B) Integer ✔️
C) List
D) Both tuple and integer

448.If a=(1,2,3,4), a[1:-1] is____
यदि a = (1,2,3,4), एक [1: -1] है
A) Error, tuple slicing doesn’t exist
B) [2,3]
C) (2,3,4)
D) (2,3) ✔️

449.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a=(1,2,(4,5))
>>> b=(1,2,(3,4))
>>> a<b
A) False ✔️
B) True
C) Error, < operator is not valid for tuples
D) Error, < operator is valid for tuples but not if there are sub-tuples

450.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a=(“Check”)*3
>>> a
A) (‘Check’,’Check’,’Check’)
B) * Operator not valid for tuples
C) (‘CheckCheckCheck’) ✔️
D) Syntax error

Relate Link