Introduction to Programming - Objective Questions & Answers
Chapter 2: Data Types and Type Conversion
1. Which of the following is a numeric data type in Python?
a) Tuple
b) String
c) Integer
d) Dictionary
Answer: c) Integer
2. Which data type is immutable in Python?
a) List
b) Tuple
c) Set
d) Dictionary
Answer: b) Tuple
3. What will bool(0) return in Python?
a) True
b) False
c) 0
d) None
Answer: b) False
4. Which function is used for explicit type casting to an integer in Python?
a) str()
b) int()
c) float()
d) bool()
Answer: b) int()
5. What is the result of type('Hello') in Python?
a) int
b) str
c) list
d) char
Answer: b) str
Chapter 3: Algorithms and Flowcharts
6. Which of these is a characteristic of a good algorithm?
a) It must have a clear and definite end
b) It should contain infinite loops
c) It must always use recursion
d) It should be complex
Answer: a) It must have a clear and definite end
7. Which symbol represents a decision step in a flowchart?
a) Rectangle
b) Diamond
c) Oval
d) Arrow
Answer: b) Diamond
8. What does an oval symbol in a flowchart represent?
a) Input/output
b) Decision
c) Start/End
d) Process
Answer: c) Start/End
9. Which of the following is an example of an algorithm type?
a) Flowchart
b) Sorting
c) Pseudo-code
d) Diagram
Answer: b) Sorting
10. What is the purpose of a flowchart?
a) To execute Python code
b) To graphically represent an algorithm
c) To store data in a program
d) To convert high-level code to machine code
Answer: b) To graphically represent an algorithm
Chapter 4: Control Statements
11. Which of the following is a conditional statement in Python?
a) for
b) if
c) while
d) loop
Answer: b) if
12. Which statement is used to exit a loop in Python?
a) pass
b) continue
c) break
d) skip
Answer: c) break
13. Which loop executes at least once before checking the condition?
a) for
b) while
c) do-while
d) nested
Answer: c) do-while
14. Which keyword is used for multiple conditions in Python?
a) elseif
b) else if
c) elif
d) otherwise
Answer: c) elif
15. What will be the output of the following code?
for i in range(3):
print(i)
a) 1 2 3
b) 0 1 2
c) 0 1 2 3
d) 1 2
Answer: b) 0 1 2