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

Updated On: 28-Feb-2026

Which two situations would be helped by using a programming library?

  1. A programmer needs to write several interacting objects for a student gradebook application, some of which need an inheritance structure.
  2. A programming student is writing code to iterate through the integers in a list and determine the maximum.
  3. A video game programmer needs to perform several animation tasks, all of which are very common in the industry. The programmer does not want to have to code each task. And they are unsure if they a even know how lo code a few of them.
  4. A programmer needs to perform a series of file compression tasks. These tasks are commonly performed by programmers, and the programmer does not want to have to code them all by hand
  5. A programmer is developing a database application that can house various types of data. The software cannot know ahead of time the data type, and so the programmer needs variables that do not require an initial declaration type.
  6. A programmer is writing a piece of mathematical code that requires the heavy use of recursive functions.

Answer(s): C,D

Explanation:

Programming libraries are collections of pre-written code that programmers can use to perform common tasks without having to write the code from scratch. They are particularly helpful in situations where:

The tasks are common and standardized across the industry, such as animation tasks in video games (Option C). Using a library can save time and resources, and also ensure that the animations are up to industry standards.

The tasks are well-known and frequently performed by many programmers, such as file compression (Option D). Libraries provide a reliable and tested set of functions that can handle these tasks efficiently.

For the other options:

A: While a library could be used, writing interacting objects and implementing inheritance is a fundamental part of object-oriented programming and may not necessarily require a library.

B: Iterating through a list to find the maximum value is a basic programming task that typically doesn't require a library.

E: Dynamic typing or the use of variables without an initial declaration type is a feature of the programming language itself rather than a library.

F: Recursive functions are a programming concept that can be implemented without the need for a library, unless the recursion is part of a specific algorithm that a library might provide.


Reference:

Programming libraries documentation and standards.

Industry best practices for video game development and file compression techniques.



Which data type should be used to hold the value of a person's body temperature in Fahrenheit?

  1. Integer
  2. String
  3. Float
  4. Boolean

Answer(s): C

Explanation:

Comprehensive and Detailed Explanation From Exact Extract:

Body temperature in Fahrenheit typically includes decimal precision (e.g., 98.6°F). According to foundational programming principles, a floating-point type is suitable for values with decimal components.

Option A: "Integer." This is incorrect. Integers cannot store decimal values, and body temperature often requires precision (e.g., 98.6 99).

Option B: "String." This is incorrect.
While a string could store "98.6" as text, it's not suitable for numerical calculations (e.g., averaging temperatures).

Option C: "Float." This is correct. A floating-point type (float) can store decimal values like 98.6, making it ideal for body temperature. For example, in C: float temp = 98.6;.

Option D: "Boolean." This is incorrect. Booleans store true/false values, not numerical temperatures.

Certiport Scripting and Programming Foundations Study Guide (Section on Data Types).

Python Documentation: "Floating Point Types"
(https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex).

W3Schools: "C Data Types" (https://www.w3schools.com/c/c_data_types.php).



What is required for all function calls?

  1. Parameters
  2. Input arguments
  3. Output values
  4. Function name

Answer(s): D

Explanation:

When calling a function in Python, you simply give the name of the function followed by parentheses. Even if the function doesn't take any arguments, you still need to include the parentheses. For example, print("Hello!") is a function call. The function name should describe what it's supposed to do. Function definitions begin with the def keyword, followed by the function name and parameters (if any). The statements within the function definition are indented and carry out the task the function is supposed to perform2.


Reference:

Function Calls and Definitions ­ Real Python

Function Calls | Microsoft Learn

Stack Overflow: Find all function calls by a function



Which operator is helpful in determining if an integer is a multiple of another integer?

  1. /
  2. $
  3. | |
  4. +

Answer(s): A

Explanation:

The operator that is helpful in determining if an integer is a multiple of another integer is the modulus operator, represented by / in some programming languages and % in others. This operator returns the remainder of the division of one number by another. If the remainder is zero, it indicates that the first number is a multiple of the second. For example, 6 % 3 would return 0, confirming that 6 is a multiple of 3.


Reference:

This explanation is based on standard programming knowledge where the modulus or remainder operator is used to determine multiples1.



A function should determine the average of x and y.
What should be the function's parameters and return value(s)?

  1. Parameters: x, y, averageReturn value: none
  2. Parameters: x, yReturn value: average
  3. Parameters: noneReturn values: x, y
  4. Parameters: averageReturn values: x, y

Answer(s): B

Explanation:

Comprehensive and Detailed Explanation From Exact Extract:

A function that calculates the average of two numbers (x and y) needs to take those numbers as inputs (parameters) and return their average as the output. According to foundational programming principles (e.g., Certiport Scripting and Programming Foundations Study Guide), functions should accept necessary inputs and return computed results, avoiding unnecessary parameters or outputs.

Option A: "Parameters: x, y, average; Return value: none." This is incorrect. Including average as a parameter is unnecessary since it is the result to be computed. A function with no return value (void in C) would not provide the average to the caller, which defeats the purpose.

Option B: "Parameters: x, y; Return value: average." This is correct. The function needs x and y as inputs to compute (x + y) / 2. The average is returned to the caller. For example, in Python: def average(x, y): return (x + y) / 2.

Option C: "Parameters: none; Return values: x, y." This is incorrect. Without parameters, the function cannot access x and y to compute the average. Returning x and y is irrelevant to the task.

Option D: "Parameters: average; Return values: x, y." This is incorrect. average is the output, not an input, and returning x and y does not provide the computed average.

Certiport Scripting and Programming Foundations Study Guide (Section on Functions).

Python Documentation: "Defining Functions"
(https://docs.python.org/3/tutorial/controlflow.html#defining-functions).

W3Schools: "C Functions" (https://www.w3schools.com/c/c_functions.php).






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

Join the Scripting-and-Programming-Foundations Discussion