Practice IF, FOR, WHILE - 21 | 21. IF, FOR, WHILE | CBSE 9 AI (Artificial Intelligence)
Students

Academic Programs

AI-powered learning for grades 8-12, aligned with major curricula

Professional

Professional Courses

Industry-relevant training in Business, Technology, and Design

Games

Interactive Games

Fun games to boost memory, math, typing, and English skills

IF, FOR, WHILE

21 - IF, FOR, WHILE

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.

Learning

Practice Questions

Test your understanding with targeted questions

Question 1 Easy

Write an IF statement to check if a number is greater than 10.

💡 Hint: Think about how to structure a simple decision.

Question 2 Easy

What does a FOR loop allow you to do?

💡 Hint: Consider what happens when you know how many times to repeat an action.

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What does the IF statement do?

A. It allows code to repeat indefinitely.
B. It executes code based on a condition.
C. It is used for variable declarations.

💡 Hint: Think about how decisions are made in programming.

Question 2

True or False: A FOR loop is used when the number of iterations is known.

True
False

💡 Hint: Consider the difference between fixed and variable iterations.

1 more question available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Write a program that finds the largest number in a list using IF statements and a FOR loop.

💡 Hint: Think about how to compare each number to find the largest.

Challenge 2 Hard

Implement a WHILE loop that continues to prompt the user for a password until they enter the correct one.

💡 Hint: Consider how to keep asking until the correct input is received.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.