Weekend Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 70percent

WGU Scripting-and-Programming-Foundations WGU Scripting and Programming Foundations Exam Exam Practice Test

WGU Scripting and Programming Foundations Exam Questions and Answers

Question 1

Which snippet represents the loop condition expression in the given code?

Options:

A.

Integer f = 1

B.

Put f to output

C.

F < 27

D.

F = f + 2

Question 2

What does the following algorithm determine?

Options:

A.

Whether x is even

B.

Whether x is evenly divisible by 2 or 3

C.

Whether x is odd

D.

Whether x r> negative. 0,

Question 3

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

integer h = 0

do

Put "What is the password?" to output

String userInput = Get next input

if userInput != pwd

Put "Incorrect." to output

h = h + 1

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

if userInput = pwd

Put "Access granted." to output

else

Put "Access denied." to output

Options:

A.

if userInput = pwd

B.

h = h + 1

C.

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

D.

integer h = 0

Question 4

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

Question 5

A software developer creates a list of all objects and functions that will be used in a board game application and then begins to write the code for each object. Which two phases of the Agile approach are being carried out?

Options:

A.

Analysis and design

B.

Design and implementation

C.

Analysis and implementation

D.

Design and testing

Question 6

Which three statements describe a characteristic of a programming library?

Options:

A.

A library typically must be included before any function in the library is used

B.

A single library normally includes more than one function.

C.

Using libraries will always make a program run less efficiently.

D.

Libraries improve a programmer's productivity.

E.

A single program can only include one library.

F.

One library will contain one function but can have several variables.

Question 7

A particular sorting takes integer list 10,8 and incorrectly sorts the list to 6, 10, 8.

What is true about the algorithm’s correctness for sorting an arbitrary list of three integers?

Options:

A.

The algorithm only works for 10,6, 8

B.

The algorithm is correct

C.

The algorithm's correctness is unknown

D.

The algorithm is incorrect

Question 8

What would a string be used to store?

Options:

A.

A positive whole number

B.

The word "positive"

C.

A true/false indication of whether a number is composite

D.

A positive number between 2 and 3

Question 9

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.

Question 10

What is put to output by calling Greeting() twice

Options:

A.

Hello!

B.

Hello!Hello!

C.

Hello!

Question 11

Which snippet represents the loop variable update statement in the given code?

integer h = 7

while h < 30

Put h to output

h = h + 2

Options:

A.

h < 30

B.

h = h + 2

C.

Put h to output

D.

integer h = 7

Question 12

What are two examples of valid function calls?

Choose 2 answers.

Options:

A.

function sample(float 2.0)

B.

GetHeight(integer 3, 4)

C.

round(4.723, 2)

D.

PrintSample()

Question 13

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

Options:

A.

A programmer needs to write several interacting objects for a student gradebook application, some of which need an inheritance structure.

B.

A programming student is writing code to iterate through the integers in a list and determine the maximum.

C.

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.

D.

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

E.

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.

F.

A programmer is writing a piece of mathematical code that requires the heavy use of recursive functions.

Question 14

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

Options:

A.

Implementation

B.

Testing

C.

Analysis

D.

Design

Question 15

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

Options:

A.

/

B.

||

C.

+

D.

%

Question 16

Which expression evaluates to 4 if integer y = 3?

Options:

A.

0 - y / 5.0

B.

(1 + y) * 5

C.

11.0 - y / 5

D.

11 + y % 5

Question 17

A function should return 0 if a number, N is even and 1 if N is odd.

What should be the input to the function?

Options:

A.

Even

B.

1

C.

0

D.

N

Question 18

Which phase of a waterfall approach defines specifies on how to build a program?

Options:

A.

Analysis

B.

Implementation

C.

Design

D.

Testing

Question 19

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

Question 20

A team of programmers describes the objects and functions in a program that compresses files before splitting the objects. Which Waterfall approach phases are involved?

Options:

A.

Analysis and implementation

B.

Design and implementation

C.

Implementation and testing

D.

Design and testing

Question 21

Consider the given function:

function K(string s1, string s2)

Put s1 to output

Put " and " to output

Put s2 to output

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

Options:

A.

sign and horse and sign and horse

B.

sign and horsesign and horse

C.

sign and horse

D.

sign and horse

E.

sign and horse sign and horse

Question 22

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

Question 23

Which output results from the given algorithm?

Options:

A.

1

B.

5

C.

10

D.

60

Question 24

Which type of language requires variables to be declared ahead of time and prohibits their types from changing while the program runs?

Options:

A.

Scripted (interpreted)

B.

Procedural

C.

Static

D.

Compiled

Question 25

What does a function definition consist of?

Options:

A.

The function’s name, inputs, outputs, and statements

B.

A list of all other functions that call the function

C.

An invocation of a function’s name

D.

The function’s argument values

Question 26

A software developer determines the mathematical operations that a calculator program should support When two waterfall approach phases are involved?

Options:

A.

Design and Testing

B.

Implementation and testing

C.

Design and implementation

D.

Analysis and design

Question 27

What is a characteristic of an interpreted language?

Options:

A.

Is restricted to running on one machine

B.

Generates syntax errors during compilation

C.

Can be run by a user one statement at a time

D.

Has a programmer writing machine code

Question 28

An algorithm should output ‘’OK’’ if a number is between 98.3 and 98.9, else the output is ‘’Net OK’’

Which test is a valid test of the algorithm?

Options:

A.

Input 99.9. Ensure output is M98 9 "

B.

Input 98.6. Ensure output is "OK "

C.

Input 99.9. Ensure output is "OK"

D.

Input 98.6. Ensure output is "Not OK ‘’

Question 29

A function should convert a Fahrenheit temperature (F) to a Celsius temperature. What should be the output from the function?

Options:

A.

C only

B.

F only

C.

F and C

D.

F and 32

Question 30

What is a string?

Options:

A.

A built-in method

B.

A very precise sequence of steps

C.

A sequence of characters

D.

A name that refers to a value

Question 31

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

Options:

A.

Variable float gpa

B.

Constant float gpa

C.

Variable int gpa

D.

Constant int gpa

Question 32

What is the loop variable update statement in the following code?

Options:

A.

Put j to output

B.

Integer j = -1

C.

J < 24

D.

J = j + 3

Question 33

What is an argument?

Options:

A.

A piece of information provided in a function call

B.

A declared piece of information within a function

C.

A piece of information assigned to a function's output

D.

An input named in the definition of a function

Question 34

Which two operators can be used for checking divisibility of a number?

Choose 2 answers.

Options:

A.

^

B.

*

C.

+

D.

$

E.

/

F.

%

Question 35

What is output by calling Greeting() twice?

Options:

A.

Hello!

B.

Hello!!

C.

Hello!Hello!

Question 36

Which two types of operators are found in the code snippet not (g != S)?

Options:

A.

Equality and arithmetic

B.

Assignment and arithmetic

C.

Equality and logical

D.

Logical and arithmetic

Question 37

A software developer creates a list of all objects and functions that will be used in a board game application and then begins to write the code for each object.

Options:

A.

Analysis and implementation

B.

Analysis and design

C.

Design and implementation

D.

Design and testing

Question 38

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?

Question 39

Which term refers to a function that represents the number of fixed-size memory units used for an input of a given size?

Options:

A.

Space complexity

B.

Linear search

C.

Computational complexity

D.

Runtime

Question 40

Consider the given flowchart.

What is the output of the input is 7?

Options:

A.

Within 5

B.

Within 2

C.

Equal

D.

Not close