These questions are designed to reflect the
type of content you might encounter in
quizzes, exams, or practice assessments for
the course.
Chapter 1: Introduction to Computers and Programming
1. Question: What is the main purpose of programming?
o Answer: The main purpose of programming is to create software that instructs a
computer to perform specific tasks or solve problems.
2. Question: What is a variable?
o Answer: A variable is a named storage location in memory that holds a value which can
be changed during program execution.
Chapter 2: Data Types and Expressions
3. Question: What are the basic data types in Python?
o Answer: The basic data types in Python include integers (int), floating-point numbers
(float), strings (str), and booleans (bool).
4. Question: What will be the output of the following code? Chapter 1: Introduction to Computers
and Programming
5. Question: What is the main purpose of programming?
6. Answer: The main purpose of programming is to create software that instructs a computer to
perform specific tasks or solve problems.
7. Question: What is a variable?
8. Answer: A variable is a named storage location in memory that holds a value which can be
changed during program execution.
9. Chapter 2: Data Types and Expressions
10. Question: What are the basic data types in Python?
11. Answer: The basic data types in Python include integers (int), floating-point numbers (float),
strings (str), and booleans (bool).
, 12. Question: What will be the output of the following code?
13. python
14. Copy code
15. x = 10
16. y = 5
17. print(x + y)
18. Answer: The output will be 15.
19. Chapter 3: Control Structures
20. Question: What is the purpose of an if statement?
21. Answer: An if statement allows the program to execute a block of code only if a specified
condition is true.
22. Question: Write a for loop that prints the numbers 1 to 5.
23. Answer:
24. python
25. Copy code
26. for i in range(1, 6):
27. print(i)
28. Chapter 4: Functions
29. Question: What is a function?
30. Answer: A function is a reusable block of code that performs a specific task and can take inputs
(parameters) and return outputs.
31. Question: What will be the output of this function call?
32. python
33. Copy code
34. def add(a, b):
35. return a + b
36.
37. print(add(3, 4))
38. Answer: The output will be 7.