Introduction MCQs
- What type of language is Python?
a) Compiled
b) Interpreted
c) Assembly
d) Machine
Answer: b) Interpreted - Who created Python?
a) James Gosling
b) Guido van Rossum
c) Bjarne Stroustrup
d) Dennis Ritchie
Answer: b) Guido van Rossum
Basics MCQs
- What is the output of 3 ** 2?
a) 6
b) 9
c) 8
d) 5
Answer: b) 9 - Which keyword is used to define a function?
a) func
b) def
c) function
d) define
Answer: b) def - What does the 'and' operator do?
a) Returns True if one operand is True
b) Returns True if both operands are True
c) Returns True if both are False
d) Negates the operand
Answer: b) Returns True if both operands are True
Intermediate MCQs
- Which method adds an item to the end of a list?
a) insert()
b) append()
c) add()
d) push()
Answer: b) append() - What is the correct way to create a tuple?
a) [1, 2, 3]
b) (1, 2, 3)
c) {1, 2, 3}
d) 1, 2, 3
Answer: b) (1, 2, 3) - How to access a dictionary value?
a) dict.key
b) dict['key']
c) dict(key)
d) dict::key
Answer: b) dict['key']
Advanced MCQs
- What keyword defines a class?
a) def
b) class
c) object
d) init
Answer: b) class - Which exception is raised for division by zero?
a) ValueError
b) TypeError
c) ZeroDivisionError
d) IndexError
Answer: c) ZeroDivisionError - What does Pandas DataFrame represent?
a) A 1D array
b) A 2D table
c) A list
d) A dictionary
Answer: b) A 2D table