Unit-I: Introduction to Python
1. Which data type represents integers in Python?
A. bool B. int
C. float D. str
2. Which statement is used for multiple conditional checks?
A. if B. else
C. switch D. elif
3. What is the output of type(3.5)?
A. int B. str
C. float D. bool
4. Which loop is used when iterating over a sequence?
A. repeat B. while
C. do-while D. for
5. Which keyword terminates loop immediately?
A. pass B. stop
C. break D. continue
6. What does abs(-10) return?
A. Error B. 0
C. 10 D. -10
7. Which is a valid variable name?
A. value_1 B. @value
C. value-1 D. 1value
8. Which function returns data type?
A. type() B. typeof()
C. datatype() D. check()
9. Which operator is used for exponentiation?
A. * B. **
C. ^ D. %
10. Which function returns maximum value?
A. max() B. peak()
C. top() D. high()
11. What is result of 9 // 2?
A. 4.5 B. 5
C. 4 D. Error
12. Which defines block structure?
A. {} B. end
C. begin D. indentation
13. Which structure handles decision-making?
A. Module B. Loop
C. Condition D. Function
14. Which function returns minimum value?
A. small() B. min()
C. low() D. least()
15. What is bool(1)?
A. False B. Error
C. None D. True
16. Which skips current iteration?
A. pass B. break
C. skip D. continue
17. Which is a logical operator?
A. and B. &&
C. & D. !
18. What is output of 5 == 5?
A. Error B. None
C. True D. False
19. Which operator performs floor division?
A. // B. **
C. / D. %
20. Which converts string to integer?
A. int() B. str()
C. float() D. bool()
21. What does input() do?
A. Deletes data B. Converts value
C. Prints output D. Takes input
22. Which data type stores logical values?
A. bool B. str
C. int D. float
23. What stops recursion?
A. Base case B. Loop
C. Condition D. Function
24. What is recursion?
A. Condition B. Variable
C. Function calling itself D. Loop
25. Which structure repeats execution?
A. Module B. Function
C. Condition D. Loop
26. Which converts number to string?
A. bool() B. int()
C. float() D. str()
27. Which keyword returns value from function?
A. return B. break
C. stop D. exit
28. Variables inside function are:
A. Global B. Dynamic
C. Local D. Static
29. Which module handles system parameters?
A. sys B. random
C. os D. math
30. File mode for reading is:
A. w B. x
C. a D. r
31. Which function closes file?
A. close() B. stop()
C. end() D. finish()
32. Which reads single line?
A. scan() B. read()
C. readline() D. readall()
33. Which keyword modifies global variable?
A. global B. extern
C. static D. public
34. [Link] is used for:
A. Command arguments B. Loop control
C. File handling D. Debugging
35. Which supports abstraction?
A. Variable B. Loop
C. Operator D. Function
36. Module is:
A. Variable B. File
C. Loop D. Function
37. Which keyword imports module?
A. require B. import
C. include D. using
38. Which writes to file?
A. scan() B. read()
C. open() D. write()
39. Which structure repeats statements?
A. Loop B. Condition
C. Module D. Function
40. Recursion uses:
A. Heap B. Array
C. Queue D. Stack
Unit-II: Structured Types, Mutability and Higher-Order Functions
41. Which data type stores ordered and immutable values?
A. Set B. Dictionary
C. List D. Tuple
42. Which data type stores key-value pairs?
A. Set B. Dictionary
C. List D. Tuple
43. Which data type is mutable?
A. List B. Tuple
C. Integer D. String
44. Which structure allows duplicate elements?
A. Set B. Tuple
C. List D. Dictionary
45. Which method adds element at end of list?
A. extend() B. add()
C. insert() D. append()
46. Which method removes specific element from list?
A. delete() B. remove()
C. clear() D. pop()
47. Which method removes all elements from list?
A. remove() B. delete()
C. clear() D. pop()
48. Which indexing starts from last element?
A. Positive B. Zero
C. Negative D. Forward
49. Which function returns length of list?
A. size() B. len()
C. count() D. length()
50. Which method reverses list?
A. flip() B. swap()
C. reverse() D. turn()
51. Which slicing extracts part of sequence?
A. Looping B. Indexing
C. Slicing D. Iteration
52. Which data type is unordered collection?
A. Tuple B. Dictionary
C. List D. String
53. Which dictionary method returns keys?
A. items() B. get()
C. keys() D. values()
54. Which dictionary method returns values?
A. items() B. fetch()
C. values() D. keys()
55. Which function checks membership?
A. in B. contains()
C. exists() D. has()
56. Which data type is immutable?
A. Tuple B. Set
C. List D. Dictionary
57. Which method adds multiple elements to list?
A. add() B. insert()
C. append() D. extend()
58. Which function creates empty dictionary?
A. [] B. set()
C. () D. {}
59. Which data type stores characters?
A. String B. Tuple
C. List D. Set
60. Which operation joins two lists?
A. * B. +
C. & D. %
61. Which method sorts list?
A. arrange() B. align()
C. sort() D. order()
62. Which method copies list?
A. copy() B. repeat()
C. duplicate() D. clone()
63. Which function returns index of element?
A. locate() B. find()
C. search() D. index()
64. Which method counts occurrences?
A. calc() B. sum()
C. total() D. count()
65. Which allows nested structures?
A. Float B. Integer
C. List D. Boolean
66. Which structure is ordered?
A. Set B. List
C. Dictionary D. None
67. Which dictionary method removes key?
A. remove() B. clear()
C. pop() D. delete()
68. Which data type is fastest for lookup?
A. Dictionary B. Tuple
C. String D. List
69. Which supports slicing?
A. All of these B. String
C. List D. Tuple
70. Which function converts list to tuple?
A. convert() B. cast()
C. list() D. tuple()
71. Which structure is fixed size?
A. List B. Set
C. Tuple D. Dictionary
72. Which method updates dictionary?
A. replace() B. modify()
C. change() D. update()
73. Which structure stores unique elements?
A. Tuple B. Set
C. Dictionary D. List
74. Which operation repeats list?
A. + B. *
C. % D. &
75. Which converts tuple to list?
A. cast() B. convert()
C. tuple() D. list()
76. Which supports key indexing?
A. Dictionary B. List
C. Tuple D. String
77. Which method removes all dictionary items?
A. delete() B. pop()
C. clear() D. remove()
78. Which structure supports mutability?
A. Tuple B. List
C. String D. None
79. Which type is sequence?
A. Tuple B. All of these
C. List D. String
80. Functions can be treated as:
A. Constants B. Operators
C. Variables D. Objects
Unit-III: Testing, Debugging, Exceptions and Assertions
81. Which keyword is used to define a class?
A. object B. class
C. struct D. define
82. Which function is constructor in Python?
A. constructor() B. init()
C. __init__() D. start()
83. Object is an instance of:
A. Function B. Variable
C. Class D. Module
84. Which concept binds data and methods?
A. Polymorphism B. Inheritance
C. Encapsulation D. Abstraction
85. Which supports code reusability?
A. Loop B. Condition
C. Inheritance D. Variable
86. Which allows multiple forms?
A. Polymorphism B. Inheritance
C. Abstraction D. Encapsulation
87. Which hides implementation details?
A. Abstraction B. Encapsulation
C. Polymorphism D. Function
88. Which method is called automatically on object creation?
A. build() B. start()
C. __init__() D. create()
89. self refers to:
A. Function B. Module
C. Object instance D. Class
90. Which defines behavior of object?
A. Constant B. Variable
C. Attribute D. Method
91. Which stores data in class?
A. Function B. Attribute
C. Loop D. Method
92. Which access specifier is public?
A. none B. var
C. __var D. _var
93. Which is private variable?
A. public B. var
C. __var D. _var
94. Which supports method overriding?
A. Encapsulation B. Inheritance
C. Polymorphism D. Abstraction
95. Which type allows multiple inheritance?
A. Java B. C
C. None D. Python
96. Which method defines string representation?
A. print() B. __str__()
C. show() D. __repr__()
97. Which function deletes object?
A. del B. remove()
C. delete() D. clear()
98. Which method is destructor?
A. destroy() B. end()
C. close() D. __del__()
99. Which supports dynamic binding?
A. Variable B. Loop
C. Polymorphism D. Condition
100. Which creates object?
A. Module B. Class name
C. Function D. Loop
101. Which is base class?
A. Sub B. Derived
C. Child D. Parent
102. Which is derived class?
A. Child B. Super
C. Parent D. Base
103. Which operator accesses attribute?
A. . B. #
C. -> D. ::
104. Which method overloads operator?
A. plus() B. sum()
C. calc() D. __add__()
105. Which supports runtime polymorphism?
A. Function B. Overriding
C. Overloading D. Variable
106. Which defines abstract class?
A. sys module B. abc module
C. os module D. math module
107. Which decorator defines abstract method?
A. @classmethod B. @staticmethod
C. @abstractmethod D. @property
108. Which method belongs to class not instance?
A. Static method B. Object method
C. Class method D. Instance method
109. Which uses @staticmethod?
A. Constructor B. Instance method
C. Class method D. Static method
110. Which passes class as parameter?
A. Static method B. Function
C. Class method D. Instance method
111. Which supports data hiding?
A. Polymorphism B. Abstraction
C. Inheritance D. Encapsulation
112. Which method compares objects?
A. same() B. cmp()
C. __eq__() D. check()
113. Which method returns official string?
A. __repr__() B. show()
C. __str__() D. print()
114. Which allows hierarchy of classes?
A. Inheritance B. Function
C. Loop D. Variable
115. Which type has one parent many children?
A. Single B. Multiple
C. Multilevel D. Hierarchical
116. Which type has chain inheritance?
A. Hybrid B. Multiple
C. Multilevel D. Hierarchical
117. Which combines multiple types?
A. Hierarchical B. Multilevel
C. Hybrid D. Single
118. Which keyword refers parent class?
A. parent B. this
C. super D. base
119. Which creates anonymous object?
A. Class B. Loop
C. Without variable D. Function
120. Which supports modular programming?
A. All of these B. Function
C. Module D. Class
Unit-IV: Classes and Object-Oriented Programming
121. Which keyword is used for exception handling?
A. catch B. try
C. error D. handle
122. Which block handles exception?
A. catch B. except
C. try D. final
123. Which block always executes?
A. finally B. except
C. try D. catch
124. Which keyword is used to raise exception?
A. throw B. raise
C. error D. alert
125. Which type of error occurs during execution?
A. Syntax error B. Logical error
C. Compile error D. Runtime error
126. Which type of error is due to wrong logic?
A. Syntax error B. System error
C. Logical error D. Runtime error
127. Which keyword is used to define function?
A. fun B. def
C. function D. define
128. Which function returns random number?
A. rand() B. random()
C. number() D. gen()
129. Which module is used for math operations?
A. os B. math
C. calc D. sys
130. Which function generates random integer?
A. int() B. randint()
C. random() D. generate()
131. Which module works with dates?
A. time B. datetime
C. date D. sys
132. Which function returns current time?
A. time() B. gettime()
C. now() D. current()
133. Which keyword is used to import module?
A. require B. import
C. include D. using
134. Which function pauses execution?
A. hold() B. wait()
C. sleep() D. stop()
135. Which module interacts with OS?
A. sys B. math
C. time D. os
136. Which function exits program?
A. stop() B. close()
C. quit() D. exit()
137. Which handles multiple exceptions?
A. multiple except blocks B. multi except
C. double try D. nested try
138. Which keyword defines anonymous function?
A. anon B. func
C. def D. lambda
139. Lambda function returns:
A. Multiple values B. No value
C. Single expression D. Error
140. Which is built-in exception?
A. CustomError B. ValueError
C. MyError D. UserError
141. Which creates user-defined exception?
A. def B. class
C. raise D. try
142. Which block is optional in exception?
A. try B. except
C. all D. finally
143. Which is correct order?
A. try-except-finally B. except-try-finally
C. finally-try-except D. try-finally-except
144. Which error stops execution?
A. Syntax B. Logical
C. None D. Runtime
145. Which function converts string to float?
A. int() B. float()
C. str() D. bool()
146. Which module generates random float?
A. sys B. random
C. math D. os
147. Which function rounds number?
A. fix() B. floor()
C. round() D. ceil()
148. Which function returns square root?
A. sqrt() B. root()
C. power() D. sq()
149. Which module provides constants like pi?
A. os B. math
C. sys D. random
150. Which function handles division error?
A. except B. try
C. raise D. finally
151. Which keyword handles cleanup?
A. clean B. except
C. finally D. try
152. Which creates infinite loop?
A. for loop B. repeat
C. while(True) D. if loop
153. Which function checks type?
A. isinstance() B. verify()
C. check() D. type()
154. Which operator checks identity?
A. == B. is
C. != D. <>
155. Which operator checks membership?
A. is B. in
C. = D. ==
156. Which keyword skips exception?
A. ignore B. pass
C. skip D. continue
157. Which module provides system-specific parameters?
A. sys B. os
C. math D. time
158. Which function returns absolute value?
A. fabs() B. abs()
C. mod() D. absolute()
159. Which function returns power?
A. exp() B. power()
C. raise() D. pow()
160. Which function converts to integer?
A. str() B. bool()
C. float() D. int()
Unit-V: Advanced Topics
161. Which improves user experience?
A. Navigation B. All of these
C. Design D. Speed
162. Which is a search engine?
A. Chrome B. Firefox
C. Edge D. Google
163. Which protocol is used for web pages?
A. HTTP B. SMTP
C. TCP D. FTP
164. Which language is used for web structure?
A. JavaScript B. Python
C. CSS D. HTML
165. Which language styles web pages?
A. Python B. CSS
C. SQL D. HTML
166. Which language adds interactivity?
A. XML B. HTML
C. CSS D. JavaScript
167. Which tag defines hyperlink?
A. <a> B. <link>
C. <url> D. <href>
168. Which tag inserts image?
A. <img> B. <pic>
C. <image> D. <src>
169. Which attribute specifies link address?
A. src B. href
C. link D. url
170. Which tag creates table?
A. <tr> B. <th>
C. <td> D. <table>
171. Which tag defines table row?
A. <th> B. <row>
C. <tr> D. <td>
172. Which tag defines heading?
A. <title> B. <h1>
C. <head> D. <p>
173. Which tag defines paragraph?
A. <pg> B. <text>
C. <p> D. <para>
174. Which attribute defines inline style?
A. id B. font
C. class D. style
175. Which property changes text color?
A. background B. font
C. text-style D. color
176. Which property changes background color?
A. color B. background-color
C. bg D. bgcolor
177. Which unit is relative in CSS?
A. pt B. cm
C. em D. px
178. Which selector selects all elements?
A. all B. .
C. # D. *
179. Which selector uses id?
A. . B. *
C. id D. #
180. Which selector uses class?
A. # B. class
C. . D. *
181. Which HTML5 feature stores data locally?
A. Cookies B. Local Storage
C. Session D. Cache
182. Which API gives location?
A. Map API B. Geolocation
C. Location API D. GeoAPI
183. Which tag is for audio?
A. <audio> B. <sound>
C. <media> D. <music>
184. Which tag is for video?
A. <video> B. <clip>
C. <media> D. <movie>
185. Which feature allows drawing?
A. Canvas B. SVG
C. Paint D. Draw
186. Which enables real-time communication?
A. FTP B. HTTP
C. WebSockets D. SMTP
187. Which sends server updates automatically?
A. AJAX B. Fetch
C. Polling D. Server-Sent Events
188. Which improves page performance?
A. Optimization B. Styling
C. Scripts D. Images
189. Which ensures responsive design?
A. Tables B. Flexbox
C. Media Queries D. Grid
190. Which property sets font size?
A. text-size B. size
C. font-style D. font-size
191. Which protocol sends emails?
A. SMTP B. FTP
C. HTTP D. TCP
192. Which protocol receives emails?
A. FTP B. SMTP
C. HTTP D. POP3
193. Which browser renders web pages?
A. Browser B. Editor
C. Interpreter D. Compiler
194. Which stage loads HTML?
A. Rendering B. Loading
C. Parsing D. Execution
195. Which stage builds DOM?
A. Execution B. Parsing
C. Rendering D. Styling
196. Which stage applies CSS?
A. Loading B. Styling
C. Execution D. Parsing
197. Which stage executes scripts?
A. Rendering B. Styling
C. Parsing D. Execution
198. Which stage paints screen?
A. Painting B. Layout
C. Rendering D. Drawing
199. Which improves SEO?
A. All B. Speed
C. Keywords D. Design
200. Which ensures accessibility?
A. Layout B. Fonts
C. Colors D. Alt text