Filters
Question type

Study Flashcards

What would be the value of bonus after the following statements are executed? int bonus, sales = 85000; Char dept = 'S'; If (sales > 100000) If (dept == 'R') Bonus = 2000; Else Bonus = 1500; Else if (sales > 75000) If (dept == 'R') Bonus = 1250; Else Bonus = 1000; Else Bonus = 0;


A) 2000
B) 1500
C) 1250
D) 1000

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

Correct Answer

verifed

verified

A flag may have the values


A) defined or undefined
B) true or false
C) of any range of integers
D) of any Unicode character

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

Correct Answer

verifed

verified

What will be displayed after the following statements are executed? int ans = 10; Int x = 65; Int y = 55; If (x >= y) { Int ans = x + y; } System.out.println(ans) ;


A) 10
B) 120
C) 100
D) The code contains an error and will not compile.

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

Correct Answer

verifed

verified

What will be the value of x after the following statements are executed? int x = 10; Switch (x) { Case 10: X += 15; Case 12: X -= 5; Break; Default: X *= 3; }


A) 30
B) 20
C) 25
D) 5

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

Correct Answer

verifed

verified

Which of the following expressions could be used to perform a case-insensitive comparison of two String objects named str1 and str2?


A) str1.equalsIgnoreCase(str2)
B) str1.equalsInsensitive(str2)
C) str1 != str2
D) str1 || str2

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

Correct Answer

verifed

verified

Which of the following expressions determines whether the char variable, chrA, is not equal to the letter 'A'?


A) chrA == 'A'
B) chrA != 'A'
C) chrA || 'A'
D) chrA.notEquals(A)

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

Correct Answer

verifed

verified

When two strings are compared using the String class's compareTo method, the comparison is not case sensitive.

A) True
B) False

Correct Answer

verifed

verified

The if-else statement will execute one group of statements if its boolean expression is true or another group if its boolean expression is false.

A) True
B) False

Correct Answer

verifed

verified

What will be the value of ans after the following statements are executed? int x = 40; Int y = 40; If (x = y) Ans = x + 10;


A) 30
B) 80
C) 50
D) The code contains an error and will not compile.

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

Correct Answer

verifed

verified

All it takes for an AND expression to be true is for one of the subexpressions to be true.

A) True
B) False

Correct Answer

verifed

verified

What is the value of ans after the following code has been executed? int x = 35; Int y = 20, ans = 80; If (x < y) Ans += y;


A) 80
B) 100
C) 35
D) 55

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

Correct Answer

verifed

verified

If the expression on the left side of the && operator is false, the expression on the right side will not be checked.

A) True
B) False

Correct Answer

verifed

verified

What will be the value of bonus after the following statements are executed? int bonus, sales = 10000; If (sales < 5000) Bonus = 200; Else if (sales < 7500) Bonus = 500; Else if (sales < 10000) Bonus = 750; Else if (sales < 20000) Bonus = 1000; Else Bonus = 1250;


A) 750
B) 1250
C) 500
D) 1000

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

Correct Answer

verifed

verified

An 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) A) and B)
F) A) and C)

Correct Answer

verifed

verified

What will be the values of ans, x, and y after the following statements are executed? int ans = 35, x = 50, y = 50; If (x >= y) { Ans = x + 10; X -= y; } Else { Ans = y + 10; Y += x; }


A) ans = 60, x = 0, y = 50
B) ans = 45, x = 50, y = 0
C) ans = 45, x = 50, y = 50
D) ans = 60, x = 50, y = 100

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

Correct Answer

verifed

verified

What will be printed when the following code is executed? double x = 45678.259; System.out.printf("%,.2f", x) ;


A) 45678.259
B) 0,045,678.26
C) 45,678.26
D) 45,678.3

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

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) B) and C)
F) B) and D)

Correct Answer

verifed

verified

Which of the following is the not equal operator?


A) <>
B) NOT
C) *&
D) !=

E) None of the above
F) C) and D)

Correct Answer

verifed

verified

Showing 41 - 58 of 58

Related Exams

Show Answer