• 15 hours
  • Easy

Free online content available in this course.

course.header.alt.is_video

course.header.alt.is_certifying

Got it!

Last updated on 3/28/24

Check what you know about program logic!

Evaluated skills

  • Explain how to manage program logic in Java

Description

Explain how to manage program logic in Java

  • Question 1

    Which of the following techniques are used to control program flow? 

    Careful, there are several correct answers.
    • An IF/ELSE statement

    • Boolean variables and enum types 

       

    • Loops

    • Infinite loops

  • Question 2

    Look at the code snippet below: 

    int k = 11;
        int t = 16;
        if (k == t) {
            System.out.println("k and t are the same");
        }
        else if (k + 3 == t - 2) {
            System.out.println("k and t are different but we can adjust");
        }
        else {
            System.out.println("k and t are very different");
        }
    

    Which of the following will be printed as a result of this code snippet?

    • k and t are the same

    • k and t are different, but we can adjust

    • k and t are very different

    • Nothing will be printed

  • Question 3

    How many times will the for loop code be executed in the following code snippet? 

    int loopLimit = 101;
    int iterations = 0;
    for (int i=5;i< loopLimit;i++) {
        iterations += 1;
    }
    
    • 100

    • 101

    • 95

    • 96

Ever considered an OpenClassrooms diploma?
  • Up to 100% of your training program funded
  • Flexible start date
  • Career-focused projects
  • Individual mentoring
Find the training program and funding option that suits you best