Practice Syntax - 21.2.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.2.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 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.

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

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.

3 more questions available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

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.

Challenge 2 Hard

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.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.