CSE 1321 STUDY GUIDE EXAM 2026/2027 QUESTIONS
AND SOLUTIONS RATED A+
✔✔What is the output of the following code?
BEGIN MAIN
int u = 3;
int v = 5;
u += v;
v += u;
u -= v;
v -= u;
PRINT (u + ", " + v);
END MAIN
a) 5, 3
b) -5,-3
c) 3, 5
d) -5, 18 - ✔✔d) -5, 18
✔✔What would be the best datatype to represent product? A variable that stores
information about the number of items currently in stock in a grocery store.
a) double
b) int
c) float
d) String - ✔✔b) int
(number of items in the store is going to be a whole number)
✔✔What is the value of j after this code is executed?
BEGIN MAIN
int i = 6, int j=10;
j+=i;
END MAIN
a) 10
b) 6
c) 4
d) 16 - ✔✔d) 16
✔✔A String (or string) object is a primitive data type.
true or false - ✔✔false
, ✔✔a string is actually: - ✔✔- Strings are immutable which means once a String object is
created its contents cannot be changed. (cant change in memory)
- complex: can be broken down into characters
✔✔What is the output of the following code?
BEGIN MAIN
int num1 = 500;
int num2 = 200;
int num3 = 300;
double average = num1 + num2 + num;
PRINTLINE(average);
END MAIN
a) 333.33333333333
b) 333.0
c) Error message
d) 800.0 - ✔✔d) 800.0
✔✔If the expression xyz % 3 == 0 is true and xyz is a positive integer, then the value
stored in the variable xyz is evenly divisible by 3.
true or false - ✔✔true
✔✔Consider the expression: value >= 30
Which of the following is equivalent to this expression?
a) value > 30 OR value == 30
b) NOT(value < 29)
c) NOT(value > 31)
d) value > 30 AND value == 30 - ✔✔a) value > 30 OR value == 30
✔✔Consider two variables x and y. If the values of x =5 and y=10
BEGIN MAIN
IF(x < 0)
{
PRINT "Mr.Spock"
}
ELSE
{
IF (x > y)
{
PRINT "Captain Kirk"
}
AND SOLUTIONS RATED A+
✔✔What is the output of the following code?
BEGIN MAIN
int u = 3;
int v = 5;
u += v;
v += u;
u -= v;
v -= u;
PRINT (u + ", " + v);
END MAIN
a) 5, 3
b) -5,-3
c) 3, 5
d) -5, 18 - ✔✔d) -5, 18
✔✔What would be the best datatype to represent product? A variable that stores
information about the number of items currently in stock in a grocery store.
a) double
b) int
c) float
d) String - ✔✔b) int
(number of items in the store is going to be a whole number)
✔✔What is the value of j after this code is executed?
BEGIN MAIN
int i = 6, int j=10;
j+=i;
END MAIN
a) 10
b) 6
c) 4
d) 16 - ✔✔d) 16
✔✔A String (or string) object is a primitive data type.
true or false - ✔✔false
, ✔✔a string is actually: - ✔✔- Strings are immutable which means once a String object is
created its contents cannot be changed. (cant change in memory)
- complex: can be broken down into characters
✔✔What is the output of the following code?
BEGIN MAIN
int num1 = 500;
int num2 = 200;
int num3 = 300;
double average = num1 + num2 + num;
PRINTLINE(average);
END MAIN
a) 333.33333333333
b) 333.0
c) Error message
d) 800.0 - ✔✔d) 800.0
✔✔If the expression xyz % 3 == 0 is true and xyz is a positive integer, then the value
stored in the variable xyz is evenly divisible by 3.
true or false - ✔✔true
✔✔Consider the expression: value >= 30
Which of the following is equivalent to this expression?
a) value > 30 OR value == 30
b) NOT(value < 29)
c) NOT(value > 31)
d) value > 30 AND value == 30 - ✔✔a) value > 30 OR value == 30
✔✔Consider two variables x and y. If the values of x =5 and y=10
BEGIN MAIN
IF(x < 0)
{
PRINT "Mr.Spock"
}
ELSE
{
IF (x > y)
{
PRINT "Captain Kirk"
}