Computer Science Quiz 3
A block of code is enclosed in a set of A. Braces B. Parentheses C. Double quotes D. Brackets
A.
In Java, when a character is stored in memory, it is actually a______ A. Unicode number B. ASCII character code C. EBCDIC character code D. Morse code
A.
What will be the value of ans after the following code has been executed? int x=65; int y=55; if (x >= y) int ans = x + y; A. 10 B. 120 C. 100 D. No value, there is a syntax error
B.
What will be the value of x after the following code is executed? int x=75; int y=60; if (x > y) x = x - y; A. 75 B. 15 C. 60 D. 135
B.
A flag may have the values A. 0 and 1 B. +1 and -1 C. True and False D. Of any character
C.
What will be the value of ans after the following code is executed? int x=90, y=55, ans = 10; if ( x == y); ans *= 2; A. 10 B. 145 C. 20 D. No value, there is a syntax error
C.
If chr is a character variable, which of the following if statement is correct? A. if (chr = 'a') B. if (chr == "a") C. if (chr ='a') D. if (chr =='a')
D.
The____ statement is used to make simple decision in Java. A. do while B. for C. switch D. if
D.
An important style rule you should adopt writing if statements is to write a conditionally executed statement on the line after the if statement. True or Flase
True
The if else statement will execute one group of statement if it's Boolean expression is true or another group if it's Boolean expression is false. True or False
True