FOUNDATIONS EXAM QUESTIONS AND ANSWERS
2025
1. What is the main purpose of programming?
A. To write long lines of code
B. To give instructions to a computer to solve a problem
C. To store data only
D. To replace databases
Answer: B
Explanation: Programming involves writing instructions that tell the computer how to
perform specific tasks.
2. In programming, what is an algorithm?
A. A hardware device
B. A list of random numbers
C. A step-by-step set of instructions to solve a problem
D. A data storage unit
Answer: C
Explanation: An algorithm outlines the logical steps to reach a solution before coding
begins.
3. Which of the following is a valid variable name in Python?
A. 1number
B. number_1
C. number-1
D. number 1
,WGU D278 SCRIPTING AND PROGRAMMING
FOUNDATIONS EXAM QUESTIONS AND ANSWERS
2025
Answer: B
Explanation: Variable names cannot start with numbers or contain spaces or hyphens.
4. What is the correct symbol for single-line comments in Python?
A. //
B. #
C. <!-- -->
D. /**/
Answer: B
Explanation: In Python, comments start with the # symbol.
5. What does the equal sign (=) mean in programming?
A. Comparison
B. Assignment
C. Addition
D. Equality test
Answer: B
Explanation: The equal sign assigns a value to a variable, not compares it.
6. Which data type would best represent a student’s name?
A. Integer
B. String
C. Float
D. Boolean
Answer: B
Explanation: A student’s name is textual data, represented by a string.
,WGU D278 SCRIPTING AND PROGRAMMING
FOUNDATIONS EXAM QUESTIONS AND ANSWERS
2025
7. What will the expression 3 + 4 * 2 evaluate to in Python?
A. 14
B. 11
C. 10
D. 8
Answer: B
Explanation: Python follows order of operations (PEMDAS), so 4 * 2 = 8, then 3 + 8 = 11.
8. Which keyword is used to create a function in Python?
A. define
B. func
C. function
D. def
Answer: D
Explanation: The keyword def defines a new function in Python.
9. What is the output of print(type(25.5))?
A. int
B. float
C. string
D. bool
Answer: B
Explanation: The number 25.5 includes a decimal, so it’s a float.
10. What does a loop allow a program to do?
A. Repeat actions until a condition is met
, WGU D278 SCRIPTING AND PROGRAMMING
FOUNDATIONS EXAM QUESTIONS AND ANSWERS
2025
B. Store data permanently
C. Ignore conditions
D. Stop immediately
Answer: A
Explanation: Loops repeat blocks of code as long as a condition remains true.
11. Which keyword starts a loop that checks a condition before running the body each time?
A. for
B. do
C. while
D. loop
Answer: C
Explanation: The while loop executes repeatedly while its condition evaluates to true.
12. Which of the following is a Boolean value?
A. 1.0
B. True
C. “Yes”
D. 0
Answer: B
Explanation: In Python, Boolean values are True and False.
13. Which function is used to display output to the screen?
A. display()
B. output()
C. print()