Docsity

WGU D278 Scripting and Programming – Objective Assessment Guide & Tips, Exams of System Programming

Partial preview of the text

Download WGU D278 Scripting and Programming – Objective Assessment Guide & Tips and more Exams System Programming in PDF only on Docsity!

WGU D278 Objective Assessment for Scripting and Programming - Foundations includes accurate and verified questions covering Python fundamentals, control structures (if/else, loops), functions, data types, input/output operations, basic debugging, and Which operator should be used to determine if a number is evenly divisible by 52 At B- Cc* D% - ....ANSWER .. 7% A % A car drove 200 miles using 10 gallons of fuel. Which operation should be used to compute the miles per gallon, which is 202 A Addition B Subtraction C Multiplication 2) D Division - ..... ANSWER ...W W Division A variable should hold a person's height in meters. Which data type should the variable be? A Integer B Float C String D Boolean - .....ANSWER ... 7% AH Float A variable should hold the names of all past U.S. presidents. Which data type should the variable be? A Integer array B Float array C String array D Boolean array - .....ANSWER ... WW String Array A program uses the number of seconds in a minute in various calculations. 4| B 6.0 C 6.5 7 7.5 ~ 1. ANSWER ... S% SA 6.5 Given float x = 10.2 and float y = 1.0. What is the value of the expression x / y 2 A 0.0 B 1.0 C10 D 10.2 - .....ANSWER ... WY 10.2 What kind of operator is the == in the expression i == 202 A Assignment B Arithmetic C Equality D Logical - ..... ANSWER ... WW Equality What is the purpose of parentheses () in a programming expression? A To print expressions 5| B To group expressions C To run expressions D To compose expressions - .....ANSWER ... WW To group expressions Given float x = 3.0. Which expression evaluates to 2.0? Ax/3*2+2 Bx - 2/3 Cx+0.5 /2 Dx /2+0.5 /2 + .25 - .uuANSWER 0 A X/2+0.5/2+0.25 Which expression evaluates to true only when the user is within 3 years of 21 years, given a variable x containing a user's age? A x >= 18) or ( x <= 24) B( x >= 18) and ( x <= 24) C(x < 18) or ( x > 24) D (x < 18) and ( x > 24) - .....ANSWER uu. 4 A (X>=18) and (X<=24) 7\ D Hours, minutes, and seconds - .....ANSWER ...f7 A Hours and minutes A function returns a number x cubed. For example, if x is 3, the function returns 3 * 3 * 3, or 27. What should be the input to the function? Ax B x, x C x, x, x D 27 - ....ANSWER .. 7% A X A function calculates the weight difference (Diff) given two sample weights (S1 and $2). What should be the output from the function? A S1 only B S2 only C $1 and $2 D Diff - .....ANSWER ... 4% A Diff function P(integer x) returns integer y y=2*x What does P(5) evaluate to? A2 B5 Cc 10 D 25 - ....ANSWER ...% A 10 Function F() Put "Hey" to output What entire output appears after three successive calls to F()? A Hey B HHHey C HeyHeyHey D Hey Hey Hey -.....ANSWER ... YW W HeyHeyHey What is a valid user-defined function name? AA reserved word B Any valid identifier C Any variable name 10 | A If statement B For loop C Multiple if statements D While loop - .....ANSWER ...W% WZ While loop Joe is building an online game. He wants to provide a riddle and have the player guess the answer. The game needs to prompt the user to enter the answer, check to see if it the input provided does not match the correct answer, and continue prompting the user until the answer entered matches the correct answer. Which control structure supports Joe's needs? A For loop B While loop C Do-while loop D If-else branch - ....ANSWER ... WW Do-while loop What is put to output by the following pseudocode? x=3 do Put x to output | Put to output x=x-] while x > 0 A3210 B3210-1 C210 D321 -....ANSWER ..A7% YW 321 A programmer has developed the following code: count = 0 while count is less than 5: print ‘Hello’ What is the result of implementing this code? A ‘Hello’ will print four times. B 'Hello' will print five times. C The program will throw an error. D 'Hello' will print indefinitely. - ....ANSWER ... 7% SA ‘Hello’ will print indefinitely 13 | Ay=0 By=yt+1 Cs = 100.0 Ds=s+(s* 5.0) -....ANSWER..A7 Wy =0 Order the steps needed to output the minimum of x and y from first (1) to last (4). Select your answers from the pull-down list. A Declare variable min B Put min to output C min = x D If y < min, set min = y - .... ANSWER ... WZ W Declare variable min Min = x If y < min, set min = y Put min to output Order the steps needed to calculate speed in miles per hour given a start and end location and time traveled in hours from first (1) to last (4). Select your answers from the pull-down list. 14] A Put speedMph to output B Declare variables distMiles and speedMph C distMiles = endLocation - startLocation D speedMph = distMiles / timeHours - .....ANSWER .- WY oH Declare variables distMiles and speedMph distMiles = endLocation - startLocation speedMph = distMiles / timeHours Put speedMph to output BCDA Order the tasks needed to create a pyramid (large on bottom, small on top) on a table from first (1) to last (4). Select your answers from the pull-down list. A Place largest shape. B Clear table C Place smallest shape. D Place middle-sized shape. - .....ANSWER ... 7% A Clear table Place largest shape Place middle size shape Place smallest shape 16 | C Outputs -1 when x is positive D Outputs Goodbye when user types -1 - .....ANSWER «Sf J Outputs Goodbye when user types -1 What does an output of 1 indicate for the following algorithm running on a five-element list of integers? i=0 x=0 while i < 5 if list[i] < O x= 1 i=it+] Put x to output A All integers are positive. B All integers are negative. C At least one integer is negative. D At least one integer is positive. - ....ANSWER .. 7% A At least one integer is negative. When should a programmer develop an algorithm to solve a problem? 17 | A Before knowing the problem B Before writing a program to solve the problem C While writing a program to solve the problem D After writing a program to solve the problem - acca ANSWER ... WZ WS Before writing a program to solve the problem Which text represents an algorithm? A Cats and dogs have tails. B Insert key, turn key, open door. C The forecast for tomorrow is rain. D A box has balls, bats, and hats. - .....ANSWER SA A Insert key, turn key, open door. Which text represents an algorithm? A Shake bulb; if it rattles, replace it. B Water is wet; fire is not wet. C Staring at the sun hurts the eyes. 19 | What is put to output by the following flowchart, if the input is 3 5 -12 A35-1 B35 C610 D6 10 -2 - .... ANSWER .. 7% YW 6 10 What is the purpose of the following class diagram? A Shows how the Employee class is used in the program B Describes the execution flow of the Employee class’ operations C Specifies the Employee class' behavioral requirements D Depicts the Employee class' name, data members, and functions - .....ANSWER ...wW W Depicts the Employee class' name, data members, and functions What is the purpose of a use case diagram, such as the following diagram? A Describes how a user can interact with a program B Describes the data used in the program 20 | C Illustrates the flow of the program's algorithms D Shows the interaction between program components - sence ANSWER ...W W Describes how a user can interact with a program Which elements are characteristic of a class diagram? A System's classes, attributes, and methods and their features, constraints, and relationships B Flow of logic and process interaction within a system C Physical resources or logical architecture of a system D Internal structure of a class and collaboration between classes or instances - .....ANSWER ... WW System's classes, attributes, and methods and their features, constraints, and relationships Review the following use case diagram: What does a use case diagram do? A Diagrams a single use case B Connects several use cases to class diagrams C Provides an overview of several use cases