Exam 3: Flow of Control

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

When the number of repetitions are known in advance,you should use a ___________ statement.

Free
(Multiple Choice)
4.7/5
(33)
Correct Answer:
Verified

C

The negation operator in Java is represented by:

Free
(Multiple Choice)
5.0/5
(40)
Correct Answer:
Verified

A

Discuss the differences between the break and the continue statements when used in looping mechanisms.

Free
(Essay)
4.9/5
(43)
Correct Answer:
Verified

When the break statement is encountered within a looping mechanism,the loop immediately terminates.When the continue statement is encountered within a looping mechanism,the current iteration is terminated,and execution continues with the next iteration of the loop.

What would be the output of the code in #1 if number was originally initialized to 25?

(Short Answer)
4.8/5
(31)

The for statement,do…while statement and while statement are examples of branching mechanisms.

(True/False)
4.7/5
(38)

When choosing a sentinel value,you should choose a value that would never be encountered in the input of the program.

(True/False)
4.8/5
(34)

What is the output of the following code segment? public static void main(String[] args) { int x = 5; System.out.println("The value of x is:" + x); while(x > 0) { x++; } System.out.println("The value of x is:" + x); }

(Essay)
4.9/5
(33)

Evaluate the Boolean equation: !( ( 6 < 5)&& (4 < 3))

(True/False)
4.9/5
(37)

Discuss the rules Java follows when evaluating expressions.

(Essay)
4.8/5
(34)

The equality operator (==)may be used to test if two string objects contain the same value.

(True/False)
4.9/5
(42)

In a switch statement,the default case is always executed.

(True/False)
4.9/5
(29)

A mixture of programming language and human language is known as:

(Multiple Choice)
4.7/5
(36)

Write Java code that uses a for statement to sum the numbers from 1 through 50.Display the total sum to the console.

(Essay)
4.7/5
(43)

Boolean expressions are used to control branch and loop statements.

(True/False)
4.8/5
(35)

Write Java code that uses a do…while loop that prints even numbers from 2 through 10.

(Essay)
4.9/5
(34)

The association of operands with operators is called ______________.

(Multiple Choice)
4.9/5
(31)

The ____________ operator has the highest precedence.

(Multiple Choice)
4.9/5
(34)

Not including the break statements within a switch statement results in a syntax error.

(True/False)
4.9/5
(36)

Common loop errors are:

(Multiple Choice)
4.8/5
(49)

A multi-way if-else statement

(Multiple Choice)
4.8/5
(31)
Showing 1 - 20 of 43
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)