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

Syntax

21.1.2 - Syntax

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

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.

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

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.

Get performance evaluation

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

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.

Challenge 2 Hard

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.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.