Practice Syntax - 21.1.2 | 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

What does the IF statement do?

💡 Hint: Think about decision-making in programming.

Question 2

Easy

Write an example of a simple IF statement.

💡 Hint: Use your own variable to test.

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 is the primary function of an IF statement?

  • To create loops
  • To handle conditions
  • To print output

💡 Hint: Remember its role in decision-making.

Question 2

TRUE or FALSE: A WHILE loop requires a known number of iterations.

  • True
  • False

💡 Hint: Focus on the definition of WHILE.

Solve and get performance evaluation

Challenge Problems

Push your limits with challenges.

Question 1

Develop a program that uses both IF and FOR loops to count and determine if the numbers between 1 and 10 are odd or even. What should be printed?

💡 Hint: Use modulo for checking evenness.

Question 2

Create a WHILE loop that continues to subtract from a number until it reaches zero, printing each step.

💡 Hint: Watch how the condition changes with each iteration.

Challenge and get performance evaluation