Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What does the if statement do?
Think of it as a yes/no question.
What will the following code print? int i = 2; if (i > 1) { System.out.println('Greater'); }
Is 2 greater than 1?
What is the purpose of a conditional statement?
Consider when you need to perform different actions based on conditions.
True or False: A while loop executes its code block at least once.
Think about when the loop's condition is evaluated.
Write a function that takes an integer and uses a loop to return the factorial of that number.
What do you multiply together to get a factorial?
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.
How can you match each rating to a specific message?
5 more questions in this section. Enroll free to practise them all.
Enroll free