WESTERN GOVERNORS UNIVERSIT Y
Bachelor of Science in Computer Science
D278 Scripting and Programming Foundations Academic Year: 2026/2027
Ultimate Study Guide: Complete Question Bank
Question 1
Which operator should be used to determine if a number is evenly divisible by 5?
A. %
B. /
C. *
D. +
CORRECT ANSWER: A. %
RATIONALE: The modulus operator (%) returns the remainder of a division operation. If a
number % 5 equals 0, the number is evenly divisible by 5.
,Question 2
A car drove 200 miles using 10 gallons of fuel. Which operation should be used to
compute the miles per gallon, which is 20?
A. Addition
B. Subtraction
C. Multiplication
D. Division
CORRECT ANSWER: D. Division
RATIONALE: Miles per gallon is calculated by dividing the number of miles driven by the
number of gallons used ( = 20).
Question 3
A variable should hold a person's height in meters. Which data type should the variable
be?
A. Integer
B. Float
C. String
D. Boolean
CORRECT ANSWER: B. Float
RATIONALE: Height in meters is a decimal value (e.g., 1.75), so a floating-point data type
(float) should be used.
,Question 4
A variable should hold the names of all past U.S. presidents. Which data type should
the variable be?
A. Integer
B. Float
C. String
D. String array
CORRECT ANSWER: D. String array
RATIONALE: A list of names is a collection of strings, so a string array (or list of strings)
should be used.
Question 5
A program uses the number of seconds in a minute in various calculations. How should
the item that holds the number of seconds in a minute be declared?
A. Constant integer secondsPerMinute
B. Variable integer secondsPerMinute
C. Constant float secondsPerMinute
D. String secondsPerMinute
CORRECT ANSWER: A. Constant integer secondsPerMinute
RATIONALE: The number of seconds in a minute (60) is a constant value that never
changes, so it should be declared as a constant integer.
, Question 6
A program determines if a user's age is high enough to run for U.S. president. The
minimum age requirement is 35. How should the item that holds the minimum age be
declared?
A. Constant integer minAge
B. Variable integer minAge
C. Constant float minAge
D. String minAge
CORRECT ANSWER: A. Constant integer minAge
RATIONALE: The minimum age requirement (35) is a fixed value that does not change,
so it should be declared as a constant integer.
Question 7
Given integer x = 3 and integer y = 5. What is the value of the expression ( x / 2.0) + y?
A. 6.5
B. 6.0
C. 7.0
D. 5.5
CORRECT ANSWER: A. 6.5
RATIONALE: .0 = 1.5; 1.5 + 5 = 6.5.
Bachelor of Science in Computer Science
D278 Scripting and Programming Foundations Academic Year: 2026/2027
Ultimate Study Guide: Complete Question Bank
Question 1
Which operator should be used to determine if a number is evenly divisible by 5?
A. %
B. /
C. *
D. +
CORRECT ANSWER: A. %
RATIONALE: The modulus operator (%) returns the remainder of a division operation. If a
number % 5 equals 0, the number is evenly divisible by 5.
,Question 2
A car drove 200 miles using 10 gallons of fuel. Which operation should be used to
compute the miles per gallon, which is 20?
A. Addition
B. Subtraction
C. Multiplication
D. Division
CORRECT ANSWER: D. Division
RATIONALE: Miles per gallon is calculated by dividing the number of miles driven by the
number of gallons used ( = 20).
Question 3
A variable should hold a person's height in meters. Which data type should the variable
be?
A. Integer
B. Float
C. String
D. Boolean
CORRECT ANSWER: B. Float
RATIONALE: Height in meters is a decimal value (e.g., 1.75), so a floating-point data type
(float) should be used.
,Question 4
A variable should hold the names of all past U.S. presidents. Which data type should
the variable be?
A. Integer
B. Float
C. String
D. String array
CORRECT ANSWER: D. String array
RATIONALE: A list of names is a collection of strings, so a string array (or list of strings)
should be used.
Question 5
A program uses the number of seconds in a minute in various calculations. How should
the item that holds the number of seconds in a minute be declared?
A. Constant integer secondsPerMinute
B. Variable integer secondsPerMinute
C. Constant float secondsPerMinute
D. String secondsPerMinute
CORRECT ANSWER: A. Constant integer secondsPerMinute
RATIONALE: The number of seconds in a minute (60) is a constant value that never
changes, so it should be declared as a constant integer.
, Question 6
A program determines if a user's age is high enough to run for U.S. president. The
minimum age requirement is 35. How should the item that holds the minimum age be
declared?
A. Constant integer minAge
B. Variable integer minAge
C. Constant float minAge
D. String minAge
CORRECT ANSWER: A. Constant integer minAge
RATIONALE: The minimum age requirement (35) is a fixed value that does not change,
so it should be declared as a constant integer.
Question 7
Given integer x = 3 and integer y = 5. What is the value of the expression ( x / 2.0) + y?
A. 6.5
B. 6.0
C. 7.0
D. 5.5
CORRECT ANSWER: A. 6.5
RATIONALE: .0 = 1.5; 1.5 + 5 = 6.5.