Skip to main content

Unit 2 · Selection and Iteration

Nested Loops

Nested Loops MCQ Practice

Question 1 of 15

Answered 0 of 15

Choose one answer.

What is printed by the following code segment?

public class NestedLoopsContext
{
    public static void runExample()
    {
        for (int r = 1; r <= 2; r++)
        {
            for (int c = 1; c <= 3; c++)
            {
                System.out.print(r);
            }
        }
    }

    public static void main(String[] args)
    {
        runExample();
    }
}
Choose one answer.