1. |
What is the output of the following code : print 9//2 |
A. | 4.5 |
B. | 4.0 |
C. | 4 |
D. | Error |
Answer» C. 4 |
2. |
Which function overloads the >> operator? |
A. | more() |
B. | gt() |
C. | ge() |
D. | rshift() |
Answer» D. rshift() |
3. |
What is the output of the following program :
|
A. | 0 2 1 3 2 4 |
B. | 0 1 2 3 4 5 |
C. | 0 1 1 2 2 3 |
D. | 1 0 2 4 3 5 |
Answer» C. 0 1 1 2 2 3 |
4. |
Which module in Python supports regular expressions? |
A. | re |
B. | regex |
C. | pyregex |
D. | None of the above |
Answer» A. re |
5. |
What is the output of the following program : print 0.1 + 0.2 == 0.3 |
A. | True |
B. | False |
C. | Machine dependent |
D. | Error |
Answer» B. False | |
Explanation: Neither of 0.1, 0.2 and 0.3 can be represented accurately in binary. The round off errors from 0.1 and 0.2 accumulate and hence there is a difference of 5.5511e-17 between (0.1 + 0.2) and 0.3. |
6. |
Which of these is not a core data type? |
A. | Lists |
B. | Dictionary |
C. | Tuples |
D. | Class |
Answer» D. Class |
7. |
What data type is the object below? L = [1, 23, „hello‟, 1] |
A. | List |
B. | Dictionary |
C. | Tuple |
D. | Array |
Answer» A. List |
8. |
What is the output of the following program :
|
A. | 8 |
B. | 16 |
C. | Indentation Error |
D. | Runtime Error |
Answer» C. Indentation Error |
9. |
What is the output of the expression : 3*1**3 |
A. | 27 |
B. | 9 |
C. | 3 |
D. | 1 |
Answer» C. 3 |
10. |
What is the output of the following program : print '{0:.2}'.format(1.0 / 3) |
A. | 0.333333 |
B. | 0.33 |
C. | 0.333333:-2 |
D. | Error |
Answer» B. 0.33 |
11. |
What is the output of the following program : print '{0:-2%}'.format(1.0 / 3) |
A. | 0.33 |
B. | 0.33% |
C. | 33.33% |
D. | 33% |
Answer» C. 33.33% |
12. |
What is the output of the following program :
|
A. | 0 1 2 3 0 |
B. | 0 1 2 0 |
C. | 0 1 2 |
D. | Error |
Answer» B. 0 1 2 0 |
13. |
What is the output of the following program :
|
A. | 0 1 2 0 |
B. | 0 1 2 |
C. | Error |
D. | None of the above |
Answer» B. 0 1 2 |
14. |
What is the output of the following program : print 'cd'.partition('cd') |
A. | („cd‟) |
B. | (”) |
C. | („cd‟, ”, ”) |
D. | (”, „cd‟, ”) |
Answer» D. (”, „cd‟, ”) |
15. |
What is the output of the following program : print 'abcefd'.replace('cd', '12') |
A. | ab1ef2 |
B. | abcefd |
C. | ab1efd |
D. | ab12ed2 |
Answer» B. abcefd |
16. |
What will be displayed by the following code?
|
A. | 1 1 |
B. | 1 44 |
C. | 3 1 |
D. | 3 44 |
Answer» D. 3 44 |
17. |
Predict the output of following python programs
|
A. | Compilation error |
B. | Runtime error |
C. | („Google‟, 1) („Facebook‟, 2) („Youtube‟, 3) („Microsoft‟, 2) („GFG‟, 1) |
D. | None of these |
Answer» C. („Google‟, 1) („Facebook‟, 2) („Youtube‟, 3) („Microsoft‟, 2) („GFG‟, 1) |
18. |
What is the output of the following program?
|
A. | Compilation error due to duplicate keys |
B. | Runtime time error due to duplicate keys |
C. | 3 |
D. | 1 |
Answer» C. 3 |
19. |
What is the output of the following program?
|
A. | Compilation error |
B. | {„key1‟: 44, „key2‟: 566}[1, 2, 3, 4] |
C. | Runtime error |
D. | None of the above |
Answer» B. {„key1‟: 44, „key2‟: 566}[1, 2, 3, 4] |
20. |
What is the output of the following program?
|
A. | [[[2, 3, 9]], [[2, 3, 9]], [[2, 3, 9]]] |
B. | [[2, 3, 9], [2, 3, 9], [2, 3, 9]] |
C. | [[[2, 3, 9]], [[2, 3, 9]]] |
D. | None of these |
Answer» A. [[[2, 3, 9]], [[2, 3, 9]], [[2, 3, 9]]] |
21. |
What is the output of the following program?
|
A. | [0, 2, 4, 6] |
B. | [0, 2, 4] |
C. | [0, 1, 2, 3, 4, 5] |
D. | Runtime error |
Answer» B. [0, 2, 4] |
22. |
What is the output of the following program?
|
A. | [5, 2, 3, 4] [5, 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4] |
B. | [[5], 2, 3, 4] [[5], 2, 3, 4] [[5], 2, 3, 4] [1, 2, 3, 4] |
C. | [5, 2, 3, 4] [5, 2, 3, 4] [5, 2, 3, 4] [1, 2, 3, 4] |
D. | [[5], 2, 3, 4] [[5], 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4] |
Answer» D. [[5], 2, 3, 4] [[5], 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4] |
23. |
What is the output of the following program?
|
A. | 0 2 3 10 |
B. | 32 34 35 42 |
C. | 48 64 72 128 |
D. | 48 144 192 480 |
Answer» C. 48 64 72 128 |
24. |
What is the output of the following program?
|
A. | 4 0 |
B. | 5 8 |
C. | 5 IndexError |
D. | 4 1 |
Answer» B. 5 8 |
25. |
What is the output of the following program?
|
A. | 5 None [3, 7, 9] |
B. | 5 1 [3, 7, 9] |
C. | 5 1 [3, 7, 9] |
D. | 5 None [1, 3, 7, 9] |
Answer» A. 5 None [3, 7, 9] |
We're developing a website for study materials for students.
We would love to hear your answers to some of the questions.