NIELIT O Level M3-R5 Solved Paper 1

NIELIT O Level M3-R5 Solved Paper 1

Python MCQ

1. What will be the output after the following statements?
x = {1:’Jan’, 2:’Feb’, 3:’March’, 4:’April’}
print(x[2])
[A] Jan
[B] March
[C] April
[D] Feb

2. What is the famous one-line Hello World program of Python?
[A] print “Hello World!”
[B] print(“Hello World!”)!
[C] print(“Hello World!”)
[D] print(“Hello World!”):

3. What type of error will be shown after the following statement?
a = b
[A] SyntaxError
[B] NameError
[C] TypeError
[D] ValueError

4. Which of the following has only unique values?
[A] Set
[B] List
[C] Dictionary
[D] Tuple

5. Which of the following is immutable (values that cannot be changed)?
[A] List
[B] Tuple
[C] Dictionary
[D] Set

6. Which of the following is used to add an invisible tab character to the output?
[A] \tab
[B] \t
[C] \a
[D] \b

7.Who is the creator of Python?
[A] Bill Gates
[B] Jeff Bezos
[C] Guido Van Rossum
[D] Larry Page

8. Python language was named after?
पायथन भाषा का नाम किसके नाम पर पड़ा?
[A] Python – the reptile
[B] A pet
[C] A company
[D] Monty Python

9. What will be the output after the following statement?
print(‘2\\t4’)

[A] 2 t 4
[B] 2 4
[C] 2 tab 4
[D] 2\t4

10. In IDLE shell, what is the keyboard shortcut for the next command in history on Windows/Linux?
[A] Page Down
[B] Alt + N
[C] Page Up
[D] Ctrl + N

11. In IDLE file editor, what is the keyboard shortcut for executing the program in shell?
[A] F1
[B] Shift
[C] Alt
[D] F5

12. Which of the following function can be used to find the data type of a variable?
[A] data()
[B] true()
[C] str()
[D] type()

13. What will be the data type of x after the following statement?
x = False
[A] List
[B] Boolean
[C] String
[D] Dictionary

14. What will be the data type of x after the following statement?
x = [2016, ‘Leap Year’, ‘True’]
[A] String
[B] List
[C] Dictionary
[D] Boolean

15. What will be the data type of x after the following statement?
x = {2015, 2016, 2017, 2018}
[A] List
[B] Dictionary
[C] Set
[D] Tuple

16. What will be the data type of x after the following statement?
x = {‘lang’ :’Python’, ‘version’ : ‘3’}
[A] List
[B] Dictionary
[C] Set
[D] Tuple

17. In IDLE shell, what is the keyboard shortcut for the previous command in history on Windows/Linux?
[A] Alt + P
[B] Page Down
[C] Page Up
[D] Ctrl + P

18. What will be the data type of x after the following statement?
x = ‘Python 3 Test’
[A] List
[B] Dictionary
[C] Tuple
[D] String

19. What will be the data type of x after the following statement?
x = (34, 81, 50)
[A] List
[B] Tuple
[C] String
[D] Dictionary

20. What will be the output after the following statements?
x = [4, 0, 7]
y = float(x[0] + x[2])
print(y)
[A] 11
[B] 47.0
[C] 47
[D] 11.0

21. What will be the output after the following statements?
x = [4, 0, 7] 
y = str(x[0]) + str(x[1])
print(y)
[A] 11
[B] 4
[C] 7
[D] 40

22. What will be the output after the following statements?
x = [5, 3, 6, 2, 4, 0, 7]
del x[:]
print(x)
[A] [5, 3, 6, 2, 7]
[B] [5, 3, 6, 2, 4, 0]
[C] []
[D] [4, 0, 7]

23. What will be the output after the following statements?
x = [5, 3, 6, 2, 4, 0, 7]
del x[0:4]
print(x)
[A] [4, 0, 7]
[B] []
[C] [5, 3, 6, 2, 7]
[D] [5, 3, 6, 2, 4, 0]

24. What will be the output after the following statements?
x = [5, 3, 6, 2, 4, 0, 7]
del x[0:7] 
print(x)
[A] [5, 3, 6, 2, 4, 0, 7]
[B] []
[C] [5, 3, 6, 2, 4, 0]
[D] [3, 6, 2, 4, 0]

25. What will be the output after the following statements?
x = [5, 3, 6, 2, 4, 0, 1]
del x[2:3]
print(x)
[A] [5, 3, 6, 4, 0, 1]
[B] [5, 6, 2, 4, 0, 1]
[C] [5, 3, 2, 4, 0, 1]
[D] [5, 4, 0, 1]

26. What will be the output after the following statements?
x = [25, 35, 53, 25, 52, 35, 25]
del x[3]
print(x)
[A] [25, 5, 5, 25, 52, 5, 25]
[B] [35, 53, 52, 35]
[C] [25, 35, 53, 52, 35, 25]
[D] [25, 35, 53, 25, 52, 35, 25]

27. What will be the output after the following statements?
x = [25, 35, 53, 25, 52, 35, 25]
len(x)
print(x)
[A] 25
[B] [25, 35, 53, 25, 52, 35, 25]
[C] 5
[D] 7

28. What will be the output after the following statements?
x = [25, 35, 53, 25, 52, 35, 25]
print(len(x))
[A] 7
[B] 25
[C] 5
[D] 35

29. What will be the output after the following statements?
x = [25, 35, 53, 25, 52, 35, 25]
print(x.count(25))
[A] 25
[B] 53
[C] 3
[D] 35

30. What will be the output after the following statements?
x = [25, ‘Today’, 53, ‘Sunday’, 15]
x.reverse() 
print(x)
[A] [‘Today’, ‘Sunday’, 15, 25, 53]
[B] [15, 25, 53, ‘Sunday’, ‘Today’]
[C] [15, 25, 53, ‘Today’, ‘Sunday’]
[D] [15, ‘Sunday’, 53, ‘Today’, 25]

31. What will be the output after the following statements?
x = [’25’, ‘Today’, ’53’, ‘Sunday’, ’15’]
x.sort()
print(x)
[A] [’15’, ’25’, ’53’, ‘Sunday’, ‘Today’]
[B] [‘Today’, ‘Sunday’, ’15’, ’25’, ’53’]
[C] [‘Sunday’, ‘Today’, ’15’, ’25’, ’53’]
[D] [’15’, ’25’, ’53’, ‘Today’, ‘Sunday’]

32. What will be the output after the following statements?
x = [25, 14, 53, 62, 11]
x.sort()
print(x)
[A] [25, 14, 53, 62, 11]
[B] [62, 53, 25, 14, 11]
[C] [11, 14, 25, 53, 62]
[D] [25, 53, 62, 14, 11]

33. What will be the output after the following statements?
x = [5, 4, 3, 2, 1]
x.reverse()
print(x)
[A] [0, 1, 2, 3, 4, 5]
[B] [1, 2, 3, 4, 5]
[C] [0, 5, 4, 3, 2, 1]
[D] [5, 4, 3, 2, 1, 0]

34. What does the following statement do?
import  random
[A] Imports a random module from a list of modules
[B] Imports the random module
[C] Imports the random function
[D] Imports the directory named random

35. What will be the output after the following statements?
x = [5, 4, 3, 2, 1]
y = [10,  5, 0]
x.extend(y)
print(y)
[A] [5, 4, 3, 2, 1, 10, 5, 0]
[B] []
[C] [10, 5, 0]
[D] [10, 5, 0, 5, 4, 3, 2, 1]

36. What type of error is shown when you use a variable without assigning an initial value?
[A] Not declared
[B] Not assigned
[C] Not defined
[D] Not a variable

37. What will be the output after the following statements?
x = [5, 4, 3, 2, 1]
x.extend(x)
print(x)
[A] [5, 4, 3, 2, 1]
[B] [5, 4, 3, 2, 1, 5, 4, 3, 2, 1]
[C] []
[D] [1, 2, 3, 4, 5]

38. What will be the output after the following statements?
x = [5, 4, 3, 2, 1]
print(x.index(1))
[A] 3
[B] 2
[C] 4
[D] 1

39. What does the following statements do?
import sys
print(sys.executable)
[A] Displays the Python version
[B] Displays the operating system version
[C] Displays the date and time
[D] Displays the location of the Python interpreter

40. What will be the output after the following statements?
x = [5, 4, 3, 2]
x.remove(2)
print(x)
[A] [5, 3, 2]
[B] [5, 4, 2]
[C] [3, 2]
[D] [5, 4, 3]

41. What will be the output after the following statements?
x = [5, 4, 3, 2]
x.insert(1, 0)
print(x)
[A] [5, 1, 3, 2, 0]
[B] [0, 5, 4, 3, 2]
[C] [5, 0, 4, 3, 2]
[D] [1, 5, 4, 3, 2]

42. What will be the output after the following statements?
x = [5, 4, 3, 2]
x.append(1)
print(x)
[A] [5, 4, 3, 2]
[B] [5, 4, 3, 2, 1]
[C] 5, 4, 3, 2, 1
[D] 5432

43. What will be the output after the following statements?
x = [5, 4, 3, 2]
print(x)
[A] 5, 4, 3, 2
[B] 5432
[C] [5, 4, 3, 2]
[D] (5, 4, 3, 2)

44. What will be the output after the following statements?
x = [15, 45, 85, 95]
print(x[3]-x[1])
[A] 30
[B] 50
[C] 40
[D] 10

45. What will be the output after the following statements?
x = 3
y = 4
print(x*y)
[A] 3
[B] 12
[C] 4
[D] 3 4

46. What type of language is Python?
[A] Low level
[B] Top level
[C] High level
[D] Bottom level

47. What does the following statements do?
from datetime import *
print(datetime.today().strftime(‘%A’))
[A] Displays the full weekday name
[B] Displays the full month name
[C] Displays the abbreviated month name
[D] Displays the abbreviated day name

48. What will be the output after the following statements?
x = [‘Sunday’, ‘Monday’, ‘Tuesday’]
y = x[1] + x[2]
print(y)
[A] SundayMonday
[B] SunMonday
[C] MondayTuesday
[D] Monday Tuesday

49. What will be the output after the following statements?
x = [10, 20, 30]
y = x[1]  + x[2]
print(y)
[A] 20
[B] 50
[C] 30
[D] 40

50. What will be the output after the following statements?
x = [25, 35, 45]
y = x[0]
print(y)
[A] x0
[B] 35
[C] 45
[D] 25

Relate Link