Practice Types of Control Flow Statements - 3.2 | Chapter 3: Control Flow Statements | JAVA Foundation Course
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

Types of Control Flow Statements

3.2 - Types of Control Flow Statements

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 of it as a yes/no question.

Question 2 Easy

What will the following code print? int i = 2; if (i > 1) { System.out.println('Greater'); }

💡 Hint: Is 2 greater than 1?

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What is the purpose of a conditional statement?

To repeat code
To make decisions
To exit a function

💡 Hint: Consider when you need to perform different actions based on conditions.

Question 2

True or False: A while loop executes its code block at least once.

True
False

💡 Hint: Think about when the loop's condition is evaluated.

1 more question available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Write a function that takes an integer and uses a loop to return the factorial of that number.

💡 Hint: What do you multiply together to get a factorial?

Challenge 2 Hard

Using a switch statement, create a program that outputs a user's rating for a movie based on their input: 1 for bad, 2 for average, 3 for good, and 4 for excellent.

💡 Hint: How can you match each rating to a specific message?

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.