Month End Sale 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: clap70

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

Questions 4

A program calculates the average miles per gallon given miles traveled and gas consumed

How should the item that holds me miles per gallon be declared?

Options:

A.

Constant float milesTraveled

B.

Variable float milesPerGallon

C.

Variable float milesTraveled

D.

Constant float milesPerGallon

Buy Now
Questions 5

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

Options:

A.

It uses methods that that produce consistent output based upon the arguments passed to those methods.

B.

It includes custom variable types with methods, information hiding, data abstraction, encapsulation, polymorphism, and inheritance.

C.

It is based on the concept of modularization and calling procedures or subroutines.

D.

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.

Buy Now
Questions 6

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?

Options:

A.

Nested for loops

B.

One for loop

C.

One while loop

D.

If-else statement

Buy Now
Questions 7

Consider the given function.

What is the total output when F (sign, horse) is called 2 times?

Options:

A.

sign and horse sign and horse

B.

sign and horse sign and horse

C.

sign and horse sign and horse

D.

sign and horse and sign and horse

Buy Now
Questions 8

The steps in an algorithm to find the maximum of integers a and b are given.

Which two steps of the algorithm should be switched to make the algorithm successful?

Options:

A.

2 and 4

B.

2 and 3

C.

1 and 2

D.

1 and 3

Buy Now
Questions 9

What is an advantage of using a programming library?

Options:

A.

There is improved programmer productivity.

B.

Static program elements are visualized.

C.

There are more statements in a user’s main function

D.

Programs need not run to yield results.

Buy Now
Questions 10

A programming loam is using the waterfall design approach to create an application. Which deliverable would be produced during the design phase?

Options:

A.

A report of customer satisfaction

B.

A list of additional features to be added during revision

C.

A written description of the goals for the project

D.

The programming paradigm to be used

Buy Now
Questions 11

A sample function is shown:

What is returned for F (3)?

Options:

A.

12

B.

4

C.

-20

D.

-5

Buy Now
Questions 12

Which problem is solved by Dijkstra’s shortest path algorithm?

Options:

A.

Given an increasing array of numbers, is the number 19 in the array?

B.

Given an alphabetized list of race entrants and a person’s name, is the person entered in the race?

C.

Given two newspaper articles, what is the greatest sequence of words shared by both articles?

D.

Given the coordinates of five positions, what is the most fuel-efficient flight path?

Buy Now
Questions 13

An algorithm should output "OK" if a number is between 98.3 and 98.9, else the output is "Not OK." Which test is a valid test of the algorithm?

Options:

A.

Input 98.6. Ensure output is "Not OK."

B.

Input 98.6. Ensure output is "OK."

C.

Input 99.9. Ensure output is "OK."

D.

Input 99.9. Ensure output is "98.9."

Buy Now
Questions 14

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

Options:

A.

5.0

B.

6.0

C.

6.1

D.

8.4

Buy Now
Questions 15

A function determines the least common multiple (LCM) of two positive integers (a and b). What should be the input to the function?

Options:

A.

L only

B.

a * b

C.

a and L

D.

a and b

Buy Now
Questions 16

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

Options:

A.

After inputting two numbers, the program prints out the larger of the two

B.

A user is asked to enter a password repeatedly until either a correct password is entered or five incorrect attempts have been made.

C.

When the user Inputs a number, the program outputs "True" when the number Is a multiple of 10

D.

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.

Buy Now
Questions 17

A programmer has been hired to create an inventory system for a library. What is the Waterfall phase in which outlining all the functions that need to be written to support the inventory system occurs?

Options:

A.

Testing

B.

Analysis

C.

Design

D.

Implementation

Buy Now
Questions 18

The steps in an algorithm to calculate the positive difference in two given values, x and y, are given in no particular order:

What is the first step of the algorithm?

Options:

A.

Set Diff = x - y

B.

Put Diff to output

C.

Deduce variable Diff

D.

If y > x, set Diff = y - x.

Buy Now
Questions 19

Which characteristic distinguishes a markup language from other languages?

Options:

A.

It supports decomposing programs into custom types that often combine with other variable types into more concepts.

B.

It allows variables to change type during execution.

C.

It requires fewer variables and variable conversions than other languages because the types can change during execution.

D.

It does not perform complex algorithms, but instead describes the content and formatting of webpages and other documents.

Buy Now
Questions 20

Which phase of a Waterfall approach defines specifics on how to build a program?

Options:

A.

Design

B.

Testing

C.

Analysis

D.

Implementation

Buy Now
Questions 21

A programming team is using the Waterfall design approach to create an application. Which deliverable would be produced during the design phase?

Options:

A.

The programming paradigm to be used

B.

A list of additional features to be added during revision

C.

A report of customer satisfaction

D.

A written description of the goals for the project

Buy Now
Questions 22

What are two example of valid function calls?

Choose 2 answers.

Options:

A.

round_number(4.723, 2)

B.

convort_value(12) returns cVa1

C.

Printsample()

D.

CountFactors(96 integer)

E.

function Sample (float 2.0)

F.

GetHeight(integer 3, integer 4)

Buy Now
Questions 23

What is the proper way to declare a student's grade point average throughout the term it this item is needed in several places in a program?

Options:

A.

variable int gpa

B.

constant float gpa

C.

constant int gpa

D.

variable float gpa

Buy Now
Questions 24

A sample function is shown.

Y = -2 ‘’ x - 2

What is returned for f(-1)?

Options:

A.

-3

B.

0

C.

2

D.

6

Buy Now
Questions 25

What is the purpose of an activity diagram, such as the following diagram?

Options:

A.

Describes the execution flow of the PrintPositive activity

B.

Specifics the program’s components that must be present

C.

Visualizes the program's data values

D.

Specifies the program's behavioral requirements

Buy Now
Questions 26

What is a feature of CM as a programming language

Options:

A.

The code must be compiled into machine code in the form of an executable file before execution.

B.

The program usually runs slower than an interpreted language.

C.

The code runs directly one statement at a time by another program called a compiler

D.

The code does not require being translated into machine code but can be run by a separate program called a compiler.

Buy Now
Questions 27

Review the following sequence diagram:

What does a sequence diagram do?

Options:

A.

Shows interactions awl indicates an order of events

B.

Shows interactions but does not specify an order of events

C.

Shows sialic elements of software

D.

Shows an order of events but does not specify all interactions

Buy Now
Questions 28

Which line is a loop variable update statement in the sample code?

Options:

A.

integer h = 0

B.

h = h +1

C.

(userInput !=pwd) and (h <= 10)

D.

if userInput == pwd

Buy Now
Questions 29

A program adds a service fee to the total cost of concert tickets when the tickets are printed and mailed to customers. Another service fee is also added if the tickets are delivered overnight. Which control structure should be used?

Options:

A.

While loop

B.

Do-while loop

C.

If statement

D.

Multiple if statements

Buy Now
Questions 30

An example of an behavioral diagram is shown.

What is generally visualized with a behavioral diagram"?

Options:

A.

Quality control mechanisms

B.

Relative sizes of program components

C.

Operating system compatibility

D.

The dynamic flow of software

Buy Now
Questions 31

Which value would require an integer as a data type?

Options:

A.

The cost of a dinner including tax and tip.

B.

An approximation of the number pi to five decimal places.

C.

The weights of every patient involved in a pharmaceutical trial.

D.

The number of students in a section.

Buy Now
Questions 32

Which phase of an Agile approach would create a function that calculates shipping costs based on an item’s weight and delivery zip code?

Options:

A.

Testing

B.

Analysis

C.

Implementation

D.

Design

Buy Now
Questions 33

What would a string be used to store?

Options:

A.

A true/false indication of whether a number is composite.

B.

A positive number between 2 and 3.

C.

The word "positive."

D.

A positive whole number.

Buy Now
Questions 34

Which operation should be used to check if the difference of two values is greater than 1?

Options:

A.

Multiplication

B.

Subtraction

C.

Addition

D.

Division

Buy Now
Questions 35

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

NumList = [1, 3, 6, 6, 7, 3]

x = 0

Count = 0

for Number in NumList

x = x + Number

Count = Count + 1

x = x / Count

Put x to output

Options:

A.

5.0

B.

6.0

C.

6.1

D.

8.4

Buy Now
Questions 36

What is an example of an algorithm?

Options:

A.

The sign of two integers determines the sign of the product.

B.

The list contains apples, bananas, and oranges.

C.

A webpage uses an HTML file type.

D.

Unplug the device, wait 30 seconds, and restart the device.

Buy Now
Questions 37

Which expression evaluates to 14 if integer y = 13?

Options:

A.

11 + y % 5

B.

11 - y / 5.0

C.

(11 + y) % 5

D.

11.0 - y / 5

Buy Now
Questions 38

What is put to output by calling Greeting() twice

Options:

A.

Hello!

B.

Hello!Hello!

C.

Hello!

Buy Now
Questions 39

Which two operators are found in the snippet not (g != 8)?

Choose 2 answers.

Options:

A.

Equality and logical

B.

Logical and arithmetic

C.

Equality and arithmetic

D.

Assignment and arithmetic

Buy Now
Questions 40

Which action occurs the design phase of an agile process?

Options:

A.

Wring the required objects

B.

Deciding on the scope of the program

C.

Determining the goals of the project.

D.

Determining the functions that need to be written

Buy Now
Questions 41

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

Options:

A.

Integer

B.

String

C.

Float

D.

Boolean

Buy Now
Exam Name: WGU Scripting and Programming Foundations Exam
Last Update: Apr 26, 2025
Questions: 138
Scripting-and-Programming-Foundations pdf

Scripting-and-Programming-Foundations PDF

$25.5  $84.99
Scripting-and-Programming-Foundations Engine

Scripting-and-Programming-Foundations Testing Engine

$30  $99.99
Scripting-and-Programming-Foundations PDF + Engine

Scripting-and-Programming-Foundations PDF + Testing Engine

$40.5  $134.99