What will be the output after the following statements? x = {0:4, 1:8, 2:16, 3:32} print(list(x.values())[2]) a. [4, 8] b. [4, 8, 16] c. 16 d. 8
What will be the output after the following statements? x = {0:4, 1:8, 2:16, 3:32} print(x.items()) a. dict_items(4, 8, 16, 32) b. dict_items([4, 8, 16, 32]) c. dict_items[0, 1, 2, 3] d. dict_items([(0, 4), (1, 8), (2, 16), (3, 32)])
What will be the output after the following statements? x = {5:4, 8:8, 3:16, 9:32} print(sorted(x.items())) a. [4, 8, 16, 32] b. [(3, 16), (5, 4), (8, 8), (9, 32)] c. [3, 5, 8, 9] d. [(4, 5), (8, 8), (16, 3), (32, 9)]
What will be the output after the following statements? x = 7 if x > 5: print(20) a. 20 b. 5 c. x d. 7
What will be the output after the following statements? x = 8 if x > 8: print(20) else: print(10) a. 20 b. x c. 10 d. 8
What will be the output after the following statements? x = 40 if x > 10: print(20) elif x == 40: print(10) else: print(30) a. 20 b. 40 c. 10 d. 30
What will be the output after the following statements? x = 15 if x > 15: print(0) elif x == 15: print(1) else: print(2) a. 0 b. 1 c. 2 d. 15
What will be the output after the following statements? x = 5 if x > 15: print(‘yes’) elif x == 15: print(‘equal’) else: print(‘no’) a. 15 b. yes c. equal d. no
What will be the output after the following statements? x = 50 if x > 10 and x < 15: print(‘true’) elif x > 15 and x < 25: print(‘not true’) elif x > 25 and x < 35: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 25 if x > 10 and x < 15: print(‘true’) elif x > 15 and x < 25: print(‘not true’) elif x > 25 and x < 35: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 15 if x > 10 and x <= 15: print(‘true’) elif x > 15 and x < 25: print(‘not true’) elif x > 25 and x < 35: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 25 if x > 10 and x <= 15: print(‘true’) elif x >= 15 and x < 25: print(‘not true’) elif x >= 25 and x < 35: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 25 if x >= 10 and x <= 15: print(‘true’) elif x >= 15 and x <= 25: print(‘not true’) elif x >= 25 and x <= 35: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 20 if x <= 10 or x >= 75: print(‘true’) elif x <= 15 or x >= 55: print(‘not true’) elif x <= 25 or x >= 35: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 30 if x <= 10 or x >= 75: print(‘true’) elif x <= 15 or x >= 55: print(‘not true’) elif x <= 25 or x >= 35: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 80 if x <= 10 or x >= 75: print(‘true’) elif x <= 15 or x >= 55: print(‘not true’) elif x <= 25 or x >= 35: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 60 if x <= 10 or x >= 75: print(‘true’) elif x <= 15 or x >= 55: print(‘not true’) elif x <= 25 or x >= 35: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 68 if x <= 50 and x >= 25: print(‘true’) elif x <= 60 or x >= 55: print(‘not true’) elif x <= 70 and x >= 35: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 99 if x <= 30 or x >= 100: print(‘true’) elif x >= 50 and x <= 80: print(‘not true’) elif x >= 100 or x <= 75: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 70 if x <= 30 or x >= 100: print(‘true’) elif x <= 50 and x == 50: print(‘not true’) elif x >= 150 or x <= 75: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 40 y = 25 if x + y >= 100: print(‘true’) elif x + y == 50: print(‘not true’) elif x + y <= 90: print(‘false’) else: print(‘not false’) a. true b. false c. not true d. not false
What will be the output after the following statements? x = 1 while x < 10: print(x, end=”) x = x + 1 a. 123456789 b. 1 c. 10 d. 2
What will be the output after the following statements? x = 0 while x < 10: print(x, end=”) x += 4 a. 0123456789 b. 123456789 c. 4123456789 d. 048
What will be the output after the following statements? x = 0 y = 4 while x + y < 10: print(x, end=”) x += 1 a. 012345 b. 0123456789 c. 4123456789 d. 048
What will be the output after the following statements? x = 0 y = 4 while x + y < 10: x += 1 print(x, end=”) a. 012345 b. 0123456 c. 123456 d. 0123456
What will be the output after the following statements? x = 1 y = 4 while x * y < 10: print(y, end=”) y += 1 a. 012345 b. 456789 c. 123456789 d. 0123456789
What will be the output after the following statements? x = 1 y = 4 while x * y < 10: print(y, end=”) x += 1 y += 1 a. 4 b. 48 c. 148 d. 0123456789
What will be the output after the following statements? x = 1 y = 4 while x * y <= 10: print(x, end=”) x += 1 y += 1 a. 4 b. 48 c. 14 d. 12
What will be the output after the following statements? x, y = 2, 5 while y – x < 5: print(x*y, end=’ ‘) x += 3 y += 4 a. 1045 b. 10 45 c. 34 d. 3 4 10 45
What will be the output after the following statements? x, y = 0, 1 while y < 10: print(y, end=’ ‘) x, y = y, x + y a. 1 1 2 3 5 8 b. 112358 c. 0123456789 d. 0 2 4 6 8
What will be the output after the following statements? x = 1 while x < 4: x += 1 y = 1 while y < 3: print(y, end=’ ‘) y += 1 a. 1 1 2 2 b. 1 1 2 2 3 3 4 4 c. 1 2 3 4 d. 1 2 1 2 1 2
What will be the output after the following statements? x = y = 1 while x < 4: x += 1 while y < 3: print(y, end=’ ‘) y += 1 a. 1 1 2 2 b. 1 2 c. 1 2 3 4 d. 1 2 1 2 1 2
What type of loop is this? x = 1 while x < 5: print(x, end=”) a. Closed loop b. One time loop c. Infinite loop d. Evergreen loop
What will be the output after the following statements? x = ‘hello’ for i in x: print(i, end=”) a. h b. hello c. h e l l o d. i x
What will be the output after the following statements? for i in range(5): print(i, end=”) a. 5 b. 1 5 c. 012345 d. 01234
What will be the output after the following statements? for i in range(1,5): print(i, end=”) a. 15 b. 12345 c. 1234 d. 012345
What will be the output after the following statements? for i in range(1,25,5): print(i, end=’ ‘) a. 1 6 11 16 21 b. 1 5 10 15 20 25 c. 1 5 25 d. 16111621
What will be the output after the following statements? x = [‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’] for i in x: print(i, end=”) a. P b. python c. Pytho d. Python
What will be the output after the following statements? x = (‘a’, ‘b’, ‘c’, ‘d’) for i in x: print(i, end=’ ‘) a. abcd b. a b c d c. False d. True
What will be the output after the following statements? x = {‘x’, ‘z’, ‘y’} for i in x: print(i, end=”) a. x z y b. xzy c. False d. True
What will be the output after the following statements? x = {‘z:1’, ‘y:2’, ‘x:3′} for i in x: print(i, end=’ ‘) a. x y z b. 1 2 3 c. x:3 y:2 z:1 d. True
What will be the output after the following statements? x = [‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’] for i in enumerate(x): print(i, end=”) a. (‘P’)(‘y’)(‘t’)(‘h’)(‘o’)(‘n’) b. python c. python d. (0, ‘P’)(1, ‘y’)(2, ‘t’)(3, ‘h’)(4, ‘o’)(5, ‘n’)
What will be the output after the following statements? x = {‘x’:1, ‘y’:2, ‘z’:3} for i in x: print(i, end=’ ‘) a. x y z b. 1 2 3 c. x:1 y:2 z:3 d. True
What will be the output after the following statements? x = {‘x’:1, ‘y’:2, ‘z’:3} for i, j in x.items(): print(i, j, end=’ ‘) a. x y z b. x 1 y 2 z 3 c. x:1 y:2 z:3 d. x, 1, y, 2, z, 3
What will be the output after the following statements? x = [‘p’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’] y = [‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’] for i in zip(x, y): print(i, end=”) a. (‘P’)(‘y’)(‘t’)(‘h’)(‘o’)(‘n’) b. python 0 1 2 3 4 5 c. (‘p’, ‘0’)(‘y’, ‘1’)(‘t’, ‘2’)(‘h’, ‘3’)(‘o’, ‘4’)(‘n’, ‘5’) d. (0, ‘P’)(1, ‘y’)(2, ‘t’)(3, ‘h’)(4, ‘o’)(5, ‘n’)
What will be the output after the following statements? for i in range(1,5): print(i, end=”) if i == 3: break a. 123 b. 1234 c. 12 d. 12345
What will be the output after the following statements? for i in range(0,5): if i == 2: break print(i, end=”) a. 12 b. 01 c. 012 d. 0123
What will be the output after the following statements? for i in range(1,5): if i == 3: continue print(i, end=’ ‘) a. 1 2 4 b. 1 2 3 4 c. 1 2 d. 1 2 3
What will be the output after the following statements? for i in range(0,5): print(i, end=”) if i == 2: continue a. 0124 b. 01234 c. 12 d. 1345
What will be the output after the following statements? myvar = 5 def printvar() : print(myvar) printvar() a. 01245 b. 12345 c. 5 d. 1234