SMG Testing System › MCQs › 10th class Computer Science and Entrepreneurship › Chapter 4
10th class Computer Science and Entrepreneurship, Chapter 4: Control Structures in Python MCQs
20 of 80 multiple-choice questions, with the correct answer in green.
1. What does the range() function do in Python?
- (A) Generates a list of numbers
- (B) Creates a sequence of numbers ✓
- (C) Calculates the sum of numbers
- (D) Prints a range of numbers
2. What is the output of the below code? count = 0 for i in range(2): for j in range(3): count += 1 print(count)
- (A) 4
- (B) 5
- (C) 6 ✓
- (D) 7
3. Which method is used to add an item at the end of the list in Python?
- (A) insert()
- (B) append() ✓
- (C) add()
- (D) extend()
4. What is the purpose of control structures in programming?
- (A) Only to make code longer
- (B) To manage decision-making and repetition of tasks ✓
- (C) To create variables
- (D) To import libraries
5. Which statement is used to execute code when a condition is false?
- (A) if
- (B) elif
- (C) else ✓
- (D) while
6. How do you prevent print() from adding a newline?
- (A) Use end="" ✓
- (B) Use newline=False
- (C) Use break
- (D) Use continue
7. Which library is used to generate random numbers?
- (A) Datetime
- (B) statistics
- (C) random ✓
- (D) math
8. What does list.append() do?
- (A) Removes the first item
- (B) Adds an item to the end ✓
- (C) Sorts the list
- (D) Reverses the list
9. What is the purpose of the range() function?
- (A) To create a list of numbers
- (B) To generate a sequence of numbers ✓
- (C) To calculate the range of values
- (D) To sort numbers
10. Which debugging technique involves adding output statements?
- (A) Unit testing
- (B) Print statements ✓
- (C) Error messages
- (D) Integration testing
11. Decision making and looping are types of:
- (A) Input methods
- (B) Functions
- (C) Control structures ✓
- (D) Data types
12. Which of the following is NOT a control structure in Python?
- (A) if-else
- (B) for loop
- (C) while loop
- (D) print ✓
13. Which control structure is used to make decisions based on conditions?
- (A) for loop
- (B) if statement ✓
- (C) while loop
- (D) function call
14. Which of the following is not a conditional statement in Python?
- (A) if
- (B) if-else
- (C) elif
- (D) while ✓
15. ________ statement tests a condition and executes one block of code if condition is true and another block if it's false.
- (A) if
- (B) if-else ✓
- (C) test-jump
- (D) if-call
16. What is mandatory in Python for proper code execution?
- (A) Comments
- (B) Indentation ✓
- (C) Variables
- (D) Loops
17. Incorrect indentation in Python may cause:
- (A) Operator Error
- (B) Runtime Error
- (C) Indentation Error ✓
- (D) Logical Error
18. For num = 64, which of the following is true?
- (A) if (num % 14 == 0)
- (B) if (num % 15 == 0)
- (C) if (num % 16 == 0) ✓
- (D) if (num % 17 == 0)
19. If p = 21, which statement will be true?
- (A) if(p%2==0)
- (B) if(p%3==0) ✓
- (C) if(p%4==0)
- (D) if(p%5==0)
20. What will be the output of following code? m = 33 if m >= 33: print("Pass") else: print("Fail")
- (A) Fail
- (B) Pass ✓
- (C) PassFail
- (D) FailPass
Student? Practise every question of the book inside the app: join your class.