Questions from Starting Out With Java


Q: What is the advantage of using a sentinel?

What is the advantage of using a sentinel?

See Answer

Q: Describe a programming problem requiring the use of nested loops.

Describe a programming problem requiring the use of nested loops.

See Answer

Q: Why should a program close a file when it’s finished

Why should a program close a file when it’s finished using it?

See Answer

Q: When writing data to a file, what is the difference between

When writing data to a file, what is the difference between the print and the println methods?

See Answer

Q: What is a potential error that can occur when a file is

What is a potential error that can occur when a file is opened for reading?

See Answer

Q: Describe the difference between pretest loops and posttest loops.

Describe the difference between pretest loops and posttest loops.

See Answer

Q: Using the following chart, write an if-else-if

Using the following chart, write an if-else-if statement that assigns .10, .15, or .20 to commission, depending on the value in sales.

See Answer

Q: What will the following program display? public class ReviewQuestion5

What will the following program display? public class ReviewQuestion5 { public static void main(String[] args) { int x = 10; System.out.println(myMethod(x)); } public static int myMethod(int num) { if...

See Answer

Q: Describe the difference between the while loop and the do-while

Describe the difference between the while loop and the do-while loop.

See Answer

Q: Which loop should you use in situations where you want the loop

Which loop should you use in situations where you want the loop to repeat until the boolean expression is false, but the loop should execute at least once?

See Answer