Filters
Question type

Study Flashcards

What is the value of x after the following code has been executed? Int x = 75; Int y = 90; If ( x != y) X += y;


A) 75
B) 90
C) 15
D) 165

E) B) and D)
F) B) and C)

Correct Answer

verifed

verified

Because the || operator performs short-circuit evaluation, your boolean expression will generally be evaluated faster if the subexpression that is most likely to be true is on the left.

A) True
B) False

Correct Answer

verifed

verified

What does the following code display? Int d = 9, e = 12; System.out.printf("%d %d\n", d, e) ;


A) %d %d
B) 9 12
C) %d 9
D) %9 %12

E) C) and D)
F) A) and D)

Correct Answer

verifed

verified

The ________ statement is used to make simple decisions in Java.


A) do/while
B) for
C) branch
D) if

E) None of the above
F) A) and B)

Correct Answer

verifed

verified

A flag may have the values:


A) 0 or 1
B) +1 or -1
C) true or False
D) of any character

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

Which of the following will format 12.7801 to display as $12.78?


A) System.out.printf("$%,.2f", 12.7801) ;
B) System.out.printf("%f", 12.7801) ;
C) System.out.printf("%.2f $$", 12.7801) ;
D) System.out.printf("$d", 12.7801) ;

E) None of the above
F) All of the above

Correct Answer

verifed

verified

In a switch statement, if two different values for the CaseExpression would result in the same code being executed, you must have two copies of the code, one after each CaseExpression.

A) True
B) False

Correct Answer

verifed

verified

What will be the value of charges after the following code is executed? Double charges, rate = 7.00; Int time = 180; Charges = time <= 119 ? Rate * 2 : Time / 60.0 * rate;


A) 7.00
B) 14.00
C) 21.00
D) 28.00

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

________ works like this: If the expression on the left side of the && operator is False, the expression the right side will not be checked.


A) Short-circuit evaluation
B) Reverse logic
C) Boolean logic
D) Relational evaluation

E) A) and D)
F) A) and C)

Correct Answer

verifed

verified

This is a boolean variable that signals when some condition exists in the program:


A) Sentinel
B) Block
C) Flag
D) Case

E) B) and C)
F) C) and D)

Correct Answer

verifed

verified

When two Strings are compared using the compareTo method, the cases of the two strings are not considered.

A) True
B) False

Correct Answer

verifed

verified

The switch statement is a:


A) Multiple alternative decision structure
B) Nested decision structure
C) Sequence structure
D) Test expression

E) A) and B)
F) C) and D)

Correct Answer

verifed

verified

This is an international coding system that is extensive enough to represent all the characters of all the world's alphabets:


A) ASCII
B) Unicode
C) Java
D) None of the above

E) B) and D)
F) A) and B)

Correct Answer

verifed

verified

What would be the value of discountRate after the following statements are executed? Double discountRate = 0.0; Int purchase = 100; If (purchase > 1000) DiscountRate = .05; Else if (purchase > 750) DiscountRate = .03; Else if (purchase > 500) DiscountRate = .01;


A) .05
B) .03
C) .01
D) 0.0

E) B) and D)
F) A) and B)

Correct Answer

verifed

verified

If you prematurely terminate an if statement with a semicolon, the compiler will:


A) Not display an error message
B) Assume you are placing a null statement there
C) All of the above
D) None of the above

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

The expression tested by an if statement must evaluate to:


A) 0 or 1
B) +1 or -1
C) true or False
D) t or f

E) B) and D)
F) A) and B)

Correct Answer

verifed

verified

Unicode is an international encoding system that is extensive enough to represent ALL the characters of ALL the world's alphabets.

A) True
B) False

Correct Answer

verifed

verified

What will be printed when the following code is executed? Int y = 10; If ( y == 10) { Int x = 30; X += y; } System.out.print("x = ") ; System.out.print(x) ;


A) x = 30
B) x = 40
C) x = 20
D) x is unknown when the last statement is executed.

E) B) and D)
F) A) and B)

Correct Answer

verifed

verified

The String.format method works exactly like the System.out.printf method, except that it does not display the formatted string on the screen.

A) True
B) False

Correct Answer

verifed

verified

Programs never need more than one path of execution.

A) True
B) False

Correct Answer

verifed

verified

Showing 41 - 60 of 64

Related Exams

Show Answer