Exam 5: Conditionals and Loops

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

Which of the following are True statements about check boxes?

Free
(Multiple Choice)
4.9/5
(27)
Correct Answer:
Verified

E

Rewrite the following set of if statements using a nested if-else structure. if (score >= 90) grade = 'A'; if (score >= 80 && score < 90) grade = 'B'; if (score >= 70 && score < 80) grade = 'C'; if (score >= 60 && score < 70) grade = 'D'; if (score < 60) grade = 'F';

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

if (score >= 90) grade = 'A';
else if (score >= 80) grade = 'B';
else if (score >= 70) grade = 'C';
else if (score >= 60) grade = 'D';
else grade = 'F';

Every Interator

Free
(Multiple Choice)
4.8/5
(35)
Correct Answer:
Verified

A

Explain what is meant by short circuiting and provide an example of short circuiting a condition with && and provide an example of short circuiting a condition with | |.

(Essay)
4.8/5
(38)

The idea that program instructions execute in order (linearly) unless otherwise specified through a conditional statement is known as

(Multiple Choice)
4.9/5
(34)

In Java, the symbol "=" and the symbol "==" are used synonymously (interchangeably).

(True/False)
4.7/5
(35)

As in the other members of the C family of languages (C, C++, C#), Java interprets a zero value as false and a non-zero value as True.

(True/False)
4.8/5
(34)

How many times will the following loop iterate? Int x = 10; While (x > 0) { System.out.println(x); X--; }

(Multiple Choice)
4.8/5
(27)

As introduced in the Software Failure, the terminology "risk analysis" means

(Multiple Choice)
4.7/5
(43)

For the questions below, assume that boolean done = false, int x = 10, int y = 11, String s = "Help" and String t = "Goodbye". -The expression (!done && x <= y) is True.

(True/False)
4.8/5
(27)

Regarding the Software Failure: The operators were warned that, although the Therac-25 had many safety precautions, it might be possible to accidentally overdose a patient.

(True/False)
4.9/5
(36)

If x is an int where x = 1, what will x be after the following loop terminates? While (x < 100) X *= 2;

(Multiple Choice)
4.8/5
(32)

An if statement may or may not have an else clause, but an else clause must be part of an if statement.

(True/False)
4.9/5
(37)

String s1 is said to overlap String s2 if all of the characters in s1 also appear in s2. Write a set of code that will set the boolean variable overlap to True if s1 overlaps s2 and false otherwise. Assume both s1 and s2 have already been input.

(Essay)
4.9/5
(35)

In order to compare int, float and double variables, you can use <, >, ==, !=, <=, >=, but to compare char and String variables, you must use compareTo( ), equals( ) and equalsIgnoreCase( ).

(True/False)
4.9/5
(35)

The statement { } is a legal block.

(True/False)
4.7/5
(35)

Which of the sets of statements below will add 1 to x if x is positive and subtract 1 from x if x is negative but leave x alone if x is 0?

(Multiple Choice)
4.7/5
(35)

If a break occurs within the innermost loop of a nested loop that is three levels deep

(Multiple Choice)
4.9/5
(42)

Of the following if statements, which one correctly executes three instructions if the condition is True?

(Multiple Choice)
4.9/5
(35)

When comparing any primitive type of variable, == should always be used to test to see if two values are equal.

(True/False)
4.7/5
(26)
Showing 1 - 20 of 37
close modal

Filters

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