Chapter 4 (Decision Structures)

Chapter 4 (Decision Structures)

Assessment

Flashcard

Computers

9th - 12th Grade

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

20 questions

Show all answers

1.

FLASHCARD QUESTION

Front

Is this code segment correct?
if(quizScore == 10)
System.out.println("Perfect score");

Back

Yes

2.

FLASHCARD QUESTION

Front

WHICH TYPE OF DECISION STRUCTURE IS THIS?

Media Image

Back

Nested If

3.

FLASHCARD QUESTION

Front

What decision structure works best if you have more than two possible answers (multiple choice) to a question, and those answers can be integer or character based?

Back

A Switch statement

4.

FLASHCARD QUESTION

Front

Of the following if statements, which one correctly executes three instructions if the condition is true?
Options: if (x < 0)  
a = b * 2;
 
y = x;
 
 z = a – y;
, {
   if (x <0)
   a = b*2;
   y=x;
   z=a-y;
}
, if { (x < 0) 
a = b * 2;  
y = x;  
 z = a – y;
}, if (x <0)
{
a = b*2;
y = x;
z = a - y;

Back

if (x <0)
{
a = b*2;
y = x;
z = a - y;

5.

FLASHCARD QUESTION

Front

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? Options: if (x > 0)  x++;
else x--;
, if (x > 0) x++;
else if (x < 0) x--;
, if (x > 0) x++;
if (x < 0) x--;
else x = 0;
, if (x == 0) x = 0;
else x++;
x--;

Back

if (x > 0) x++;
else if (x < 0) x--;

6.

FLASHCARD QUESTION

Front

How would you check for inequality?

Back

!=

7.

FLASHCARD QUESTION

Front

Is this code segment correct?
if(quizScore == 10);
  System.out.println("Perfect score");

Back

No

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?