Practice What is the IF Statement? - 21.1.1 | 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

What is the IF Statement?

21.1.1 - What is the IF Statement?

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

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

💡 Hint: Think about how to compare the number with zero.

Question 2 Easy

Provide the ELSE part to notify if the number is not positive.

💡 Hint: Consider what needs to happen when the condition is false.

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What is the main purpose of the IF statement in programming?

To perform loops
To make decisions
To handle errors

💡 Hint: Think about the condition it checks.

Question 2

True or False: The ELSE statement is optional in an IF structure.

True
False

💡 Hint: Consider whether it's possible to have only an IF statement.

2 more questions available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Create a program that accepts user input and checks if the input number is both even and greater than 10. Provide appropriate messages for each scenario.

💡 Hint: Think about using nested IF statements for the conditions.

Challenge 2 Hard

Develop an IF-ELIF-ELSE application where the program can grade students based on their activity participation during a course. Assume participation scores are out of 100.

💡 Hint: Remember to define the function first, and then use conditions to categorize the score.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.