Python Revision Tour MCQ
Python Revision Tour MCQ
(a) 0.0
(b) 0
(c) 1.0
(d) 1
9. The expression 8/4/2 will evaluate equivalent to which of the following expressions:
(a) 8/(4/2)
(b) (8/4)/2
10. Which among the following list of operators has the highest precedence?
+ , -, **, %, /, << , >>, |
(a) <<, >>
(b) **
(c) |
(d) %
12. Which of the following statement prints the shown output below?
hello\example\test.txt
(a) print("hello\example\test.txt")
(b) print("hello\\example\\test.txt")
(c) print("hello\"example \"test.txt")
(d) print("hello"\example"\test.txt")
13. Which value type does input() return?
(a) Boolean
(b) String
(c) Int
(d) Float
15. Which of the following four code fragments will yield following output?
Eina
Mina
Dika
20. Following set of commands is executed in shell, what will be the output?
>>>str = "hello"
>>>str[ : 2]
>>>
(a) he
(b) lo
(c) olleh
(d) hello
(a) 11 15 16
(b) 11 16 15
(c) 11 15 15
(d) 16 11 15
41. The process of arranging the array elements in a specified order is termed as:
(a) Indexing
(b) Slicing
(c) Sorting
(d) Traversing
42. Which of the following Python functions is used to iterate over a sequence of number
by specifying a numeric end value within its parameters?
(a) range()
(b) len()
(c) substring()
(d) random()
(b)
a
b
c
(c)
0
a
1
b
2
c
(d)
2
a
2
b
2
c
46. What will be the output when the following code is executed?
>>> str1="helloworld"
>>> stri[:-1]
(a) dlrowolleh
(b) hello
(c) world
(d) helloworld
1. b
2. a
3. b
4. d
5. b
6. b
7. b
8. c
9. b
10. b
11. d
12. b
13. b
14. b, c
15. c
16. a
17. c
18. b
19. c
20. a
21. a
22. d
23. d
24. a
25. a, b, e
26. b, d
27. c
28. c
29. d
30. c
31. c
32. a
33. a
34. d
35. b
36. d
37. a
38. b
39. d
40. b
41. c
42. a
43. a
44. c
45. c
46. a
47. a
48. c
49. a
50. a