WGU Scripting-and-Programming-Foundations Exam (page: 2)
WGU Scripting and Programming Foundations
Updated on: 24-Mar-2026

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.



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).



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.



Viewing Page 2 of 19



Share your comments for WGU Scripting-and-Programming-Foundations exam with other users:

Ron 5/30/2023 8:33:00 AM

these dumps are pretty good.
Anonymous


Sowl 8/10/2023 6:22:00 PM

good questions
UNITED STATES


Blessious Phiri 8/15/2023 2:02:00 PM

dbua is used for upgrading oracle database
Anonymous


Richard 10/24/2023 6:12:00 AM

i am thrilled to say that i passed my amazon web services mls-c01 exam, thanks to study materials. they were comprehensive and well-structured, making my preparation efficient.
Anonymous


Janjua 5/22/2023 3:31:00 PM

please upload latest ibm ace c1000-056 dumps
GERMANY


Matt 12/30/2023 11:18:00 AM

if only explanations were provided...
FRANCE


Rasha 6/29/2023 8:23:00 PM

yes .. i need the dump if you can help me
Anonymous


Anonymous 7/25/2023 8:05:00 AM

good morning, could you please upload this exam again?
SPAIN


AJ 9/24/2023 9:32:00 AM

hi please upload sre foundation and practitioner exam questions
Anonymous


peter parker 8/10/2023 10:59:00 AM

the exam is listed as 80 questions with a pass mark of 70%, how is your 50 questions related?
Anonymous


Berihun 7/13/2023 7:29:00 AM

all questions are so important and covers all ccna modules
Anonymous


nspk 1/19/2024 12:53:00 AM

q 44. ans:- b (goto setup > order settings > select enable optional price books for orders) reference link --> https://resources.docs.salesforce.com/latest/latest/en-us/sfdc/pdf/sfom_impl_b2b_b2b2c.pdf(decide whether you want to enable the optional price books feature. if so, select enable optional price books for orders. you can use orders in salesforce while managing price books in an external platform. if you’re using d2c commerce, you must select enable optional price books for orders.)
Anonymous


Muhammad Rawish Siddiqui 12/2/2023 5:28:00 AM

"cost of replacing data if it were lost" is also correct.
SAUDI ARABIA


Anonymous 7/14/2023 3:17:00 AM

pls upload the questions
UNITED STATES


Mukesh 7/10/2023 4:14:00 PM

good questions
UNITED KINGDOM


Elie Abou Chrouch 12/11/2023 3:38:00 AM

question 182 - correct answer is d. ethernet frame length is 64 - 1518b. length of user data containing is that frame: 46 - 1500b.
Anonymous


Damien 9/23/2023 8:37:00 AM

i need this exam pls
Anonymous


Nani 9/10/2023 12:02:00 PM

its required for me, please make it enable to access. thanks
UNITED STATES


ethiopia 8/2/2023 2:18:00 AM

seems good..
ETHIOPIA


whoAreWeReally 12/19/2023 8:29:00 PM

took the test last week, i did have about 15 - 20 word for word from this site on the test. (only was able to cram 600 of the questions from this site so maybe more were there i didnt review) had 4 labs, bgp, lacp, vrf with tunnels and actually had to skip a lab due to time. lots of automation syntax questions.
EUROPEAN UNION


vs 9/2/2023 12:19:00 PM

no comments
Anonymous


john adenu 11/14/2023 11:02:00 AM

nice questions bring out the best in you.
Anonymous


Osman 11/21/2023 2:27:00 PM

really helpful
Anonymous


Edward 9/13/2023 5:27:00 PM

question #50 and question #81 are exactly the same questions, azure site recovery provides________for virtual machines. the first says that it is fault tolerance is the answer and second says disater recovery. from my research, it says it should be disaster recovery. can anybody explain to me why? thank you
CANADA


Monti 5/24/2023 11:14:00 PM

iam thankful for these exam dumps questions, i would not have passed without this exam dumps.
UNITED STATES


Anon 10/25/2023 10:48:00 PM

some of the answers seem to be inaccurate. q10 for example shouldnt it be an m custom column?
MALAYSIA


PeterPan 10/18/2023 10:22:00 AM

are the question real or fake?
Anonymous


CW 7/11/2023 3:19:00 PM

thank you for providing such assistance.
UNITED STATES


Mn8300 11/9/2023 8:53:00 AM

nice questions
Anonymous


Nico 4/23/2023 11:41:00 PM

my 3rd purcahse from this site. these exam dumps are helpful. very helpful.
ITALY


Chere 9/15/2023 4:21:00 AM

found it good
Anonymous


Thembelani 5/30/2023 2:47:00 AM

excellent material
Anonymous


vinesh phale 9/11/2023 2:51:00 AM

very helpfull
UNITED STATES


Bhagiii 11/4/2023 7:04:00 AM

well explained.
Anonymous