Practice Syntax - 21.3.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

Write an IF statement to check if a number is positive.

💡 Hint: What do you compare the number against?

Question 2

Easy

Create a FOR loop to print the first five letters of the alphabet.

💡 Hint: What string contains the letters?

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 an IF statement do?

  • It performs a loop
  • It checks a condition
  • It assigns a value

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

Question 2

True or False: A FOR loop can run forever.

  • True
  • False

💡 Hint: Consider how the iterations are controlled.

Solve 2 more questions and get performance evaluation

Challenge Problems

Push your limits with challenges.

Question 1

Create a program that takes user input until a specific answer is given, implementing both IF and WHILE logic.

💡 Hint: What condition will let you exit the loop?

Question 2

Write a program that categorizes numbers into positive, negative, or zero using nested IF statements within a WHILE loop.

💡 Hint: What iterative method will keep asking for input until you break out?

Challenge and get performance evaluation