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

Academics

AI-Powered learning for Grades 8–12, aligned with major Indian and international curricula.

Professionals

Professional Courses

Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.

Games

Interactive Games

Fun, engaging games to boost memory, math fluency, typing speed, and English skills—perfect for learners of all ages.

Practice Questions

Test your understanding with targeted questions related to the topic.

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.

Practice 4 more questions and get performance evaluation

Interactive Quizzes

Engage in quick quizzes to reinforce what you've learned and check your comprehension.

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.

Solve 1 more question and get performance evaluation

Challenge Problems

Push your limits with challenges.

Question 1

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.

Question 2

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.

Challenge and get performance evaluation