Examination
Description
This comprehensive practice examination covers foundational coding concepts for WGU D615A,
including algorithmic thinking, programming logic, data types, control structures, Python
fundamentals, SQL database operations, troubleshooting strategies, and software development best
practices. The exam features 500 original questions with detailed rationales to strengthen
understanding and prepare for the Objective Assessment and Pre-Assessment.
Question 1
Which characteristic distinguishes an algorithm from a simple set of instructions?
A. Algorithms must be written in a programming language B. Algorithms must terminate after a finite
number of steps C. Algorithms can only perform mathematical calculations D. Algorithms require
user input to function
Correct Answer: B
Rationale:
An algorithm is defined as an unambiguous, executable, and terminating specification for solving a
problem. The termination property means the algorithm must eventually stop after a finite number
of steps. Option A is incorrect because algorithms can be expressed in natural language,
pseudocode, or flowcharts—not exclusively programming languages. Option C is incorrect because
algorithms solve computational problems broadly, not just mathematical ones. Option D is incorrect
because many algorithms operate without user input.
Key Concept:
A valid algorithm must be unambiguous, executable, and terminate after finite steps.
Question 2
A programmer is developing a system to calculate employee bonuses based on years of service.
What is the FIRST step in creating this algorithm?
A. Write the code in Python B. Test the algorithm with sample data C. Determine the inputs and
expected outputs D. Create a flowchart of the process
Correct Answer: C
Rationale:
The first step in algorithm development is understanding the problem by identifying what inputs are
needed and what outputs are expected. For a bonus calculation, inputs would include years of
service and salary, while the output is the bonus amount. Option A is incorrect because coding
occurs after the algorithm is designed. Option B is incorrect because testing happens after
development. Option D is incorrect because flowchart creation follows problem decomposition.
Key Concept:
,Algorithm development begins with identifying inputs and outputs before any coding or design
work.
Question 3
Which data type would be most appropriate for storing the number of items in a shopping cart?
A. String B. Float C. Integer D. Boolean
Correct Answer: C
Rationale:
An integer is the appropriate data type for counting discrete items because quantities are whole
numbers without fractional components. Option A is incorrect because strings store text data.
Option B is incorrect because floats are used for numbers with decimal points. Option D is incorrect
because Boolean values represent only true/false states.
Key Concept:
Integer data types store whole numbers and are ideal for counting and indexing.
Question 4
What is the output of the following pseudocode?
SET x = 10
SET y = 3
DISPLAY x / y
A. 3 B. 3.333... C. 3.0 D. Error
Correct Answer: B
Rationale:
In most programming languages including Python, dividing two integers with the standard division
operator (/) produces a floating-point result. Therefore, equals approximately 3.333... Option
A would result from integer division (//). Option C is incorrect because the result is not exactly 3.0.
Option D is incorrect because division by a non-zero number is valid.
Key Concept:
Standard division of two integers in Python produces a float result, not an integer.
Question 5
A developer writes code that executes the same block of instructions repeatedly until a specific
condition becomes false. Which control structure is being used?
A. If-else statement B. While loop C. Function definition D. Switch statement
Correct Answer: B
Rationale:
,A while loop repeatedly executes a block of code as long as its condition remains true, terminating
when the condition becomes false. Option A is incorrect because if-else statements execute code
blocks once based on conditions. Option C is incorrect because functions are reusable code blocks,
not repetition structures. Option D is incorrect because switch statements select among multiple
alternatives, not repeat execution.
Key Concept:
While loops continue executing until a specified condition evaluates to false.
Question 6
What is the primary purpose of using comments in source code?
A. To increase program execution speed B. To explain code for human readers C. To store temporary
data values D. To create executable instructions
Correct Answer: B
Rationale:
Comments are annotations in code that explain what the code does, making it easier for humans to
understand and maintain. They are ignored by compilers and interpreters. Option A is incorrect
because comments do not affect execution speed. Option C is incorrect because comments cannot
store data values. Option D is incorrect because comments are non-executable.
Key Concept:
Comments improve code readability and are ignored during program execution.
Question 7
Which naming convention is demonstrated by the variable name numApples?
A. Snake case B. Upper camel case C. Lower camel case D. Kebab case
Correct Answer: C
Rationale:
Lower camel case capitalizes each word except the first, producing names like numApples or
totalPrice. Option A (snake case) uses underscores between words (num_apples). Option B
(upper camel case) capitalizes all words including the first (NumApples). Option D (kebab case) uses
hyphens (num-apples), which is invalid in most programming languages.
Key Concept:
Lower camel case joins words without spaces, capitalizing all words except the first.
Question 8
What is the result of the Boolean expression (x > 5) AND (x < 20) when x = 10?
A. True B. False C. 10 D. Error
Correct Answer: A
, Rationale:
The expression evaluates both conditions: (10 > 5) is true and (10 < 20) is true. Since the AND
operator requires both conditions to be true, the entire expression evaluates to true. Option B is
incorrect because both conditions are satisfied. Options C and D are incorrect because logical
expressions return Boolean values, not numbers or errors.
Key Concept:
The AND operator returns true only when both operands are true.
Question 9
Which SQL clause is used to filter rows returned by a SELECT statement?
A. FROM B. WHERE C. ORDER BY D. GROUP BY
Correct Answer: B
Rationale:
The WHERE clause specifies conditions that rows must meet to be included in the result set,
effectively filtering the data. Option A (FROM) specifies which table to query. Option C (ORDER BY)
sorts results. Option D (GROUP BY) aggregates rows with shared values.
Key Concept:
The WHERE clause filters rows based on specified conditions in SQL queries.
Question 10
What is the relationship between scripting languages and programming languages?
A. Scripting languages are compiled versions of programming languages B. Scripting languages are a
subset of programming languages C. Scripting languages replace programming languages entirely D.
Scripting languages are unrelated to programming languages
Correct Answer: B
Rationale:
Scripting languages represent a subgroup of programming languages, typically interpreted rather
than compiled, and designed for specific tasks like automation and rapid prototyping. Option A is
incorrect because scripting languages are generally interpreted, not compiled. Option C is incorrect
because scripting languages complement rather than replace general-purpose languages. Option D is
incorrect because scripting languages are programming languages.
Key Concept:
Scripting languages are a specialized subset of programming languages, often interpreted.
Question 11
Which component of a database translates high-level request instructions into low-level file-system
commands?