WGU D278 Scripting and Programming Foundations
Pre-Assessment Actual Exam – Complete 350
Questions with Verified Answers – Newly Released &
Fully Updated
Official Exam Overview:
The WGU D278 Scripting and Programming Foundations Pre-Assessment Actual Exam
evaluates learners’ understanding of programming concepts, data types, expressions, control
structures, and scripting fundamentals. The exam emphasizes problem-solving, logical
reasoning, and application of programming principles in software development.
Exam Coverage Areas:
1. Data Types, Variables, and Expressions
2. Arithmetic and Logical Operators
3. Conditional Statements and Loops
4. Functions, Methods, and Modular Programming
5. Arrays, Lists, and Data Structures
6. Error Handling and Debugging
7. Basic Scripting for Automation and Problem Solving
QUESTION 1:
Given integer x = 3 and integer y = 5. What is the value of the expression (x / 2.0) +
y?
A) 5.0
B) 6.0
C) 6.5 ✅
D) 7.5
Rationale:
Dividing 3 by 2.0 results in 1.5 (floating-point division), and adding 5 yields 6.5.
QUESTION 2:
Which of the following is a valid variable declaration in most scripting languages?
A) int x = 5; ✅
B) 5 = x;
,C) x int = 5;
D) x == 5;
Rationale:
int x = 5; declares a variable x of type integer with the value 5. Other options either use
invalid syntax or represent comparison instead of assignment.
QUESTION 3:
Which operator is used to check equality in most programming languages?
A) =
B) == ✅
C) !=
D) <
Rationale:
== is the equality operator used to compare two values, while = is typically used for assignment.
QUESTION 4:
What is the output of the following code snippet?
x = 10
if x > 5:
print("Yes")
else:
print("No")
A) No
B) Yes ✅
C) Error
D) None
Rationale:
Since x is greater than 5, the if condition evaluates to true, and "Yes" is printed.
QUESTION 5:
Which data structure is best suited for storing an ordered collection of items that may include
duplicates?
A) Set
B) List/Array ✅
C) Dictionary
D) Stack
Rationale:
Lists or arrays maintain order and allow duplicate elements, making them suitable for ordered
collections of items.
,QUESTION: Given integer x = 3 and integer y = 5.
What is the value of the expression ( x / 2.0) + y?
A 5.0
B 6.0
C 6.5
7 7.5 - ANSWER-6.5
QUESTION: Given float x = 10.2 and float y = 1.0.
What is the value of the expression x / y ?
A 0.0
B 1.0
C 10
1
, Page 2 of 79
D 10.2 - ANSWER-10.2
QUESTION: What kind of operator is the == in the expression i == 20?
A Assignment
B Arithmetic
C Equality
D Logical - ANSWER-Equality
QUESTION: What is the purpose of parentheses () in a programming expression?
A To print expressions
B To group expressions
C To run expressions
D To compose expressions - ANSWER-To group expressions
QUESTION: Given float x = 3.0.
Which expression evaluates to 2.0?
Ax/3* 2+ 2
2