Control Statement Video
Theory Questions
What are control statements in programming?
How does a “break” statement work?
What is the purpose of a “continue” statement?
Explain the concept of “nesting” in control statements.
What is the purpose of a “return” statement in functions?
How do control statements contribute to the concept of “flow control” in programming
Explain the difference between “logical AND” and “logical OR” operators.
What is the purpose of a “default” case in a “switch” statement?
How can control statements help in implementing decision-making logic in a program?
Why is proper indentation important in control statements?
Control Statement PPT
Programming Question
Write a Python program to find the sum of numbers until the user enters a negative number using a while
loop.
Implement a Python program to print even numbers between 1 and 20 using a for
loop and the continue
statement.
Write a Python program to check if a number is prime or not using a for
loop and the break
statement.
Implement a Python program to print numbers from 1 to 10 except 7 using a for
loop and the continue
statement.
Write a Python program to print the first 10 Fibonacci numbers using a while
loop.
Write a Python program to print numbers from 1 to 20, but skip numbers divisible by 3 using a for
loop and the continue
statement
Implement a Python program to find the sum of natural numbers up to 100 using a while
loop and the break
statement.
Implement a Python program to print all odd numbers between 1 and 50 using a for
loop and the continue
statement.
Implement a Python program to find the factorial of a number using a for
loop and the pass
statement.
Write a Python program to calculate the sum of digits of a given number using a recursive function
Output Questions
for i in range(1, 6):
if i == 3:
continue
print(i)
num = 7
while num > 0:
if num == 4:
break
print(num)
num -= 1
for letter in “Python”:
if letter == ‘h’:
break
print(letter)
for i in range(1, 6):
if i == 3:
pass
else:
print(i)
num = 0
while num < 5:
num += 1
if num == 3:
continue
print(num)
for i in range(1, 6):
if i == 3:
break
print(i)
else:
print(“Loop completed”)
for i in range(1, 6):
if i == 3:
print(“Found 3”)
break
print(i)
num = 10
while num > 0:
if num == 7:
continue
print(num)
num -= 1
for i in range(1, 6):
if i == 3:
pass
print(i)
for char in “Hello”:
if char == ‘l’:
continue
print(char)