KEMBAR78
Control Structures Python Class8 Viva | PDF
0% found this document useful (0 votes)
7 views1 page

Control Structures Python Class8 Viva

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)
7 views1 page

Control Structures Python Class8 Viva

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
You are on page 1/ 1

Control Structures in Python – Viva Q&A; (Class

VIII, Chapter 7)
Basic Questions
1. What is a control structure in Python? → A control structure decides the flow of execution of a
program.
2. Why do we need control structures in programming? → To make decisions, repeat tasks, and
control the program flow.
3. What are the three types of control structures? → Sequential, Selection (decision-making),
Iteration (looping).
4. Define sequential execution. → Statements execute one after another in order.
5. What is decision making (selection) in Python? → Choosing different paths of execution using if,
if-else, if-elif.

Conditional Statements
6. Syntax of if statement → if condition: statement
7. How is if-else different from if? → if checks one condition, if-else gives two outcomes.
8. When do we use if-elif-else? → When more than two conditions are tested.
9. Can we write else without if? → No, else must follow if.
10. Output of: x=10 → Smaller

Looping Statements
11. What is a loop? → A loop repeats code until a condition is met.
12. Name two types of loops. → for loop, while loop.
13. Syntax of for loop → for variable in sequence: statement
14. Difference between for and while loop → for: fixed times, while: until condition true.
15. Entry-controlled loop? → Both for and while, as condition is checked before entry.
16. Example of while loop usage → Reading user input until 0 is entered.
17. Role of range() → Generates a sequence of numbers for iteration.

Jump Statements
18. Use of break → Exits loop immediately.
19. Difference between break and continue → break stops loop, continue skips current iteration.
20. Use of pass → Does nothing; placeholder.
21. Output of loop with break at 3 → 0, 1, 2

Higher Order
22. Else with loop? → Yes, runs if loop finishes without break.
23. While loop condition never false? → Infinite loop.
24. Nested loop possible? → Yes, a loop inside another loop.
25. Compare sequential, selection, iteration → Sequential: step by step; Selection: decision
making; Iteration: repetition.

You might also like