1. What is Python?

A) Operating System
B) Programming Language
C) Database
D) Browser
Answer: B

2. Who created Python?

A) James Gosling
B) Dennis Ritchie
C) Guido van Rossum
D) Bjarne Stroustrup
Answer: C

3. Which symbol is used for comments in Python?

A) //
B) #
C) /* */
D) —
Answer: B

4. Which function displays output on the screen?

A) input()
B) display()
C) print()
D) show()
Answer: C

5. Which function takes user input?

A) print()
B) get()
C) scan()
D) input()
Answer: D

6. Which of the following is a valid variable name?

A) 2name
B) my-name
C) my_name
D) class
Answer: C

7. What is the output of print(5 + 3)?

A) 53
B) 8
C) 2
D) Error
Answer: B

8. Which data type is used for text?

A) int
B) float
C) str
D) bool
Answer: C

9. What is the data type of 10?

A) float
B) str
C) bool
D) int
Answer: D

10. What is the data type of 10.5?

A) float
B) int
C) str
D) bool
Answer: A

11. Which keyword defines a function?

A) function
B) define
C) def
D) func
Answer: C

12. Which operator is used for multiplication?

A) x
B) *
C) %
D) &
Answer: B

13. What does % represent?

A) Addition
B) Division
C) Modulus
D) Exponent
Answer: C

14. Which operator is used for exponentiation?

A) ^
B) **
C) //
D) %%
Answer: B

15. What is the output of print(10 // 3)?

A) 3.33
B) 4
C) 3
D) 1
Answer: C

16. Which value represents True?

A) 0
B) False
C) 1
D) None
Answer: C

17. What is the output of type("Hello")?

A) int
B) float
C) str
D) string
Answer: C

18. Which collection is ordered and changeable?

A) Set
B) Tuple
C) Dictionary
D) List
Answer: D

19. Which brackets define a list?

A) {}
B) []
C) ()
D) <>
Answer: B

20. Which brackets define a tuple?

A) []
B) {}
C) ()
D) <>
Answer: C

21. Which brackets define a dictionary?

A) {}
B) []
C) ()
D) <>
Answer: A

22. What is the output of len("Python")?

A) 5
B) 6
C) 7
D) 8
Answer: B

23. Which statement is used for decision making?

A) for
B) while
C) if
D) def
Answer: C

24. Which keyword is used with if for another condition?

A) else if
B) elif
C) elseif
D) ifelse
Answer: B

25. Which keyword executes when all conditions are false?

A) end
B) stop
C) else
D) break
Answer: C

26. Which loop repeats a fixed number of times?

A) if
B) while
C) for
D) try
Answer: C

27. Which loop continues while a condition is true?

A) while
B) for
C) if
D) switch
Answer: A

28. Which keyword exits a loop?

A) continue
B) stop
C) break
D) exit
Answer: C

29. Which keyword skips the current iteration?

A) continue
B) pass
C) break
D) next
Answer: A

30. Which keyword does nothing?

A) null
B) pass
C) skip
D) none
Answer: B

31. What is the output of print(True and False)?

A) True
B) False
C) 1
D) Error
Answer: B

32. What is the output of print(True or False)?

A) True
B) False
C) Error
D) None
Answer: A

33. Which operator means “equal to”?

A) =
B) ==
C) ===
D) :=
Answer: B

34. Which operator means “not equal to”?

A) <>
B) !=
C) ~=
D) ><
Answer: B

35. Which function converts text to integer?

A) str()
B) float()
C) int()
D) bool()
Answer: C

36. Which function converts a number to string?

A) text()
B) str()
C) string()
D) char()
Answer: B

37. What is the output of print(2 * 3)?

A) 5
B) 6
C) 23
D) 8
Answer: B

38. What is the output of print("Hi" * 2)?

A) Hi2
B) HiHi
C) Error
D) 4
Answer: B

39. What is the first index in a Python list?

A) 1
B) -1
C) 0
D) 2
Answer: C

40. What is the last index of [1,2,3]?

A) 1
B) 2
C) 3
D) 0
Answer: B

41. Which method adds an item to a list?

A) insert()
B) add()
C) append()
D) push()
Answer: C

42. Which method removes the last item from a list?

A) delete()
B) pop()
C) remove()
D) clear()
Answer: B

43. Which method sorts a list?

A) order()
B) arrange()
C) sort()
D) rank()
Answer: C

44. Which method reverses a list?

A) reverse()
B) backward()
C) invert()
D) flip()
Answer: A

45. Which keyword creates a class?

A) object
B) class
C) struct
D) define
Answer: B

46. What does OOP stand for?

A) Object Oriented Programming
B) Online Object Program
C) Open Operator Process
D) Output Oriented Programming
Answer: A

47. Which file extension is used for Python files?

A) .java
B) .cpp
C) .py
D) .html
Answer: C

48. Which built-in function finds the maximum value?

A) high()
B) max()
C) maximum()
D) top()
Answer: B

49. Which built-in function finds the minimum value?

A) min()
B) low()
C) minimum()
D) bottom()
Answer: A

50. Which function returns the absolute value?

A) abs()
B) absolute()
C) fabs()
D) value()
Answer: A

51. Which keyword is used to import modules?

A) include
B) using
C) import
D) require
Answer: C

52. Which module is used for mathematical functions?

A) math
B) calc
C) numbers
D) arithmetic
Answer: A

53. What is the output of round(3.7)?

A) 3
B) 4
C) 3.7
D) Error
Answer: B

54. Which value is Boolean?

A) “True”
B) TRUE
C) True
D) true
Answer: C

55. Which keyword handles exceptions?

A) catch
B) except
C) error
D) handle
Answer: B

56. Which block is used with except?

A) try
B) check
C) test
D) verify
Answer: A

57. Which method converts text to lowercase?

A) lower()
B) small()
C) down()
D) lowercase()
Answer: A

58. Which method converts text to uppercase?

A) upper()
B) caps()
C) uppercase()
D) big()
Answer: A

59. What is the output of "Python".upper()?

A) python
B) PYTHON
C) Python
D) Error
Answer: B

60. Which method removes whitespace?

A) trim()
B) strip()
C) clean()
D) remove()
Answer: B

61. What is the output of len([1,2,3])?

A) 2
B) 3
C) 4
D) Error
Answer: B

62. Which keyword returns a value from a function?

A) output
B) yield
C) return
D) send
Answer: C

63. Which keyword creates an anonymous function?

A) lambda
B) func
C) anon
D) def
Answer: A

64. What is a dictionary made of?

A) Values only
B) Keys only
C) Key-value pairs
D) Numbers only
Answer: C

65. Which method gets dictionary keys?

A) keys()
B) getkeys()
C) key()
D) values()
Answer: A

66. Which method gets dictionary values?

A) value()
B) values()
C) getvalues()
D) data()
Answer: B

67. What is the output of 5 > 3?

A) False
B) True
C) 5
D) 3
Answer: B

68. Which keyword deletes a variable?

A) remove
B) delete
C) del
D) erase
Answer: C

69. Which data type is immutable?

A) List
B) Dictionary
C) Set
D) Tuple
Answer: D

70. Which collection contains unique values?

A) List
B) Tuple
C) Set
D) String
Answer: C

71. Which method adds an element to a set?

A) append()
B) insert()
C) add()
D) push()
Answer: C

72. What is the output of bool(0)?

A) True
B) False
C) 0
D) Error
Answer: B

73. What is the output of bool(1)?

A) True
B) False
C) 1
D) Error
Answer: A

74. Which operator checks membership?

A) in
B) is
C) ==
D) =>
Answer: A

75. What does in do?

A) Assignment
B) Membership Test
C) Comparison
D) Loop Exit
Answer: B

76. Which operator checks object identity?

A) ==
B) equals
C) is
D) in
Answer: C

77. Which function creates a sequence of numbers?

A) list()
B) range()
C) sequence()
D) numbers()
Answer: B

78. What is the output of list(range(3))?

A) [1,2,3]
B) [0,1,2]
C) [0,1,2,3]
D) [1,2]
Answer: B

79. Which keyword defines inheritance?

A) inherits
B) extends
C) class
D) No keyword needed
Answer: D

80. Which method opens a file?

A) open()
B) file()
C) read()
D) load()
Answer: A

81. Which mode opens a file for reading?

A) w
B) a
C) r
D) x
Answer: C

82. Which mode opens a file for writing?

A) w
B) r
C) a
D) rw
Answer: A

83. Which method reads file content?

A) get()
B) read()
C) fetch()
D) input()
Answer: B

84. Which method writes to a file?

A) save()
B) put()
C) write()
D) append()
Answer: C

85. Which keyword closes a file automatically?

A) auto
B) using
C) with
D) close
Answer: C

86. What is Python primarily known for?

A) Complex Syntax
B) Readability
C) Hardware Design
D) Networking Only
Answer: B

87. Python is:

A) Compiled only
B) Interpreted
C) Machine Language
D) Assembly Language
Answer: B

88. Which company created Python?

A) Microsoft
B) Apple
C) Google
D) None of these
Answer: D

89. Which symbol is used for assignment?

A) ==
B) :=
C) =
D) =>
Answer: C

90. What is the output of print(4 == 4)?

A) True
B) False
C) 4
D) Error
Answer: A

91. Which method removes a specific list item?

A) pop()
B) remove()
C) delete()
D) clear()
Answer: B

92. Which method removes all list items?

A) empty()
B) removeall()
C) clear()
D) delete()
Answer: C

93. Which function calculates the sum of values?

A) total()
B) add()
C) sum()
D) plus()
Answer: C

94. Which function counts items in an iterable?

A) count()
B) len()
C) size()
D) length()
Answer: B

95. What is the output of print(not True)?

A) True
B) False
C) None
D) Error
Answer: B

96. Which keyword creates a generator?

A) return
B) yield
C) generate
D) next
Answer: B

97. Which built-in function sorts iterable data?

A) sorted()
B) sort()
C) arrange()
D) order()
Answer: A

98. What is the output of type(True)?

A) int
B) str
C) bool
D) float
Answer: C

99. Python supports:

A) Procedural Programming
B) Object-Oriented Programming
C) Functional Programming
D) All of the above
Answer: D

100. Which version of Python is recommended today?

A) Python 1.x
B) Python 2.x
C) Python 3.x
D) Python 0.x
Answer: C