Practice Control Structures - 4.7 | Chapter 4: Programming in Java | ICSE Class 12 Computer Science
K12 Students

Academics

AI-Powered learning for Grades 8–12, aligned with major Indian and international curricula.

Academics
Professionals

Professional Courses

Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.

Professional Courses
Games

Interactive Games

Fun, engaging games to boost memory, math fluency, typing speed, and English skillsβ€”perfect for learners of all ages.

games

Practice Questions

Test your understanding with targeted questions related to the topic.

Question 1

Easy

Write an if statement that prints 'High score' if score > 100.

πŸ’‘ Hint: Remember the structure of an if statement.

Question 2

Easy

Create an if-else statement that prints 'Adult' if age > 18, otherwise 'Minor'.

πŸ’‘ Hint: What will be printed if age is 18 or less?

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?

  • Executes code regardless of condition
  • Executes code only if the condition is true
  • Executes code if the condition is false

πŸ’‘ Hint: Think about under what circumstances will the code run.

Question 2

Which loop guarantees at least one execution of its code block?

  • for loop
  • while loop
  • do-while loop

πŸ’‘ Hint: Consider the structure of each loop type.

Solve 1 more question and get performance evaluation

Challenge Problems

Push your limits with challenges.

Question 1

Write a program that takes a student's marks and prints 'Excellent' for marks above 80, 'Good' for 60 to 80, 'Satisfactory' for 40 to 60, and 'Failed' below 40 using switch-case.

πŸ’‘ Hint: Remember to divide marks by 10 to categorize them into ranges.

Question 2

Create a program using a while loop that reads and sums numbers until the user enters 0, then prints the total sum.

πŸ’‘ Hint: You’ll need to initialize your sum value before starting the loop.

Challenge and get performance evaluation