CSE 1321 LATEST ACTUAL 2026/2027 EXAM QUESTIONS
AND SOLUTIONS RATED A+
✔✔Imagine a game of Yahtzee where a roll of dice always returns an even number.
Consider this code where the number is variable that stores the value of the dice.
BEGIN MAIN
CREATE result = number % 2;
IF (result == 0)
PRINT "TRUE"
ELSE
PRINT "FALSE"
END MAIN
What will the code display?
a) FALSE
b) Unable to determine
c) Neither condition is satisfied
d) TRUE - ✔✔d) TRUE
✔✔An if statement does not need to have an else clause.
true or false - ✔✔true
✔✔If the variable isTested is a Boolean, then the statement below is a valid control
expression:
IF(isTested)
true or false - ✔✔true
✔✔In programming && is considered an arithmetic operator.
true or false - ✔✔false
✔✔If x = 3, y = 1, and z = 5 then the following Boolean expression evaluates to true:
( x > 0) && (y == 0) || (z < 5)
true or false - ✔✔false
✔✔The Boolean expression ((A AND B) AND (NOT(A AND B)) evaluates to:
a) true whenever both A is true and B is true.
, b) false in all cases.
c) true whenever only A is true or only B is true.
d) true in all cases. - ✔✔b) false in all cases.
✔✔Which statement below will be true after the following code terminates?
BEGIN MAIN
CREATE x = 0
WHILE (x < 100)
{
x *= 2;
}
END WHILE
END MAIN
a) x == 98
b) x == 2
c) The loop won't terminate. It's an infinite loop.
d) x == 0 - ✔✔c) The loop won't terminate. It's an infinite loop.
(0 * 2 will always be 0 so infinite loop)
✔✔Consider this code:
BEGIN MAIN
int y=1;
int x=1;
PRINTLINE(x++);
END MAIN
What will this code print?
a) 2
b) 0
c) 1
d) unknown - ✔✔c) 1
✔✔A relational operator used when comparing primitive data types is !=.
true or false - ✔✔true
✔✔A switch statement is similar to an if statement in that both are used to alter the flow
of a program.
true or false - ✔✔true
AND SOLUTIONS RATED A+
✔✔Imagine a game of Yahtzee where a roll of dice always returns an even number.
Consider this code where the number is variable that stores the value of the dice.
BEGIN MAIN
CREATE result = number % 2;
IF (result == 0)
PRINT "TRUE"
ELSE
PRINT "FALSE"
END MAIN
What will the code display?
a) FALSE
b) Unable to determine
c) Neither condition is satisfied
d) TRUE - ✔✔d) TRUE
✔✔An if statement does not need to have an else clause.
true or false - ✔✔true
✔✔If the variable isTested is a Boolean, then the statement below is a valid control
expression:
IF(isTested)
true or false - ✔✔true
✔✔In programming && is considered an arithmetic operator.
true or false - ✔✔false
✔✔If x = 3, y = 1, and z = 5 then the following Boolean expression evaluates to true:
( x > 0) && (y == 0) || (z < 5)
true or false - ✔✔false
✔✔The Boolean expression ((A AND B) AND (NOT(A AND B)) evaluates to:
a) true whenever both A is true and B is true.
, b) false in all cases.
c) true whenever only A is true or only B is true.
d) true in all cases. - ✔✔b) false in all cases.
✔✔Which statement below will be true after the following code terminates?
BEGIN MAIN
CREATE x = 0
WHILE (x < 100)
{
x *= 2;
}
END WHILE
END MAIN
a) x == 98
b) x == 2
c) The loop won't terminate. It's an infinite loop.
d) x == 0 - ✔✔c) The loop won't terminate. It's an infinite loop.
(0 * 2 will always be 0 so infinite loop)
✔✔Consider this code:
BEGIN MAIN
int y=1;
int x=1;
PRINTLINE(x++);
END MAIN
What will this code print?
a) 2
b) 0
c) 1
d) unknown - ✔✔c) 1
✔✔A relational operator used when comparing primitive data types is !=.
true or false - ✔✔true
✔✔A switch statement is similar to an if statement in that both are used to alter the flow
of a program.
true or false - ✔✔true