WGU Scripting-and-Programming-Foundations Exam Questions
WGU Scripting and Programming Foundations (Page 3 )

Updated On: 28-Feb-2026

A software engineer has written a program that uses a large number of interacting custom data types information hiding, data abstraction encapsulation polymorphism, and inheritance Variables do not need to receive their types ahead of time, and this program can run on a variety of operating systems without having to re-compile the program into machine code.

Which type of language is being used? Choose 3 terms that accurately describe the language.

  1. Markup
  2. Interpreted
  3. Object-oriented
  4. Procedural
  5. Dynamic
  6. Static

Answer(s): B,C,E

Explanation:

The language described in the question exhibits characteristics of an interpreted, object-oriented, and dynamic language. Here's why these terms apply:

Interpreted: The program can run on various operating systems without re-compilation, which is a trait of interpreted languages. Interpreted languages are executed line by line by an interpreter at runtime, rather than being compiled into machine code beforehand123.

Object-oriented: The use of concepts like information hiding, data abstraction, encapsulation, polymorphism, and inheritance are hallmarks of object-oriented programming (OOP). OOP languages are designed around objects and classes, which allow for modular, reusable, and organized code456.

Dynamic: Variables in the program do not need to have their types declared ahead of time, indicating dynamic typing. In dynamically typed languages, type checking is performed at runtime, and variables can be assigned to different types of data over their lifetime7891011.


Reference:

Interpreted languages123.

Object-oriented programming characteristics456.

Dynamic typing in programming7891011.



What is one characteristic of an object-oriented language that is not a characteristic of a procedural or functional language?

  1. The language is based on the concept of modular programming and the calling of a subroutine.
  2. The language is optimized for recursive programming.
  3. The language supports decomposing a program into objects that interact with one another.
  4. The language treats programs as evaluating mathematical functions.

Answer(s): C

Explanation:

One of the fundamental characteristics of object-oriented programming (OOP) is the concept of decomposing a program into objects that interact with one another1. This is distinct from procedural and functional programming paradigms, which do not inherently structure programs as a collection of objects. In OOP, objects are instances of classes and contain both data (attributes) and code (methods). These objects encapsulate data and operations and can interact with each other through methods, allowing for concepts such as inheritance, polymorphism, and encapsulation12.

In contrast, procedural programming is characterized by a focus on procedures or routines to perform tasks, and functional programming treats computation as the evaluation of mathematical functions without side effects or state changes2. Neither paradigm organizes code around objects with encapsulated data and methods, which is a defining feature of OOP1.


Reference:

1: Differences between Procedural and Object Oriented Programming - GeeksforGeeks
2: Functional vs. Procedural vs. OOP | Scout APM



What is one task that could be accomplished using a while loop?

  1. When the user inputs a number, the program outputs "True" when the number is a multiple of 10.
  2. The user inputs an integer, and the program prints out whether the number is even or odd and whether the number is positive, negative, or zero.
  3. After inputting two numbers, the program prints out the larger of the two.
  4. A user is asked to enter a password repeatedly until either a correct password is entered or five attempts have been made.

Answer(s): D

Explanation:

Comprehensive and Detailed Explanation From Exact Extract:

A while loop repeatedly executes a block of code as long as a condition is true, making it suitable for tasks requiring iteration until a condition changes. According to foundational programming principles, while loops are ideal for scenarios with an unknown number of iterations or conditional repetition.

Option A: "When the user inputs a number, the program outputs 'True' when the number is a multiple of 10." This is incorrect. This task requires a single check (number % 10 == 0), which can be done with an if statement, not a loop.

Option B: "The user inputs an integer, and the program prints out whether the number is even or odd and whether the number is positive, negative, or zero." This is incorrect. This task involves a single input and multiple conditional checks, handled by if statements, not a loop.

Option C: "After inputting two numbers, the program prints out the larger of the two." This is incorrect. Comparing two numbers requires a single if statement (e.g., if (a > b)), not a loop.

Option D: "A user is asked to enter a password repeatedly until either a correct password is entered or five attempts have been made." This is correct. This task requires repeated input until a condition is met (correct password or five attempts), which is ideal for a while loop. For example, in Python:

attempts = 0

while attempts < 5 and input("Password: ") != "correct":

attempts += 1

Certiport Scripting and Programming Foundations Study Guide (Section on Control Structures:
Loops).

Python Documentation: "While Statements"
(https://docs.python.org/3/reference/compound_stmts.html#while).

W3Schools: "C While Loop" (https://www.w3schools.com/c/c_while_loop.php).



A program allows the user to play a game. At the end of each game, the program asks the user if they want to play again.

Which programming structure on its own is appropriate to accomplish this task?

  1. Nested for loops
  2. One for loop
  3. One while loop
  4. If-else statement

Answer(s): C

Explanation:

The most appropriate programming structure to repeatedly ask a user if they want to play a game again is a while loop. This is because a while loop can execute a block of code as long as a specified condition is true. In this case, the condition would be whether the user wants to play again or not. The while loop will continue to prompt the user after each game and will only exit if the user indicates they do not want to play again. This makes it an ideal choice for tasks that require repeated execution based on user input.

For loops are generally used when the number of iterations is known beforehand, which is not the case here as we cannot predict how many times a user will want to play the game. Nested for loops and if-else statements are not suitable for repeating tasks based on dynamic user input.


Reference:

Loops in Programming - GeeksforGeeks1

Use the right loop to repeat tasks - Learn programming with Java - OpenClassrooms2

Using For and While Loops for User Input in Python - Stack Abuse3



What is the out of the given pseudocode?

  1. 6
  2. 12
  3. 15
  4. 18

Answer(s): C

Explanation:

The pseudocode provided appears to be a loop that calculates the sum of numbers. Without seeing the exact pseudocode, I can deduce based on common programming patterns that if the loop is designed to add numbers from 1 to 5, the sum would be 1 + 2 + 3 + 4 + 5, which equals 15. This is a typical example of a series where the sum of the first n natural numbers is given by the formula

2n(n+1)

, and in this case, with n being 5, the sum is

25(5+1) =15


Reference:

This answer is based on the standard algorithm for the sum of an arithmetic series and common looping constructs in programming. The formula for the sum of the first n natural numbers is a well-known result in mathematics and is often used in computer science to describe the behavior of loops and series calculations.






Post your Comments and Discuss WGU Scripting-and-Programming-Foundations exam dumps with other Community members:

Join the Scripting-and-Programming-Foundations Discussion