NIELIT O Level M3-R5 Solved Paper

NIELIT O Level M3-R5 Solved Paper

Python MCQ

1. What will be the output after the following statements?
x = [‘Today’, ‘Tomorrow’, ‘Yesterday’]
y = x[1]
print(y)

(A) x1
(B) Tomorrow
(C) Today
(D). Yesterday

2. What is the data type of x after the following statement?
x = [‘Today’, ‘Tomorrow’, ‘Yesterday’]

(A) Dictionary
(B) Tuple
(C) List
(D). String

3. What is the name of the GUI that comes in-built as an interactive shell with Python?

(A)PGUI
(B) IDLE
(C) Pyshell
(D) PythonSh

4. What will be the value of x, y and z after the following statement?
x, y, z = 3, 4, 5

(A) All three will have the value of 3
(B) All three will have the value of 345
(C) x and y will have arbitrary values, while z will have the value of 345
(D) x will have the value of 3, y will have the value 4 and z will have the value of 5

5. IDLE stands for…?
(A) Indigenous Development Lab
(B) Integrated Developers Local Environment
(C) Indie Developers Environment
(D). Integrated Development Environment

6. Which of the following is an assignment operator in Python?
(A) = = =
(B) >>>
(C) = =
(D) =

7. The function to display a specified message on the screen is…?
(A) display
(B) run
(C) print
(D) output

8. Which of the following is used to initialize multiple variables with a common value?
(A) x = y = z = 33
(B) x = y: y = 33
(C) x = z; y = z; x = 33;
(D) x & y & z = 33

9. A user-specified value can be assigned to a variable with this function…
(A) value
(B) user
(C) enter
(D) input

10. Comments in Python begin with…?
(A) {
(B) #
(C) %
(D) *

11. User input is read as…?
(A) Floating Decimal
(B) Boolean Value
(C) Text String
(D) Integer

12. Multiple values specified in parentheses to print function will display each value separated with this by default…
(A) Double Space
(B) A new Line
(C) Single Space
(D) Double Lines

13. Output displayed by the print function will add this invisible character at the end of the line by default…
(A) \t
(B) \s
(C) \n
(D) \r

14. Which of the following will provide an! Character as alternative separator for the print function?
(A) sep is !
(B) sep = ‘!’
(C) separate = !
(D) sep >> ‘!’

15. For which type of error does the interpreter halts and reports the error but does not execute the program?
(A) Semantic error
(B) Runtime error
(C) Syntax error
(D) All type of errors

16. Which of the following will provide a * character as alternative line ending for the print function?
(A) end to *
(B) end = ‘*’
(C) end as *
(D) ending = ‘*’

17. For which type of error does the interpreter runs the program and does not report an error?
(A) Syntax error
(B) Runtime error
(C) Semantic error
(D) All type of errors

18. For which type of error does the interpreter runs the program but halts at error and reports the error as an “Exception”?
(A) Runtime error
(B) Semantic error
(C) Syntax error
(D) All type of errors

19. What will be the output after the following statements?
x = 6 
y = 3
print(x / y)

(A) 2
(B) 18
(C) 2.0
(D) 18.0

20. What will be the output after the following statements?
x = 5 y = 4 print(x % y)

(A) 0
(B) 1
(C) 20
(D) 1.0

21. What will be the output after the following statements?
x = 8
y = 2
print(x // y)

(A) 4.0
(B) 16
(C) 4
(D)16.0

22. What will be the output after the following statements?
x = 3
y = 2
x += y
print(x)

(A) 3
(B) 5
(C) 2
(D) 1

23. What will be the output after the following statements?
x = 25 y = 15 x – = y
print(x)

(A) 25
(B) 15
(C) -15
(D) 10

24. What will be the output after the following statements?
x = 30
y = 7
x %= y
print(x)

(A) 4
(B) 2
(C) 28
(D) 37

25. What will be the output after the following statements?
x = 5
y = 7
x *= y
print(x)

(A) 7
(B) 35
(C) 12
(D) 5

26. What will be the output after the following statements?
x = 3
y = 7
print(x == y)

(A) y = 7 and x = 3
(B) False
(C) True
(D) x = 3 and y = 3

27. What will be the output after the following statements?
x = 83 y = 57 print(x > y)

(A) False
(B) Yes
(C) True
(D) No

28. What will be the output after the following statements?
x = 72 y = 64 print(x < y)

(A) True
(B) Yes
(C) False
(D) No

29. What will be the output after the following statements?
x = 8
y = 6
print(x != y)

(A) y = 6 and x = 8
(B) x = 6 and y = 6
(C) False
(D) True

30. What will be the output after the following statements?
x = True
y = False
print(x and y)

(A) True
(B) Not defined
(C) False
(D) xy

31. What will be the output after the following statements?
x = True
y = False
print(x or y)

(A). False
(B) Not defined
(C) True
(D) xy

32. What will be the output after the following statements?
x = True
y = False
print(not x)

(A) True
(B) Not defined
(C) y
(D) False

33. What will be the output after the following statements?
x = 20
y = 40
z = y if (y > x) else x
print(z)

(A) True
(B) 40
(C) False
(D) 20

34. What will be the output after the following statements?
x = 50
y = 10
z = y if (y > x) else x
print(z)

(A) True
(B) 50
(C) False
(D) 10

35. What will be the output after the following statements?
x = True
y = False
print(not y)

(A) False
(B) True
(C) Not defined
(D) x

36. What will be the output after the following statements?
x = 65
y = 53 
z = y if (x % 2 == 0) else x
print(z)

(A) 65
(B) True
(C) False
(D) 53

37. What will be the output after the following statements?
x = 46
y = 98
z = y if (y % 2 == 0) else x
print(z)

(A) True
(B) 98
(C) False
(D) 46

38. What will be the output after the following statements?
x = 7 * (4 + 5)
print(x)

(A) 16
(B) 33
(C) 63
(D) 35

39. What will be the output after the following statements?
x = ’24’ + ’16’
print(x)

(A) 40
(B) 21
(C) 46
(D) 2416

40. What will be the output after the following statements?
x = 15 + 35
print(x)

(A) 40
(B) 153
(C) 1535
(D) 50

41. What will be the output after the following statements?
x = 2 * 4 + 7
print(x)

(A) 30
(B) 22
(C) 247
(D) 15

42. What will be the data type of x after the following statement if input entered is 18?
x = input(‘Enter a number: ‘)

(A) Float
(B) List
(C) Integer
(D) String

43. What will be the data type of y after the following statements?
x = 71
y = float(x)

(A) String
(B) List
(C) Float
(D) Integer

44. What will be the data type of y after the following statements if input entered are 50?
x = input(‘Enter a number: ‘)
y = int(x)

(A) Float
(B) Integer
(C) String
(D) List

45. What will be the data type of y after the following statements?
x = 48
y = str(x)

(A) Float
(B) List
(C) String
(D) Integer

46. What will be the value of x, y and z after the following statement?
x = y = z = 300

(A) All three will have the value of 3
(B) All three will have the value of 300
(C) All three will have the value of 100
(D) x and y will have arbitrary values, while z will have the value of 300

47. What will be the output after the following statements?
x = y = z = 8
print(y)

(A) x
(B) z
(C) 8
(D) y

48. Python files are saved with the extension as…?

(A) .python
(B) .pe
(C) .pi
(D) .py

49. What is the data type of x after the following statement?
x = [7, 8, 9, 10]

(A) Dictionary
(B) Tuple
(C) List
(D) String

50. Which of the following version of Python was released in December, 2015 by Python.org?

(A) 3.3
(B) 2.4
(C) 3.5.1
(D) 2.6

Relate Link