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

Updated On: 28-Feb-2026

What does the following algorithm determine?

  1. Whether x is even
  2. Whether x is evenly divisible by 2 or 3
  3. Whether x is odd
  4. Whether x r> negative. 0, <x positive

Answer(s): C

Explanation:

The algorithm provided in the image performs a modulo operation with 2 (x % 2) and checks if the result is 1. In programming, the modulo operation gives the remainder of the division of two numbers. For any integer x, if x % 2 equals 1, it means that x is odd because it has a remainder of 1 when divided by 2. Even numbers, when divided by 2, have no remainder and thus would return 0 in a modulo 2 operation.


Reference:

The explanation is based on the standard definition and behavior of the modulo operation in programming and mathematics. For more information on algorithms and their applications, you can refer to resources such as GeeksforGeeks1 and Built In2.



What is the outcome for the given algorithm? Round to the nearest tenth, if necessary.

  1. 5.0
  2. 6.0
  3. 6.1
  4. 8.4

Answer(s): A

Explanation:

Initialize two variables: x and Count to zero.

Iterate through each number in the NumList.

For each number in the list:

Add the number to x.

Increment Count by one.

After processing all numbers in the list, calculate the average:

Average = x / Count.

The NumList contains the following integers: [1, 3, 5, 6, 7, 8].

Calculating the average: (1 + 3 + 5 + 6 + 7 + 8) / 6 = 30 / 6 = 5.0.

However, none of the provided options match this result. It seems there might be an error in either the options or the calculation.


Reference:

This explanation is based on understanding and analyzing the provided algorithm image; no external references are used.



What is an accurate way to describe a statically typed language?

  1. It uses methods that that produce consistent output based upon the arguments passed to those methods.
  2. It includes custom variable types with methods, information hiding, data abstraction, encapsulation, polymorphism, and inheritance.
  3. It is based on the concept of modularization and calling procedures or subroutines.
  4. It requires a large number of variables and variable conversions because of the need to commit to a variable type throughout the life of the program.

Answer(s): D

Explanation:

A statically typed language is one where the type of a variable is known at compile time. This means that the type of each variable must be declared and does not change throughout the program's execution.
While this can lead to a larger number of variable declarations and sometimes conversions, it also allows for type checking at compile time, which can catch many errors before the program runs. Statically typed languages include Java, C, C++, and others123.


Reference:

Baeldung on Computer Science provides a detailed comparison of statically and dynamically typed languages1.

Stack Overflow discussions offer insights into the characteristics of statically typed languages2.

Techopedia gives a concise definition of what it means for a language to be statically typed3.



What is output by calling Greeting() twice?

  1. Hello!
  2. Hello!!
  3. Hello!Hello!

Answer(s): C

Explanation:

Comprehensive and Detailed Explanation From Exact Extract:

The question is incomplete, as the definition of the Greeting() function is not provided. However, based on standard programming problem patterns and the output options, we assume Greeting() is a function that outputs "Hello!" each time it is called. According to foundational programming principles, calling a function multiple times repeats its output unless state changes occur.

Assumption: Greeting() outputs "Hello!" to the console (e.g., in Python: def Greeting():
print("Hello!")).

Calling Greeting() twice outputs "Hello!" twice, concatenated in the output stream as "Hello!Hello!" (assuming no extra newlines or spaces, as is typical in such problems).

Option A: "Hello!." This is incorrect. A single "Hello!" would result from one call, not two.

Option B: "Hello!!." This is incorrect. This suggests a modified output (e.g., adding an extra !), which is not implied by the function's behavior.

Option C: "Hello!Hello!." This is correct. Two calls to Greeting() produce "Hello!" twice, appearing as "Hello!Hello!" in the output.

Certiport Scripting and Programming Foundations Study Guide (Section on Function Calls and Output).

Python Documentation: "Print Function" (https://docs.python.org/3/library/functions.html#print).

W3Schools: "C Output" (https://www.w3schools.com/c/c_output.php).



It is given that integer x = 41 and integer y = 16.
What is the value of the expression (x % y)?

  1. -15
  2. -11
  3. -8
  4. 9

Answer(s): D

Explanation:

Comprehensive and Detailed Explanation From Exact Extract:

The modulo operator (%) returns the remainder when the first operand is divided by the second. According to foundational programming principles (e.g., C and Python standards), for integers x and y, x % y computes the remainder of x ÷ y.

Given: x = 41, y = 16.

Compute: 41 ÷ 16 = 2 (quotient, ignoring decimal) with a remainder.

16 × 2 = 32, and 41 - 32 = 9. Thus, 41 % 16 = 9.

Option A: "-15." This is incorrect. The modulo operation with positive integers yields a non-negative result.

Option B: "-11." This is incorrect. The result is positive and based on the remainder.

Option C: "-8." This is incorrect. The remainder cannot be negative here.

Option D: "9." This is correct, as calculated above.

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

C Programming Language Standard (ISO/IEC 9899:2011, Section on Multiplicative Operators).

Python Documentation: "Modulo Operator"
(https://docs.python.org/3/reference/expressions.html#binary-arithmetic-operations).






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

Join the Scripting-and-Programming-Foundations Discussion