| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Python MCQ Practice Questions SET 14 | |||||||||||||||||||||||||
2 | ||||||||||||||||||||||||||
3 | Sr. No. | Question | Option 1 | Option 2 | Option 3 | Option 4 | Correct Option | |||||||||||||||||||
4 | 131 | for i in range(7): print(I,End=" ") What will be output of given code | 0 1 2 3 4 5 6 | 123456 | End' is an invalid keyword | 0 1 2 3 4 5 6 | C | |||||||||||||||||||
5 | 132 | while i<=6: if i%2==0: print(i) i+=1 What will be the output of given code | 6 | 0 2 4 6 | 0 2 4 6 | 0 2 4 5 | A | |||||||||||||||||||
6 | 133 | f1=0 f2=1 i=1 while i<8: f3=f1+f2 f1=f2 f2=f3 print(f3) i+=1 What will be the output of given code | 1 2 3 5 8 13 21 34 | 1 2 3 5 8 13 21 | 0 1 2 3 5 8 13 21 | 0 1 2 3 5 8 13 21 34 | B | |||||||||||||||||||
7 | 134 | dict1={1:10,2:20,3:30,4:40,5:50,6:60,7:13,8:"Hello"} for key,value in dict1.items(): print(key,value) what will be the output of given code | 1 10 2 20 3 30 4 40 5 50 6 60 7 13 8 Hello | 1 2 3 4 5 6 7 8 | 10 20 30 40 50 60 13 Hello | Error in code | A | |||||||||||||||||||
8 | 135 | What is the purpose of a lambda function in Python? | To define a function with a single expression | To create anonymous functions | To apply a function to a sequence of elements | To perform arithmetic operations | b | |||||||||||||||||||
9 | 136 | my_set={"Python","DBMS","C","C++"} my_dict=dict(zip(my_set,range(len(my_set)))) print(my_dict) what will be the output of given code | {'Python': 1, 'C': 2, 'DBMS': 3, 'C++': 4} | {'Python': 0, 'C': 1, 'DBMS': 2, 'C++': 3} | {'Python': 10, 'C': 1, 'DBMS': 2, 'C++': 3} | None of above | B | |||||||||||||||||||
10 | 137 | my_tuple=(1,22,33,4,5,6,0) sorted_tuple=sorted(my_tuple,reverse=0) print(sorted_tuple) what will be the output of given code | [0, 1, 4, 5, 6, 22, 33] | [33, 22, 6, 5, 4, 1, 0] | (1, 22, 33, 4, 5, 6, 0) | None of above | A | |||||||||||||||||||
11 | 138 | Which built-in function in Python returns the ASCII value of a character? | chr() | ord() | encode() | b | ||||||||||||||||||||
12 | 139 | What does the any() function in Python return? | True if all elements in an iterable are true | True if any element in an iterable is true | True if all elements in an iterable are false | True if any element in an iterable is false | b | |||||||||||||||||||
13 | 140 | What is the purpose of the eval() function in Python? | To evaluate an expression | To execute a Python script | To convert a string to a floating-point number | To execute a system command | a | |||||||||||||||||||
14 | ||||||||||||||||||||||||||
15 | ||||||||||||||||||||||||||
16 | ||||||||||||||||||||||||||
17 | ||||||||||||||||||||||||||
18 | ||||||||||||||||||||||||||
19 | ||||||||||||||||||||||||||
20 | ||||||||||||||||||||||||||
21 | ||||||||||||||||||||||||||
22 | ||||||||||||||||||||||||||
23 | ||||||||||||||||||||||||||
24 | ||||||||||||||||||||||||||
25 | ||||||||||||||||||||||||||
26 | ||||||||||||||||||||||||||
27 | ||||||||||||||||||||||||||
28 | ||||||||||||||||||||||||||
29 | ||||||||||||||||||||||||||
30 | ||||||||||||||||||||||||||
31 | ||||||||||||||||||||||||||
32 | ||||||||||||||||||||||||||
33 | ||||||||||||||||||||||||||
34 | ||||||||||||||||||||||||||
35 | ||||||||||||||||||||||||||
36 | ||||||||||||||||||||||||||
37 | ||||||||||||||||||||||||||
38 | ||||||||||||||||||||||||||
39 | ||||||||||||||||||||||||||
40 | ||||||||||||||||||||||||||
41 | ||||||||||||||||||||||||||
42 | ||||||||||||||||||||||||||
43 | ||||||||||||||||||||||||||
44 | ||||||||||||||||||||||||||
45 | ||||||||||||||||||||||||||
46 | ||||||||||||||||||||||||||
47 | ||||||||||||||||||||||||||
48 | ||||||||||||||||||||||||||
49 | ||||||||||||||||||||||||||
50 | ||||||||||||||||||||||||||
51 | ||||||||||||||||||||||||||
52 | ||||||||||||||||||||||||||
53 | ||||||||||||||||||||||||||
54 | ||||||||||||||||||||||||||
55 | ||||||||||||||||||||||||||
56 | ||||||||||||||||||||||||||
57 | ||||||||||||||||||||||||||
58 | ||||||||||||||||||||||||||
59 | ||||||||||||||||||||||||||
60 | ||||||||||||||||||||||||||
61 | ||||||||||||||||||||||||||
62 | ||||||||||||||||||||||||||
63 | ||||||||||||||||||||||||||
64 | ||||||||||||||||||||||||||
65 | ||||||||||||||||||||||||||
66 | ||||||||||||||||||||||||||
67 | ||||||||||||||||||||||||||
68 | ||||||||||||||||||||||||||
69 | ||||||||||||||||||||||||||
70 | ||||||||||||||||||||||||||
71 | ||||||||||||||||||||||||||
72 | ||||||||||||||||||||||||||
73 | ||||||||||||||||||||||||||
74 | ||||||||||||||||||||||||||
75 | ||||||||||||||||||||||||||
76 | ||||||||||||||||||||||||||
77 | ||||||||||||||||||||||||||
78 | ||||||||||||||||||||||||||
79 | ||||||||||||||||||||||||||
80 | ||||||||||||||||||||||||||
81 | ||||||||||||||||||||||||||
82 | ||||||||||||||||||||||||||
83 | ||||||||||||||||||||||||||
84 | ||||||||||||||||||||||||||
85 | ||||||||||||||||||||||||||
86 | ||||||||||||||||||||||||||
87 | ||||||||||||||||||||||||||
88 | ||||||||||||||||||||||||||
89 | ||||||||||||||||||||||||||
90 | ||||||||||||||||||||||||||
91 | ||||||||||||||||||||||||||
92 | ||||||||||||||||||||||||||
93 | ||||||||||||||||||||||||||
94 | ||||||||||||||||||||||||||
95 | ||||||||||||||||||||||||||
96 | ||||||||||||||||||||||||||
97 | ||||||||||||||||||||||||||
98 | ||||||||||||||||||||||||||
99 | ||||||||||||||||||||||||||
100 | ||||||||||||||||||||||||||