WGU D278 SCRIPTING AND PROGRAMMING FOUNDATIONS ACTUAL QUESTIONS AND CORRECT ANSWERS (VERIFIED
ANSWERS) PLUS RATIONALES 2026 Q&A | INSTANT DOWNLOAD PDF
Core Domains
Variables, data types, and constants
Operators and expressions
Input and output
Control flow and branching
Iteration and loops
Functions and modular design
Arrays, lists, and collections
File handling and persistence
Exceptions and debugging
Basic object-oriented concepts
Introduction
This assessment measures foundational programming knowledge and the ability to apply it in practical scenarios. It covers core scripting and
programming concepts such as data types, variables, operators, control structures, iteration, modularity, file handling, and error management.
Questions combine multiple-choice and scenario-based problem solving to reflect the kind of decisions programmers make when writing, testing,
and maintaining code. The focus is on selecting appropriate solutions, recognizing common errors, and applying programming principles to real-
world tasks.
Section One: Questions 1–100
1. Which statement best describes the purpose of a variable?
A. To permanently store a value that cannot change.
B. To hold data that may change during program execution.
C. To convert one data type into another.
D. To define the structure of a class.
, 🟢 Correct answer: B. To hold data that may change during program execution.
🔴 RATIONALE: A variable stores a value that can be updated as the program runs, making it useful for tracking changing data.
2. A programmer needs to store the number of students in a class. Which data type is most appropriate?
A. Boolean
B. Integer
C. String
D. Character
🟢 Correct answer: B. Integer
🔴 RATIONALE: A count of students should be stored as a whole number, which is an integer.
3. Which value would be best stored as a string?
A. 125
B. True
C. "Nairobi"
D. 3.14
🟢 Correct answer: C. "Nairobi"
🔴 RATIONALE: Textual data such as names and locations is stored as a string.
4. What is the primary purpose of a constant?
A. To store a value that should not change during execution.
B. To repeatedly request user input.
C. To define a loop condition.
D. To convert strings to numbers.
🟢 Correct answer: A. To store a value that should not change during execution.
🔴 RATIONALE: Constants are used for values that remain fixed, such as tax rates or configuration values.
,5. Which operator is used for assignment in most programming languages?
A. =
B. ==
C. !=
D. >=
🟢 Correct answer: A. =
🔴 RATIONALE: The assignment operator stores a value in a variable.
6. What does the expression 5 + 2 ∗ 3 evaluate to using standard order of operations?
A. 21
B. 11
C. 17
D. 15
🟢 Correct answer: B. 11
🔴 RATIONALE: Multiplication is performed before addition, so the result is 5 + 6 = 11.
7. Which operator checks whether two values are equal?
A. =
B. !=
C. ==
D. <=
🟢 Correct answer: C. ==
🔴 RATIONALE: Equality comparison uses a double equals sign in many languages.
8. What is the result of a Boolean expression?
, A. A text value
B. A numeric value
C. True or false
D. A loop counter
🟢 Correct answer: C. True or false
🔴 RATIONALE: Boolean expressions evaluate to logical truth values.
9. Which of the following is a valid identifier in most programming languages?
A. 2count
B. total_score
C. total score
D. class
🟢 Correct answer: B. total_score
🔴 RATIONALE: Identifiers typically cannot start with a number or contain spaces.
0. What is the main purpose of commenting code?
A. To make code run faster.
B. To explain logic to humans.
C. To replace variables.
D. To prevent syntax errors.
🟢 Correct answer: B. To explain logic to humans.
🔴 RATIONALE: Comments improve readability and maintainability but do not affect execution.
1. A program asks the user for their age. Which programming construct is being used?
A. Output
B. Input
C. Iteration
D. Casting
ANSWERS) PLUS RATIONALES 2026 Q&A | INSTANT DOWNLOAD PDF
Core Domains
Variables, data types, and constants
Operators and expressions
Input and output
Control flow and branching
Iteration and loops
Functions and modular design
Arrays, lists, and collections
File handling and persistence
Exceptions and debugging
Basic object-oriented concepts
Introduction
This assessment measures foundational programming knowledge and the ability to apply it in practical scenarios. It covers core scripting and
programming concepts such as data types, variables, operators, control structures, iteration, modularity, file handling, and error management.
Questions combine multiple-choice and scenario-based problem solving to reflect the kind of decisions programmers make when writing, testing,
and maintaining code. The focus is on selecting appropriate solutions, recognizing common errors, and applying programming principles to real-
world tasks.
Section One: Questions 1–100
1. Which statement best describes the purpose of a variable?
A. To permanently store a value that cannot change.
B. To hold data that may change during program execution.
C. To convert one data type into another.
D. To define the structure of a class.
, 🟢 Correct answer: B. To hold data that may change during program execution.
🔴 RATIONALE: A variable stores a value that can be updated as the program runs, making it useful for tracking changing data.
2. A programmer needs to store the number of students in a class. Which data type is most appropriate?
A. Boolean
B. Integer
C. String
D. Character
🟢 Correct answer: B. Integer
🔴 RATIONALE: A count of students should be stored as a whole number, which is an integer.
3. Which value would be best stored as a string?
A. 125
B. True
C. "Nairobi"
D. 3.14
🟢 Correct answer: C. "Nairobi"
🔴 RATIONALE: Textual data such as names and locations is stored as a string.
4. What is the primary purpose of a constant?
A. To store a value that should not change during execution.
B. To repeatedly request user input.
C. To define a loop condition.
D. To convert strings to numbers.
🟢 Correct answer: A. To store a value that should not change during execution.
🔴 RATIONALE: Constants are used for values that remain fixed, such as tax rates or configuration values.
,5. Which operator is used for assignment in most programming languages?
A. =
B. ==
C. !=
D. >=
🟢 Correct answer: A. =
🔴 RATIONALE: The assignment operator stores a value in a variable.
6. What does the expression 5 + 2 ∗ 3 evaluate to using standard order of operations?
A. 21
B. 11
C. 17
D. 15
🟢 Correct answer: B. 11
🔴 RATIONALE: Multiplication is performed before addition, so the result is 5 + 6 = 11.
7. Which operator checks whether two values are equal?
A. =
B. !=
C. ==
D. <=
🟢 Correct answer: C. ==
🔴 RATIONALE: Equality comparison uses a double equals sign in many languages.
8. What is the result of a Boolean expression?
, A. A text value
B. A numeric value
C. True or false
D. A loop counter
🟢 Correct answer: C. True or false
🔴 RATIONALE: Boolean expressions evaluate to logical truth values.
9. Which of the following is a valid identifier in most programming languages?
A. 2count
B. total_score
C. total score
D. class
🟢 Correct answer: B. total_score
🔴 RATIONALE: Identifiers typically cannot start with a number or contain spaces.
0. What is the main purpose of commenting code?
A. To make code run faster.
B. To explain logic to humans.
C. To replace variables.
D. To prevent syntax errors.
🟢 Correct answer: B. To explain logic to humans.
🔴 RATIONALE: Comments improve readability and maintainability but do not affect execution.
1. A program asks the user for their age. Which programming construct is being used?
A. Output
B. Input
C. Iteration
D. Casting