PSU COMPUTER SCIENCE 101 COMPLETE
STUDY GUIDE AND PROGRAMMING
FUNDAMENTALS REVIEW 2026
◉ What is the final value of numItems?
bonusVal = 5;
if (bonusVal<12) numItems= 100
numItems = 200;.
Answer: 5 < 12 so the first branch executes, namely numItems = 100.
◉ If userAge is greater than 62, assign 15 to discount. Else, assign 0
to discount..
Answer: if (userAge > 62) {
discount = 15;
}
else {
discount = 0;
}
◉ If numPeople is greater than 10, execute groupSize = 2 *
groupSize. Otherwise, execute groupSize = 3 * groupSize and also
numPeople = numPeople - 1..
,Answer: if (numPeople > 10) {
groupSize = 2 * groupSize;
}
else {
groupSize = 3 * groupSize;
numPeople = numPeople - 1;
}
◉ If numPlayers is greater than 11, execute teamSize = 11.
Otherwise, execute teamSize = numPlayers. Then, no matter the
value of numPlayers, execute teamSize = 2 * teamSize..
Answer: if (numPlayers > 11) {
teamSize = 11;
}
else {
teamSize = numPlayers;
}
teamSize = 2 * teamSize;
◉ Braces.
Answer: surrounds a branch's statements. {},sometimes redundantly
called curly braces represent a grouping, such as a grouping of
statements.
,◉ rational operator / equality operator.
Answer: An if-else expression commonly involves.
◉ Boolean value.
Answer: either true or false. If userAge is 19, then userAge<25
evaluates to true.
◉ a is equal to b.
Answer: a==b
◉ a != b.
Answer: a is not equal to b or differ
◉ !=.
Answer: Differ or less than or greater than
◉ centsLost is a negative number.
Answer: < 0 is the common way to detect a negative number.
◉ Strings are equal.
, Answer: if they have they have the same number of characters and
corresponding characters are identical.
◉ nested if-else.
Answer: A branch's statements can include any valid statements,
including another if-else statements, such occurrence known as
nested if-else statements.
◉ logical operator.
Answer: treats operands as being true or false, and evaluates to true
or false.
◉ a && b.
Answer: Logical AND: true when both of its operands are true
◉ a || b.
Answer: Logical OR: true when at least one of its two operands are
true
◉ !false.
Answer: TRUE
◉ !.
STUDY GUIDE AND PROGRAMMING
FUNDAMENTALS REVIEW 2026
◉ What is the final value of numItems?
bonusVal = 5;
if (bonusVal<12) numItems= 100
numItems = 200;.
Answer: 5 < 12 so the first branch executes, namely numItems = 100.
◉ If userAge is greater than 62, assign 15 to discount. Else, assign 0
to discount..
Answer: if (userAge > 62) {
discount = 15;
}
else {
discount = 0;
}
◉ If numPeople is greater than 10, execute groupSize = 2 *
groupSize. Otherwise, execute groupSize = 3 * groupSize and also
numPeople = numPeople - 1..
,Answer: if (numPeople > 10) {
groupSize = 2 * groupSize;
}
else {
groupSize = 3 * groupSize;
numPeople = numPeople - 1;
}
◉ If numPlayers is greater than 11, execute teamSize = 11.
Otherwise, execute teamSize = numPlayers. Then, no matter the
value of numPlayers, execute teamSize = 2 * teamSize..
Answer: if (numPlayers > 11) {
teamSize = 11;
}
else {
teamSize = numPlayers;
}
teamSize = 2 * teamSize;
◉ Braces.
Answer: surrounds a branch's statements. {},sometimes redundantly
called curly braces represent a grouping, such as a grouping of
statements.
,◉ rational operator / equality operator.
Answer: An if-else expression commonly involves.
◉ Boolean value.
Answer: either true or false. If userAge is 19, then userAge<25
evaluates to true.
◉ a is equal to b.
Answer: a==b
◉ a != b.
Answer: a is not equal to b or differ
◉ !=.
Answer: Differ or less than or greater than
◉ centsLost is a negative number.
Answer: < 0 is the common way to detect a negative number.
◉ Strings are equal.
, Answer: if they have they have the same number of characters and
corresponding characters are identical.
◉ nested if-else.
Answer: A branch's statements can include any valid statements,
including another if-else statements, such occurrence known as
nested if-else statements.
◉ logical operator.
Answer: treats operands as being true or false, and evaluates to true
or false.
◉ a && b.
Answer: Logical AND: true when both of its operands are true
◉ a || b.
Answer: Logical OR: true when at least one of its two operands are
true
◉ !false.
Answer: TRUE
◉ !.