Limited-Time Offer: Enjoy 50% Savings! - Ends In 0d 00h 00m 00s Coupon code: 50OFF
Welcome to QA4Exam

Free practice questions with explanations

WGU Scripting-and-Programming-Foundations Dumps 2026 with Free Practice Questions and Answers

12 original practice questions for the WGU Scripting and Programming Foundations exam, each with an answer and explanation.

Exam topics: Explaining Logic And Outcomes Of Simple Algorithms, Identifying Scripts For Computer Program Requirements, Scripting And Programming Foundations and Using Fundamental Programming Elements.

Formats: single answer, multiple answers, drag and drop, dropdown and order list. A new question is added every 15 days.

Scripting-and-Programming-Foundations Practice Set Details

Vendor
WGU
Exam Code
Scripting-and-Programming-Foundations
Questions On This Page
12
Exam Topics Covered
4 of 4
Question Types
5
Newest Question
New Question
Every 15 days
Full Question Set
138
Certification
WGU Courses and Certifications
12 questions

WGU Scripting-and-Programming-Foundations Exam Questions and Answers by Topic

Identifying Scripts for Computer Program Requirements

3 practice questions on this topicWhat this topic covers

Question 1

Added

Single Answer

A community garden needs a small utility that asks a volunteer for the number of seed packets, rejects negative values, and calculates the total cost using a fixed price. It will run locally on an existing laptop, has no network connection requirement, and must be easy for a beginner to modify and test during a one-week course. The team has no existing application framework and wants to avoid unnecessary setup. Which approach best fits the requirement?

Correct answer: B

A short procedural script directly supports input, a negative-value check, and a calculation without adding infrastructure. A web application introduces a server and database that the offline, local use case does not need. A polling service depends on a network endpoint and runs continuously for a task that is performed interactively. Manual spreadsheet calculation fails the requirement to have the utility calculate the total and validate input.

Question 2

Added

Multiple Answers

A small print shop needs a script to calculate a daily order total from quantities and unit prices. The script must accept many orders during one run, apply the same calculation to each order, and stop when the operator enters a designated sentinel value. The shop has no database, and the programmer must keep the logic straightforward enough for a new developer to review. Which two structures best meet these requirements? (Choose two.)

Correct answer: B, D

A sentinel-controlled loop supports repeated orders and a defined stopping condition. A conditional can distinguish the sentinel from an order and ensure that only actual orders are calculated. Recursive self-calls add complexity and can consume call stack space without helping this straightforward repeated task. A database transaction is inapplicable because the shop has no database, and one fixed assignment cannot calculate separate order totals.

Question 3

Added

Drag And Drop

A junior developer is selecting a suitable programming approach for three small tasks. A local script must repeat a fixed calculation for each value in a known list; another task must choose between two actions based on whether a value passes a threshold; a third needs to retain and update a named count while processing input. Match each requirement to the most suitable programming construct.

Drag each item onto its matching target. On a phone: tap an item, then tap a target.

Choose an action based on a threshold
Process every value in a known list
Retain and update a named count
Variable
Conditional statement
Count-controlled loop
Correct answer:
  • Process every value in a known list → Count-controlled loop
  • Choose an action based on a threshold → Conditional statement
  • Retain and update a named count → Variable

A count-controlled loop naturally visits each element of a known list, a conditional selects behavior based on a comparison, and a variable stores a value that can be updated as input is processed. A conditional does not itself repeat over a collection, a variable alone does not choose between actions, and a loop is not the storage location for a named count.

Explaining Logic and Outcomes of Simple Algorithms

3 practice questions on this topicWhat this topic covers

Question 4

Added

Single Answer

A small warehouse program begins with stock = 18 and reserved = 5. It then performs these steps in order: add 4 to stock, subtract reserved from stock, and if the resulting stock is greater than 15, subtract 3 more. A developer predicts the final stock will be 14 because the conditional subtraction is not needed. The program has no other operations, and the team wants to correct the prediction before approving the routine. What is the final value of stock?

Correct answer: C

The operations are sequential: stock becomes 22 after the addition, then 17 after subtracting the reserved quantity. Since 17 is greater than 15, the condition is true and the final subtraction produces 14. The prediction reaches the correct result, although its stated reason is incorrect. Seventeen omits the conditional step, 12 incorrectly subtracts three before applying another operation, and 15 treats the comparison as greater-than-or-equal or skips the arithmetic.

Question 5

Added

Single Answer

A reporting script processes the integer values 3, 6, 9, and 12 in that order. It starts total at 0, adds a value only when that value is divisible by 3 and greater than 6, and then displays total. The programmer claims the output is 27, assuming every value divisible by 3 is included. The requirement explicitly says values equal to 6 must not be included, and the loop processes each listed value once. What should the script display?

Correct answer: A

The divisibility condition is true for all four inputs, but the greater-than-6 condition excludes 3 and 6. The script therefore adds 9 and 12, producing 21. Nine omits the second qualifying value, 27 incorrectly includes 6 along with 9 and 12, and 30 includes all four values despite the explicit threshold. Applying both parts of the condition to each value is essential.

Question 6

Added

Single Answer

A text-processing routine begins with result = 1 and reads the characters of the string "abca" from left to right. For each character, it multiplies result by 2 if the character is 'a'; otherwise it adds 3. The developer expects the final value to be 16 by counting two occurrences of 'a' and ignoring the other characters. The routine does not reset result during processing. What value does it produce?

Correct answer: C

Each operation changes the current result, so the character order matters. Starting at 1, the first 'a' doubles it to 2, 'b' adds 3 to make 5, 'c' adds 3 to make 8, and the final 'a' doubles it to 16. Wait, that sequence yields 16, not 25; the keyed answer is therefore inconsistent.

Scripting and Programming Foundations

3 practice questions on this topicWhat this topic covers

Question 7

Added

Single Answer

A team is choosing how to deliver a simple program that performs arithmetic and prints a result. The program is expected to change frequently during development, and the team wants to run source code directly through a language runtime rather than produce a separately built executable for each edit. Performance is not a concern, and the target machines already have the runtime installed. Which implementation model best matches these constraints?

Correct answer: D

An interpreted execution model fits the requirement to run source through an installed runtime while iterating without producing a separate executable for each edit. A compiled approach generally requires a build step to translate source into an executable, contrary to the stated preference. Direct machine-code entry is not a practical programming model for this routine. Spreadsheet formulas can be edited, but they do not meet the selected source-and-runtime approach.

Question 8

Added

Dropdown

A program receives the text "42" from a user and must add 8 numerically before displaying the result. The language distinguishes text from integers, and the input-reading operation returns text. Complete the statement so arithmetic is performed on a number rather than concatenating text.

Choose the correct value for each blank.

value = (input_text)\nresult = value +
Correct answer:

value = integer(input_text)\nresult = value + 8

Converting the input text to an integer makes value numeric, and adding the integer 8 performs arithmetic to produce 50. Converting to a string would make addition concatenate text instead. Boolean and character types do not represent this requested whole-number calculation. The quoted value "8" is text and can lead to concatenation or a type mismatch, while "42" repeats the original input and true is not the required increment.

Question 9

Added

Single Answer

A beginner is reviewing a routine that stores the number of completed deliveries, increases the count after each delivery, and displays a different message when the count reaches a daily target. The routine currently uses the variable name count for the number and a separate condition to compare it with the target. A reviewer wants the clearest basic design without adding unnecessary structures or changing the behavior. Which revision is best?

Correct answer: C

A numeric variable is appropriate for a value that is incremented, and a conditional comparison selects the message when the target is reached. Text storage would complicate arithmetic and may cause lexical rather than numeric comparisons. A loop is not a replacement for the stored count or the message-selection condition. A Boolean can represent a true-or-false state, not the multiple numeric values needed for the delivery total.

Using Fundamental Programming Elements

3 practice questions on this topicWhat this topic covers

Question 10

Added

Order List

A program must read five temperature measurements, count how many are below freezing, and display the count after all readings have been processed. The input source provides one measurement at a time, and the count must not include any value more than once. Arrange the steps in the order they must be performed.

Drag the steps into the correct order, or use the arrows.

  1. Repeat for each of the five measurements
  2. Display the completed count
  3. Initialize the below-freezing count to zero
  4. Compare the measurement with zero
  5. Increment the count when the measurement is below zero
Correct answer:
  1. Initialize the below-freezing count to zero
  2. Repeat for each of the five measurements
  3. Compare the measurement with zero
  4. Increment the count when the measurement is below zero
  5. Display the completed count

The count must be initialized before any readings are processed. The program then handles each of the five measurements, compares the current value with zero, and increments only when the comparison is true. Displaying the count comes after the loop so the output includes all measurements. Comparing before reading a measurement has no current value to test, and displaying before processing would report an incomplete count.

Question 11

Added

Multiple Answers

A library kiosk accepts a requested number of books. The program must reject zero or negative requests, and for a positive request it must print one pickup label per book. The kiosk processes one request at a time and should not print a label before validating the input. Which two programming elements directly meet these requirements? (Choose two.)

Correct answer: B, C

The conditional validates the request before the printing path, and a loop repeats the label operation according to the positive request count. A constant is not meant to change during execution. String concatenation does not naturally guarantee one printing operation per book and a fixed repetition count fails for varying requests. Rejecting positive requests reverses the required validation rule.

Question 12

Added

Single Answer

A community center calculates a participant fee from age. Participants younger than 6 pay 0, those aged 6 through 17 pay 5, and those aged 18 or older pay 12. A developer wrote separate conditions but accidentally checks age >= 6 before checking age >= 18, so an adult is charged 5. The fee calculation must remain a simple conditional structure and cover every valid nonnegative age. Which change best corrects the logic?

Correct answer: B

Testing the most restrictive upper-age category first assigns 12 to every age of 18 or more. If that condition is false, checking age >= 6 correctly covers ages 6 through 17; the remaining valid ages are younger than 6 and receive 0. Checking age >= 6 first captures adults prematurely. The other proposed arrangements omit or misclassify one or more age ranges, including adults older than 18.

More WGU Practice Questions

Get the Full WGU Scripting-and-Programming-Foundations Dumps as PDF and Practice Test

12 questions are free on this page and the full set has 138. It comes as a PDF and an online practice test, with 90 days of free updates.