Practice A. for Loop - 3.4.1 | 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

A. for Loop

3.4.1 - A. for Loop

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 a for loop to print numbers from 1 to 10.

💡 Hint: Remember to start from 1 and go up to 10.

Question 2 Easy

Modify the loop to print even numbers from 2 to 20.

💡 Hint: Think about how you can skip odd numbers.

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What does a for loop do in programming?

It executes code randomly
It repeats code a fixed number of times
It executes code only once

💡 Hint: Think about the purpose of loops.

Question 2

True or False: A for loop can iterate through an array.

True
False

💡 Hint: Recall how we've used for loops with arrays in class.

2 more questions available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Using a for loop, write a program to print a triangle of asterisks where the number of rows is provided by the user.

💡 Hint: You will need a nested loop to manage the number of asterisks in each row.

Challenge 2 Hard

Create a for loop that reverses a string provided by the user and prints it.

💡 Hint: You will iterate from the end of the string to the beginning.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.