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?

  1. (A) Generates a list of numbers
  2. (B) Creates a sequence of numbers ✓
  3. (C) Calculates the sum of numbers
  4. (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)

  1. (A) 4
  2. (B) 5
  3. (C) 6 ✓
  4. (D) 7

3. Which method is used to add an item at the end of the list in Python?

  1. (A) insert()
  2. (B) append() ✓
  3. (C) add()
  4. (D) extend()

4. What is the purpose of control structures in programming?

  1. (A) Only to make code longer
  2. (B) To manage decision-making and repetition of tasks ✓
  3. (C) To create variables
  4. (D) To import libraries

5. Which statement is used to execute code when a condition is false?

  1. (A) if
  2. (B) elif
  3. (C) else ✓
  4. (D) while

6. How do you prevent print() from adding a newline?

  1. (A) Use end="" ✓
  2. (B) Use newline=False
  3. (C) Use break
  4. (D) Use continue

7. Which library is used to generate random numbers?

  1. (A) Datetime
  2. (B) statistics
  3. (C) random ✓
  4. (D) math

8. What does list.append() do?

  1. (A) Removes the first item
  2. (B) Adds an item to the end ✓
  3. (C) Sorts the list
  4. (D) Reverses the list

9. What is the purpose of the range() function?

  1. (A) To create a list of numbers
  2. (B) To generate a sequence of numbers ✓
  3. (C) To calculate the range of values
  4. (D) To sort numbers

10. Which debugging technique involves adding output statements?

  1. (A) Unit testing
  2. (B) Print statements ✓
  3. (C) Error messages
  4. (D) Integration testing

11. Decision making and looping are types of:

  1. (A) Input methods
  2. (B) Functions
  3. (C) Control structures ✓
  4. (D) Data types

12. Which of the following is NOT a control structure in Python?

  1. (A) if-else
  2. (B) for loop
  3. (C) while loop
  4. (D) print ✓

13. Which control structure is used to make decisions based on conditions?

  1. (A) for loop
  2. (B) if statement ✓
  3. (C) while loop
  4. (D) function call

14. Which of the following is not a conditional statement in Python?

  1. (A) if
  2. (B) if-else
  3. (C) elif
  4. (D) while ✓

15. ________ statement tests a condition and executes one block of code if condition is true and another block if it's false.

  1. (A) if
  2. (B) if-else ✓
  3. (C) test-jump
  4. (D) if-call

16. What is mandatory in Python for proper code execution?

  1. (A) Comments
  2. (B) Indentation ✓
  3. (C) Variables
  4. (D) Loops

17. Incorrect indentation in Python may cause:

  1. (A) Operator Error
  2. (B) Runtime Error
  3. (C) Indentation Error ✓
  4. (D) Logical Error

18. For num = 64, which of the following is true?

  1. (A) if (num % 14 == 0)
  2. (B) if (num % 15 == 0)
  3. (C) if (num % 16 == 0) ✓
  4. (D) if (num % 17 == 0)

19. If p = 21, which statement will be true?

  1. (A) if(p%2==0)
  2. (B) if(p%3==0) ✓
  3. (C) if(p%4==0)
  4. (D) if(p%5==0)

20. What will be the output of following code? m = 33 if m >= 33: print("Pass") else: print("Fail")

  1. (A) Fail
  2. (B) Pass ✓
  3. (C) PassFail
  4. (D) FailPass
Teacher? Make a full exam paper with solutions from this chapter in minutes. Register free.
Student? Practise every question of the book inside the app: join your class.