Skip to content

Category Archives: Python-Quizzes

Question 8:Find the output of the following program: dict ={}  print (all(dict))  (A) { } (B) False (C) True (D) An exception is thrown Answer:… Read More
Question 7:Find the output of the following program: a ={}  a.fromkeys(['a', 'b', 'c', 'd'], 98)  print (a)  (A) Syntax error (B) {‘a’:98, ‘b’:98, ‘c’:98, ‘d’:98}… Read More
Question 6:Find the output of the following program: a = {i: i * i for i in range(6)}  print (a)  (A) Dictionary comprehension doesn’t exist… Read More
Question 5:Find the output of the following program: D = {1 : [1, 2, 3], 2: (4, 6, 8)}  D[1].append(4)  print(D[1], end = " ") … Read More
Question 4:Find the output of the following program: D = dict()  for i in range (3):      for j in range(2):          D[i] = j  print(D)  (A)… Read More
Question 3:Find the output of the following program: D = {1 : {'A' : {1 : "A"}, 2 : "B"}, 3 :"C", 'B' : "D",… Read More
Question 2:Find the output of the following program: D = {1 : 1, 2 : '2', '1' : 1, '2' : 3}  D['1'] = 2… Read More
Question 1:Find the output of the following program: D = dict()  for x in enumerate(range(2)):      D[x[0]] = x[1]      D[x[1]+7] = x[0]  print(D)  (A) {0: 1,… Read More
Question 25: Find the output of the following program: def REVERSE(L):      L.reverse()      return(L)  def YKNJS(L):      List = []      List.extend(REVERSE(L))      print(List)     L = [1, 3.1,… Read More
Question 24: Find the output of the following program: L = [1, 3, 5, 7, 9]  print(L.pop(-3), end = ' ')  (A) 5 (B) 9… Read More
Question 23: Find the output of the following program: L1 = [1, 2, 3, 4]  L2 = L1  L3 = L1.copy()  L4 = L1 L1[0]… Read More
Question 22: Find the output of the following program: L1 = [1, 1.33, 'GFG', 0, 'NO', None, 'G', True]  val1, val2 = 0, ''  for… Read More
Question 21: Find the output of the following program: L1 = [] L1.append([1, [2, 3], 4])  L1.extend([7, 8, 9])  print(L1[0][1][1] + L1[2])  (A) Type Error… Read More
Question 20: Find the output of the following program: data = [x for x in (x for x in 'Geeks 22966 for Geeks' if x.isdigit())… Read More
Question 19: Find the output of the following program: temp = 'Geeks 22536 for 445 Geeks' data = [x for x in (int(x) for x… Read More