1. What is the brain of the computer?
A. Memory
B. CPU
C. Monitor
D. Keyboard
Answer: B
2. Which of the following is NOT a problem-solving step?
A. Analysis
B. Designing
C. Coding
D. Guessing
Answer: D
3. A flowchart uses:
A. Figures
B. Symbols
C. Keywords
D. Commands
Answer: B
4. Pseudocode is written in:
A. Assembly language
B. English-like statements
C. Binary
D. Machine code
Answer: B
5. Which memory is volatile?
A. ROM
B. Hard disk
C. RAM
D. Pen drive
Answer: C
6. Which is NOT an I/O device?
A. Mouse
B. Printer
C. CPU
D. Keyboard
Answer: C
7. Syntax errors occur during:
A. Execution
B. Compilation
C. After Output
D. Shutdown
Answer: B
8. Machine language consists of:
A. Mnemonics
B. English words
C. High-level syntax
D. Binary codes
Answer: D
9. OOP stands for:
A. Object Oriented Programming
B. Object Operation Program
C. Ordered Object Process
D. Operational Object Program
Answer: A
10. Which is a feature of OOP?
A. Compilation
B. Debugging
C. Abstraction
D. Execution
Answer: C
11. Which paradigm follows step-by-step instructions?
A. OOP
B. Procedural
C. Functional
D. Declarative
Answer: B
12. Which binds data and methods together?
A. Inheritance
B. Polymorphism
C. Encapsulation
D. Abstraction
Answer: C
13. Python was invented by:
A. Dennis Ritchie
B. Guido van Rossum
C. James Gosling
D. Charles Babbage
Answer: B
14. Python is:
A. Compiled only
B. Interpreted only
C. Both compiled & interpreted
D. None
Answer: C
15. Which is NOT a Python token?
A. Keyword
B. Identifier
C. Operator
D. Processor
Answer: D
16. Which is immutable?
A. List
B. Dictionary
C. Tuple
D. Set
Answer: C
17. input() returns data as:
A. Integer
B. Float
C. String
D. Boolean
Answer: C
18. Which operator has highest precedence?
A. +
B. *
C. **
D. =
Answer: C
19. Identity operator in Python:
A. is
B. ==
C. !=
D. or
Answer: A
20. Which converts string to integer?
A. str()
B. int()
C. float()
D. chr()
Answer: B
21. Which loop runs until condition becomes false?
A. for
B. while
C. do-while
D. switch
Answer: B
22. Keyword to skip current iteration:
A. break
B. stop
C. continue
D. exit
Answer: C
23. Keyword that does nothing in Python:
A. empty
B. skip
C. pass
D. continue
Answer: C
24. Which is used for documentation?
A. #comment
B. “””string”””
C. ;
D. print()
Answer: B
25. Function without return value is called:
A. Void
B. Fruitful
C. Lambda
D. Recursive
Answer: A
26. A function calling itself is:
A. Composition
B. Recursion
C. Reduction
D. Instantiation
Answer: B
27. Anonymous functions are defined using:
A. def
B. lambda
C. func
D. anon
Answer: B
28. Python modules are loaded using:
A. load
B. include
C. import
D. fetch
Answer: C
29. Strings in Python are:
A. Mutable
B. Immutable
C. Changeable
D. Temporary
Answer: B
30. Which method finds substring?
A. join()
B. split()
C. find()
D. sort()
Answer: C
31. re module is used for:
A. Math
B. File handling
C. Regular expressions
D. Sorting
Answer: C
32. Which function matches from start of string?
A. search()
B. match()
C. findall()
D. sub()
Answer: B
33. File extension of binary files:
A. .txt
B. .bin
C. .py
D. .log
Answer: B
34. Which mode opens file for writing?
A. r
B. w
C. x
D. r+
Answer: B
35. Closing file is done using:
A. close()
B. exit()
C. stop()
D. quit()
Answer: A
36. To read entire file at once:
A. read()
B. readchunk()
C. readline()
D. write()
Answer: A
37. Method to change file position:
A. set()
B. seek()
C. place()
D. tell()
Answer: B
38. Which removes a file?
A. [Link]()
B. [Link]()
C. [Link]()
D. [Link]()
Answer: B
39. List is a:
A. Mutable sequence
B. Immutable set
C. Ordered dictionary
D. File object
Answer: A
40. Removing last element from list:
A. del
B. remove()
C. pop()
D. discard()
Answer: C
41. List comprehensions use:
A. []
B. {}
C. ()
D. <>
Answer: A
42. Dictionary stores data as:
A. Index
B. Key-value
C. Sequential
D. Numeric
Answer: B
43. To get list of dictionary keys:
A. keys()
B. key()
C. items()
D. values()
Answer: A
44. Set does NOT allow:
A. Numbers
B. Strings
C. Duplicates
D. Booleans
Answer: C
45. Which creates an object?
A. Class
B. Instance
C. Attribute
D. Module
Answer: B
46. Method called automatically during object creation:
A. del
B. init
C. str
D. main
Answer: B
47. Private members start with:
A. _
B. __
C. $
D. @@
Answer: B
48. Static methods use decorator:
A. @static
B. @staticmethod
C. @methodstatic
D. @class
Answer: B
49. Inheritance helps in:
A. Modifying memory
B. Code reusability
C. Faster CPU
D. Storing files
Answer: B
50. Operator overloading uses:
A. if
B. import
C. special methods
D. break
Answer: C
51. Which operator is overloaded by add()?
A. +
B. –
C. *
D. /
Answer: A
52. Exception raised manually using:
A. except
B. error
C. throw
D. raise
Answer: D
53. Default exception handler is in:
A. Python Interpreter
B. CPU
C. OS
D. Memory
Answer: A
54. finally block executes:
A. Only when error occurs
B. Only when no error occurs
C. Always
D. Never
Answer: C
55. Assertion errors raised by:
A. assert
B. require
C. check
D. test
Answer: A
56. Which of the following is NOT a valid Python data type?
A. int
B. float
C. real
D. dict
Answer: C
57. Which of the following is used to join strings?
A. +
B. &
C. *
D. %
Answer: A
58. Which string method converts all characters to uppercase?
A. upper()
B. caps()
C. capitalize()
D. big()
Answer: A
59. Which module is used for file/directory operations?
A. sys
B. os
C. file
D. fm
Answer: B
60. What type of file is .txt?
A. ASCII
B. Binary
C. Script
D. Machine
Answer: A
61. Which file mode opens a file for reading and writing?
A. r
B. w
C. r+
D. x
Answer: C
62. Method used to write multiple lines into a file:
A. writelines()
B. writeall()
C. multiline()
D. putlines()
Answer: A
63. What does tell() return?
A. Line number
B. File name
C. Current file pointer position
D. File path
Answer: C
64. Which of the following creates a tuple?
A. {}
B. []
C. ()
D. <:>
Answer: C
65. Tuples are:
A. Mutable
B. Immutable
C. Semi-mutable
D. Changeable
Answer: B
66. A set automatically removes:
A. Numbers
B. Duplicates
C. Strings
D. Floats
Answer: B
67. The zip() function returns:
A. list
B. tuple
C. iterator
D. dictionary
Answer: C
68. reduce() is found in which module?
A. functools
B. math
C. statistics
D. re
Answer: A
69. What does pop() do in a dictionary?
A. Removes last key
B. Removes key-value pair
C. Removes all data
D. Removes first element
Answer: B
70. Which concept allows objects to take many forms?
A. Abstraction
B. Polymorphism
C. Inheritance
D. Encapsulation
Answer: B
71. Which OOP concept hides internal details?
A. Encapsulation
B. Abstraction
C. Inheritance
D. Polymorphism
Answer: B
72. Which method is used to represent objects as strings?
A. init
B. str
C. repr
D. call
Answer: B
73. Which method deletes an object?
A. exit
B. init
C. destroy
D. del
Answer: D
74. Inheritance that has one parent and many children is:
A. Multiple
B. Hierarchical
C. Hybrid
D. Multilevel
Answer: B
75. In multiple inheritance, a class has:
A. One base class
B. Many base classes
C. Many derived classes
D. No classes
Answer: B
76. Composition is also called:
A. Aggregation
B. Containership
C. Inheritance
D. Delegation
Answer: B
77. A class inside another class is called:
A. Child class
B. Nested class
C. Internal class
D. Inner object
Answer: B
78. getitem() is used for:
A. Addition
B. Indexing
C. Deleting
D. Copying
Answer: B
79. setitem() is used for:
A. Accessing values
B. Assigning values
C. Comparing values
D. Merging values
Answer: B
80. call() makes an object:
A. Callable like a function
B. Non-callable
C. Iterable
D. Static
Answer: A
81. Which keyword handles exceptions?
A. raise
B. try
C. except
D. check
Answer: C
82. Which block executes when no exception occurs?
A. final
B. else
C. except
D. exit
Answer: B
83. User-defined exceptions must inherit from:
A. BaseException
B. IOError
C. SystemExit
D. ValueError
Answer: A
84. Which error is raised by assert?
A. TypeError
B. AssertionError
C. ValueError
D. KeyError
Answer: B
85. What will happen if an exception is not handled?
A. Program stops
B. Program continues
C. Program slows
D. Nothing
Answer: A
86. Regular expressions are processed using:
A. regex module
B. re module
C. match module
D. string module
Answer: B
87. Which regex method replaces text?
A. replace()
B. sub()
C. fix()
D. change()
Answer: B
88. Which metacharacter matches any character?
A. *
B. ?
C. .
D. ^
Answer: C
89. Character classes are written using:
A. ()
B. {}
C. []
D. <>
Answer: C
90. ^ symbol in regex means:
A. End of string
B. Match digits
C. Start of string
D. Replace
Answer: C
91. Which method returns an iterator of matches?
A. search()
B. findall()
C. finditer()
D. match()
Answer: C
92. Which statement opens a file automatically closes it?
A. with
B. open
C. auto
D. try
Answer: A
93. Directory creation uses:
A. [Link]
B. [Link]
C. [Link]
D. [Link]
Answer: B
94. Which retrieves file status?
A. [Link]()
B. [Link]()
C. [Link]()
D. [Link]()
Answer: B
95. CHMOD is used to change:
A. File size
B. File permissions
C. File name
D. File path
Answer: B
96. Which is NOT a keyword in Python?
A. pass
B. break
C. friend
D. continue
Answer: C
97. A dictionary is enclosed in:
A. []
B. ()
C. <>
D. {}
Answer: D
98. Which removes all items from a list?
A. delete()
B. clear()
C. remove()
D. purge()
Answer: B
99. Python code indentation uses:
A. Tabs/spaces
B. Semicolons
C. Braces
D. Commas
Answer: A
100. Who is known as the father of Python?
A. Mark Zuckerberg
B. Guido van Rossum
C. Charles Babbage
D. Tim Berners-Lee
Answer: B