Table of Contents:
1. Introduction to Python
2. Basic Syntax and Variables
3. Control Structures
4. Functions
5. Data Structures
6. Object-Oriented Programming
7. Modules and Packages
8. File Handling
9. Error Handling
10. Advanced Python Topics
Chapter 1: Introduction to Python
Quiz 1: Python Basics
1. Who created Python? a) Guido van Rossum
b) James Gosling
c) Dennis Ritchie
d) Bjarne Stroustrup
2. Which year was Python created? a) 1995
b) 1989
c) 1991
d) 2000
3. What is the correct file extension for Python files? a) .pyth
b) .pt
c) .python
d) .py
Chapter 2: Basic Syntax and Variables
Quiz 2: Variables and Data Types
1. Which of the following is not a valid variable name in Python? a) var_1
b) 2var
c) _var
d) var2
2. What is the output of the following code?
, python
Copy code
x = 10
y = "10"
print(x + int(y))
a) 20
b) 1010
c) Error
d) 0
3. What is the data type of the following variable in Python?
python
Copy code
a = [1, 2, 3, 4]
a) List
b) Tuple
c) Set
d) Dictionary
Chapter 3: Control Structures
Quiz 3: Conditional Statements and Loops
1. Which of the following is the correct syntax for a while loop? a) while x > 0:
b) while (x > 0)
c) while x > 0 {}
d) do while x > 0:
2. What is the output of the following code?
python
Copy code
for i in range(1, 5):
if i == 3:
break
print(i)
a) 1 2
b) 1 2 3
c) 1 2 3 4
d) 1 2 4