Practice Syntax - 21.2.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 is the syntax for an IF statement?

💡 Hint: Recall that it begins with 'if'.

Question 2

Easy

What will this FOR loop output? for i in range(1, 4): print(i)

💡 Hint: Think about how the range function works.

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 in programming?

  • Shows a message
  • Makes a decision
  • Repeats code

💡 Hint: Think about decision-making.

Question 2

A FOR loop is used when:

  • True
  • False

💡 Hint: Recall the definition of a FOR loop.

Solve 3 more questions and get performance evaluation

Challenge Problems

Push your limits with challenges.

Question 1

Create a program that utilizes an IF statement and a FOR loop to iterate through a list of numbers and identify which are even or odd.

💡 Hint: Use the modulo operator to determine evenness or oddness.

Question 2

Write a program using a WHILE loop that will keep asking the user for a password until they enter the correct one.

💡 Hint: Set the condition to continue looping until the correct password is entered.

Challenge and get performance evaluation