4.7 - Control Structures
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
Write an if statement that prints 'High score' if score > 100.
💡 Hint: Remember the structure of an if statement.
Create an if-else statement that prints 'Adult' if age > 18, otherwise 'Minor'.
💡 Hint: What will be printed if age is 18 or less?
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What does the if statement do?
💡 Hint: Think about under what circumstances will the code run.
Which loop guarantees at least one execution of its code block?
💡 Hint: Consider the structure of each loop type.
1 more question available
Challenge Problems
Push your limits with advanced challenges
Write a program that takes a student's marks and prints 'Excellent' for marks above 80, 'Good' for 60 to 80, 'Satisfactory' for 40 to 60, and 'Failed' below 40 using switch-case.
💡 Hint: Remember to divide marks by 10 to categorize them into ranges.
Create a program using a while loop that reads and sums numbers until the user enters 0, then prints the total sum.
💡 Hint: You’ll need to initialize your sum value before starting the loop.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.