Complete Objective Assessment Prep.
WGU D278 Scripting and Programming Foundations Exam: Questions with
Answers and Rationales
Course: Scripting and Programming Foundations – D278
Institution: Western Governors University (WGU)
Academic Year: 2025/2026
Question Type: Multiple Choice
Domain 1: Programming Fundamentals & Data Types (Questions 1-35)
Topic: Variables, Declarations, and Data Types
Question 1:
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
,Answer: B) Float
Rationale: Height measurements often involve decimal values (e.g., 1.75 meters).
The float data type stores floating-point numbers with decimal fractions. Integers
only store whole numbers, strings store text, and booleans store true/false
values.
Question 2:
Which data type should be used to keep track of how many planes are in a
hangar?
A) Integer
B) Float
C) String
D) Boolean
Answer: A) Integer
Rationale: The number of planes represents a countable quantity consisting of
whole numbers (you cannot have half a plane). Integer variables are specifically
used for values that are counted, while float is for measured values.
,Question 3:
Which data type is used for items that are measured in length?
A) Integer
B) Float
C) String
D) Boolean
Answer: B) Float
Rationale: Length measurements (like 5.7 meters or 2.45 feet) typically involve
decimal values. Float variables are used for measured quantities, whereas
integers are for counted quantities.
Question 4:
A variable should hold the names of all past U.S. presidents. Which data type
should the variable be?
A) Integer array
B) Float array
C) String array
D) Boolean array
, Answer: C) String array
Rationale: President names are text data (strings). Since we need to store multiple
names, an array is appropriate. A string array can hold multiple text values, while
other array types store different kinds of data.
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) Variable float secondsPerMinute
Answer: A) Constant integer secondsPerMinute
Rationale: The number of seconds in a minute (60) is a fixed value that never
changes during program execution, so it should be declared as a constant. Integer
is the correct type since seconds are whole numbers.