MULTIPLE CHOICE QUESTIONS
- Which of the following statements about the
if condition is correct?
a. It always executes both True and False blocks
b. It executes code only if the condition is True
c. It executes code only if the condition is False
d. It ignores the condition
- In Python, the loop that executes a block of code for a given sequence is:
a. while
b. repeat
c. for
d. loop-until
- What will be the output of
range(2,10,2)?
a. [2, 4, 6, 8]
b. [2, 3, 4, 5, 6, 7, 8, 9]
c. [2, 6, 10]
d. [2, 5, 8]
- Which keyword is used to exit a loop before it finishes normally?
a. exit
b. break
c. stop
d. end
- A loop that never runs even once if the condition is False at the start is:
a. infinite loop
b. for loop
c. while loop
d. do-while loop
FILL IN THE BLANKS
- The keyword ______ is used when we want to skip the current iteration of a loop.
- The condition inside an if statement must always return a ______ value.
- The default starting value of the
range() function is ______.
- If the step value in a range is negative, the loop will count ______.
- A loop that runs exactly once is also called a ______ loop.
DESCRIPTIVE QUESTIONS
- Explain with an example how the
break and continue statements work inside loops.
- Compare entry-controlled and exit-controlled loops. Which one is Python’s
while loop?
- What happens if we forget to update the loop control variable in a
while loop? Illustrate with a small program.
- Write the difference between using
range(stop) and range(start, stop, step) with examples.
- Explain why indentation is important in Python’s if-else and loop structures. Give an example of incorrect indentation.
PROGRAMMING QUESTIONS
- Write a program that prints all even numbers between 1 and 50 using a
for loop.
- Write a Python program to calculate the sum of all numbers entered by the user until the user enters
0.
- Write a program that asks the user for a number and then displays whether it is prime or not.
- Write a Python program that takes a string input and counts the number of vowels in it using a loop.
- Write a program that prints the multiplication table of a number entered by the user (up to 10).
Answer Key – https://abhyas.co.in/2025/09/07/python-class-7-practice-questions-set-1-answer-key-if-condition-loops-range-programming-exercises/
Like this:
Like Loading...
Related