Ready to test your Knowledge?
Try out our new practice tests completely free!
exam preparation banner icon

Java Programming

Computing

Quiz 4 :

Control Structures I: Selection

Quiz 4 :

Control Structures I: Selection

search
arrow
The symbol >= is a logical operator.
Free
True False
Answer:

Answer:

False

Tags
Choose question tag
close menu
arrow
Suppose that you have the following code. int num = 10; if (num > 10) System.out.println(num); else System.out.println(num + 5); The output of this code is 5.
Free
True False
Answer:

Answer:

False

Tags
Choose question tag
close menu
arrow
The operators = and == have the same order of precedence.
Free
True False
Answer:

Answer:

False

Tags
Choose question tag
close menu
arrow
A computer program will recognize both = and == as the equality operator.
True False
Answer:
Tags
Choose question tag
close menu
arrow
A program uses selection to implement a branch.
True False
Answer:
Tags
Choose question tag
close menu
arrow
In Java, case and switch are reserved words, but break is not a reserved word.
True False
Answer:
Tags
Choose question tag
close menu
arrow
Suppose x = 10 and y = 20. The value of the expression ((x >= 10) && (y <= 20)) is true.
True False
Answer:
Tags
Choose question tag
close menu
arrow
Including a semicolon before the action statement in a one-way selection causes a syntax error.
True False
Answer:
Tags
Choose question tag
close menu
arrow
Suppose that the input is 6 and console is a Scanner object initialized to the standard input device. Consider the following code. int alpha = 7; int beta = console.nextInt(); switch (beta) {case 5: alpha = alpha + 1; case 6: alpha = alpha + 2; case 7: alpha = alpha + 3; default: alpha = alpha + 5;} System.out.print(alpha); The output of this code is 9.
True False
Answer:
Tags
Choose question tag
close menu
arrow
The expression !(x <= 0) is true only if x is a positive number.
True False
Answer:
Tags
Choose question tag
close menu
arrow
=! is a relational operator.
True False
Answer:
Tags
Choose question tag
close menu
arrow
In Java, || has a higher precedence than &&.
True False
Answer:
Tags
Choose question tag
close menu
arrow
All switch structures include default cases.
True False
Answer:
Tags
Choose question tag
close menu
arrow
Suppose that you have the following statements. int score; String grade; if (score >= 65) grade = "pass"; else grade = "fail"; If score is equal to 75, the value of grade is pass.
True False
Answer:
Tags
Choose question tag
close menu
arrow
Suppose P and Q are logical expressions. The logical expression P && Q is false if both P and Q are false.
True False
Answer:
Tags
Choose question tag
close menu
arrow
In Java, !, &&, and || are called logical operators.
True False
Answer:
Tags
Choose question tag
close menu
arrow
All switch cases include a break statement.
True False
Answer:
Tags
Choose question tag
close menu
arrow
Suppose P and Q are logical expressions. The expression P || Q is true if both P and Q are true.
True False
Answer:
Tags
Choose question tag
close menu
arrow
The expression 'A' <= 'B' evaluates to false while the expression 'A' < 'B' evaluates to true.
True False
Answer:
Tags
Choose question tag
close menu
arrow
When one control statement is located within another, it is said to be a controlled statement.
True False
Answer:
Tags
Choose question tag
close menu
Showing 1 - 20 of 50