NIELIT M3-R5 Python MCQ Interview Questions

NIELIT M3-R5 Python MCQ Interview Questions

361.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
def change(var, lst):
var = 1
lst[0] = 44
k = 3
a = [1, 2, 3]
change(k, A)
print(k)
print(A)

A) 3 ✔️
[44, 2, 3]
B) 1
[1,2,3]
C) 3
[1,2,3]
D) 1
[44,2,3]

362.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
a = [1, 5, 7, 9, 9, 1]
<br class=”blank” />b=a[0]
<br class=”blank” />x= 0
for x in range(1, len(A)):
if a[x] > b:
b = a[x]
b= x
print(B)
A) 5
B) 3
C) 4 ✔️
D) 0

363.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
a=[“Apple”,”Ball”,”Cobra”]
<br class=”blank” />a.sort(key=len)
print(A)
A) [‘Apple’, ‘Ball’, ‘Cobra’]
B) [‘Ball’, ‘Apple” ‘Cobra’] ✔️
C) [‘Cobra’, ‘Apple’, ‘Ball’]
D) Invalid syntax for sort()

364.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
num = [‘One’, ‘Two’, ‘Three’]
for i, x in enumerate(num):
print(‘{}: {}’.format(i, x),end=” “)

A) 1: 2: 3:
B) Exception is thrown
C) One Two Three
D) 0: One 1: Two 2: Three ✔️

365.What will be the output of the following Python code snippet?
निम्नलिखित पायथन कोड स्निपेट का आउटपुट क्या होगा?
k = [print(i) for i in my_string if i not in “aeiou”]
A) prints all the vowels in my_string
B) prints all the consonants in my_string
C) prints all characters of my_string that aren’t vowels ✔️
D) prints only on executing print(k)

366.What is the output of print(k) in the following Python code snippet?
निम्नलिखित पायथन कोड स्निपेट में प्रिंट (k) का आउटपुट क्या है?
k = [print(i) for i in my_string if i not in “aeiou”]
print(k)
A) all characters of my_string that aren’t vowels
B) a list of Nones ✔️
C) list of Trues
D) list of Falses

367.What will be the output of the following Python code snippet?
निम्नलिखित पायथन कोड स्निपेट का आउटपुट क्या होगा?
my_string = “hello world”
k = [(i.upper(), len(i)) for i in my_string]
print(k)
A) [(‘HELLO’, 5), (‘WORLD’, 5)]
B) [(‘H’, 1), (‘E’, 1), (‘L’, 1), (‘L’, 1), (‘O’, 1), (‘ ‘, 1), ✔️
(‘W’, 1), (‘O’, 1), (‘R’, 1), (‘L’, 1), (‘D’, 1)]
C) [(‘HELLO WORLD’, 11)]
D) None of the mentioned

368.Which of the following is the correct expansion of list_1 = [expr(i) for i in list_0 if
func(i)]?
निम्नलिखित में से कौन सूची 1 का सही विस्तार है = = [ir के लिए (i) सूची_0 में
func (i)]?
A)
list_1 = []
for i in list_0:
if func(i):
list_1.append(i)
B)
for i in list_0:
if func(i):
list_1.append(expr(i))
C) ✔️
list_1 = []
for i in list_0:
if func(i):
list_1.append(expr(i))
D) None of the mentioned

369.What will be the output of the following Python code snippet?
निम्नलिखित पायथन कोड स्निपेट का आउटपुट क्या होगा?
x = [i**+1 for i in range(3)]; print(x);
A) [0, 1, 2] ✔️
B) [1, 2, 5]
C) error, **+ is not a valid operator
D) error, ‘;’ is not allowed

370.What will be the output of the following Python code snippet?
निम्नलिखित पायथन कोड स्निपेट का आउटपुट क्या होगा?
print([i+j for i in “abc” for j in “def”])
A) [‘da’, ‘ea’, ‘fa’, ‘db’, ‘eb’, ‘fb’, ‘dc’, ‘ec’, ‘fc’]
B) [[‘ad’, ‘bd’, ‘cd’], [‘ae’, ‘be’, ‘ce’], [‘af’, ‘bf’, ‘cf’]]
C) [[‘da’, ‘db’, ‘dc’], [‘ea’, ‘eb’, ‘ec’], [‘fa’, ‘fb’, ‘fc’]]
D) [‘ad’, ‘ae’, ‘af’, ‘bd’, ‘be’, ‘bf’, ‘cd’, ‘ce’, ‘cf’] ✔️

371.What will be the output of the following Python code?
>>>list1 = [11, 2, 23]
>>>list2 = [11, 2, 2]
>>>list1 < list2 is
A) True
B) False ✔️
C) Error
D) None

372.What will be the output of the following Python code snippet?
निम्नलिखित पायथन कोड स्निपेट का आउटपुट क्या होगा?
print([if i%2==0: i; else: i+1; for i in range(4)])
A) [0, 2, 2, 4]
B) [1, 1, 3, 3]
C) error ✔️
D) None of the mentioned

373.Which of the following is the same as list(map(lambda x: x**-1, [1, 2, 3]))?
निम्नलिखित में से कौन सी सूची (मानचित्र (लंबो x: x ** – 1, [1, 2, 3]) के समान है?)
A) [x**-1 for x in [(1, 2, 3)]]
B) [1/x for x in [(1, 2, 3)]]
C) [1/x for x in (1, 2, 3)] ✔️
D) error

374.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
l=[1,2,3,4,5]
[x&1 for x in l]
A) [1, 1, 1, 1, 1]
B) [1, 0, 1, 0, 1] ✔️
C) [1, 0, 0, 0, 0]
D) [0, 1, 0, 1, 0]

375.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
a=[[]]*3
a[1].append(7)
print(A)
A) Syntax error
B) [[7], [7], [7]] ✔️
C) [[7], [], []]
D) [[],7, [], []]

376.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
b=[2,3,4,5]
a=list(filter(lambda x:x%2,B))
print(A)
A) [2,4]
B) [ ]
C) [3,5] ✔️
D) Invalid arguments for filter function

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

378.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
a=[1,2,3]
b=a.append(4)
print(A)
print(B)

A) [1,2,3,4]
[1,2,3,4]
B) [1, 2, 3, 4] ✔️
None
C) Syntax error
D) [1,2,3]
[1,2,3,4]

379.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a=[14,52,7]
>>>> b=a.copy()
>>> b is a
A) True
B) False ✔️

380.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
a=[13,56,17]
a.append([87])
a.extend([45,67])
print(A)
A) [13, 56, 17, [87], 45, 67] ✔️
B) [13, 56, 17, 87, 45, 67]
C) [13, 56, 17, 87,[ 45, 67]]
D) [13, 56, 17, [87], [45, 67]]

381.What is the output of the following piece of code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
a=list((45,)*4)
print((45)*4)
print(A)

A) 180
[(45),(45),(45),(45)]
B) (45,45,45,45)
[45,45,45,45]
C) 180 ✔️
[45,45,45,45]
D) Syntax error

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

383.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
word1=”Apple”
word2=”Apple”
list1=[1,2,3]
list2=[1,2,3]
print(word1 is word2)
print(list1 is list2)

A) True
True
B) False
True
C) False
False
D) True ✔️
False

384.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
def unpack(a,b,c,D):
print(a+d)
x = [1,2,3,4]
unpack(*x)
A) Error
B) [1,4]
C) [5]
D) 5 ✔️

385.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
places = [‘Bangalore’, ‘Mumbai’, ‘Delhi’]
<br class=”blank” />places1 = places
places2 = places[:]
<br class=”blank” />places1[1]=”Pune”
places2[2]=”Hyderabad”
print(places)

A) [‘Bangalore’, ‘Pune’, ‘Hyderabad’]
B) [‘Bangalore’, ‘Pune’, ‘Delhi’] ✔️
C) [‘Bangalore’, ‘Mumbai’, ‘Delhi’]
D) [‘Bangalore’, ‘Mumbai’, ‘Hyderabad’]

386.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
x=[[1],[2]]
print(” “.join(list(map(str,x))))
A) [1] [2]
B) [49] [50] ✔️
C) Syntax error
D) [[1]] [[2]]

387.Which of the following Boolean expressions is not logically equivalent to the other three?
निम्नलिखित में से कौन सा बुलियन अभिव्यक्ति तार्किक रूप से अन्य तीन के बराबर नहीं है?
A) not(-6<0 or-6>10)
B) -6>=0 and -6<=10
C) not(-6<10 or-6==10)
D) not(-6>10 or-6==10) ✔️

388.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
a=165
b=sum(list(map(int,str(A))))
print(B)
A) 561
B) 5
C) 12 ✔️
D) Syntax error

389.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
a= [1, 2, 3, 4, 5]
for i in range(1, 5):
a[i-1] = a[i]
for i in range(0, 5):
print(a[i],end = ” “)

A) 5 5 1 2 3
B) 5 1 2 3 4
C) 2 3 4 5 1
D) 2 3 4 5 5 ✔️

390.What will be the output of the following Python code snippet?
निम्नलिखित पायथन कोड स्निपेट का आउटपुट क्या होगा?
print([i.lower() for i in “HELLO”])
A) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] ✔️
B) ‘hello’
C) [‘hello’]
D) hello

Relate Link