0% found this document useful (0 votes)
2 views4 pages

Loops in Python

The document provides an overview of loops in Python, specifically focusing on the while and for loops, along with their functionalities and syntax. It includes multiple-choice questions, fill-in-the-blanks, true/false statements, and short and long answer questions related to looping concepts. Key points discussed include the use of the range() function, the distinction between break and continue statements, and the definition of looping.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Loops in Python

The document provides an overview of loops in Python, specifically focusing on the while and for loops, along with their functionalities and syntax. It includes multiple-choice questions, fill-in-the-blanks, true/false statements, and short and long answer questions related to looping concepts. Key points discussed include the use of the range() function, the distinction between break and continue statements, and the definition of looping.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

LOOPS IN PYTHON

1. Tick (✓) the correct option


a. What does while loop do?

✔ (ii) Repeat a chunk of code until a condition is true

L
b. The range() function is used in the _____ to iterate over the numbers.

U
✔ (i) for loop

G
c. Which statement allows repeating a task for a fixed number of times?

N
✔ (i) for loop

A
d. Which statement terminates the execution of the loop?

C
✔ (iii) break

M
2. Fill in the blanks

V
(Options: infinite, break, while, continue, non-zero)

a. The while statement executes a set of statements repeatedly until the logical expression
remains true.

b. Any non-zero value in the while loop indicates an always true condition whereas zero
indicates a false condition.

c. The infinite loop never ends.

d. The break and continue are the jump statements in Python.


3. Write ‘T’ for True and ‘F’ for False
a. We can use do-while loop in Python.​
✔F

b. The continue statement breaks the loops one by one.​


✔F

c. To come out of the infinite loop, we can either close the program window or press Ctrl + C.​

L
✔T

d. A sequence is a succession of values bound together by a single name.​


✔T

U
e. The while statement is the looping statement.​
✔T

4. Short Answer Type Questions

N G
A
a. What is looping?

Looping is the process of executing a block of statements repeatedly until a given condition

C
is satisfied.

M
b. Write the syntax of the while loop.
while condition:

V
statements

c. What is the use of jump statement?

Jump statements are used to change the normal flow of execution in a loop.​
Examples:

●​ break – exits the loop


●​ continue – skips the current iteration
5. Long Answer Type Questions
a. What is range()?

range() is a built-in function in Python used to generate a sequence of numbers.​


It is mainly used in for loop.

Example:

L
range(1, 6)

U
This generates numbers from 1 to 5.

G
b. Define the use of for statement with example.

N
The for loop is used to repeat a block of code for a fixed number of times or to iterate over a
sequence.

A
Example:

for i in range(1, 6):


print(i)

C
Output:​
1​

M
2​
3​
4​

V
5

c. Distinguish between continue and break statements.


break continue

Terminates the loop Skips current iteration


completely

Control goes outside the loop Control goes to next


iteration

Used to stop loop Used to skip a condition


6. Competency-based /
Application-based Questions
a. What construct should Riya use? Provide syntax.

Riya should use a while loop.

Syntax:

L
while condition:
statements

b. What statement should Vikram use?

Vikram should use the continue statement.

G U
N
It skips the remaining statements of the current iteration and moves to the next iteration of
the loop.

A
If you want, I can also format this as a ready-to-print answer sheet for students.

C
V M

You might also like