ST3 Practice Memo
ST3 Practice Memo
1.3 A trace table is a tool used to visualize the flow of control in a True
program's execution.
1.4 In Java, the operator > is used to check if a value is less than False
another value.
1.5 The || operator returns false if at least one operand is false. False
C. Comparison operations C
D. Logical operations D
A. ++ A
B. -- B
C. += C
D. == D
B. false B
C. Compilation error C
D. Depends on context D
2.5 What will be the exact output of the following segment of code? int
a = 25;
System.out.print("1"); if(++a
< 25)
System.out.println("2"); else
System.out.println("3");
A. 1 A
B. 2 B
C. 3 C
D. 13 D
2.6 What will be the exact output of the following segment of code?
int x=10, y=20, z=30; if(x > y || x > 10) z++; else z--;
System.out.println("z "+z);
A. z = 29 A
B. z = 30 B
C. z 29 C
D. z 31 D
B. || B
C. ! C
D. ^ D
2.8 The following code section will display the word DONE only if which of
the following options is true?
if (a == 1 && b == 3 && c != 5)
System.out.print(“DONE”);
A. a is one, B is 3, C is 5. A
2.9 Which of the following expressions is equivalent to (x > 5)&&(x < 10)?
if(b > c)
System.out.println("Greater" + b); else
System.out.println("Less" + c);
A. Greater36 A
B. Less37 B
C. Greater37 C
D. Less36 D
int a = -5;
int b = -3;
if(a < b)
System.out.print(a);
System.out.println(b);
-5-3
3.2 What will be the exact output of the following segment of code?
if (!bChoice)
System.out.println("Go");
else
System.out.println("Stop");
Go
3.3 What will be the exact output of the following segment of code?
int x = 23; int y = 123;
23 123 146
3.5 Write two java statement that prints “Same sign” if iNum1 and iNum2 have the
same sign (-/+).
3.6 Normal body temperature ranges from 36.1°C to 37.2°C. Write two java
statements that checks if the variable rBodyTemp is within limits and display "Normal
body temperature".
start
iNum
is___________? True
False
end
Possible Solution
• The program should only accept uppercase letters as valid. Lowercase should
be treated as invalid.
• If the choice is valid, calculate the monthly instalment amount and the total
credit price. The total credit amount financed, includes the original TV price
plus the interest amount is spread out over 24 months in instalments.
Possible solution: