Download WGU C173 SCRIPTING AND PROGRAMMING – FOUNDATIONS FINAL PREP EXAM and more Exams Programming Languages in PDF only on Docsity!
1 g/g 38
WGU C173 SCRIPTING AND PROGRAMMING – FOUNDATIONS
FINAL PREP EXAM
- Whichgoperatorgshouldgbegusedgtogdeterminegifgagnumbergisgevenlygdivisiblegb yg5? Ag+ Bg- Cg* Dg%:g%
- Agcargdroveg 200 gmilesgusingg 10 ggallonsgofgfuel. Whichgoperationgshouldgbegusedgtogcomputegthegmilesgperggallon,gwhichgisg20? AgAddition Bg Subtraction CgMultiplication DgDivision:gDivision
2 g/g 38
- ^^gAgvariablegshouldgholdgagperson'sgheightgingmeters. Whichgdatagtypegshouldgthegvariablegbe? AgInteger BgFloat CgString DgBoolean:gFloat
- ^^gAgvariablegshouldgholdgthegnamesgofgallgpastgU.S.gpresidents. Whichgdatagtypegshouldgthegvariablegbe? AgIntegergarray BgFloatgarray CgStringgarray DgBooleangarray:gStringgarray
4 g/g 38 AgConstantgintegergminAge BgVariablegintegergminAge CgConstantgintegerg 35 DgVariablegintegerg35:gConstantgintegergminAge
- Givengintegergxg=g 3 gandgintegergyg=g5. Whatgisgthegvaluegofgthegexpressiong(gxg/g2.0)g+gy? Ag5. Bg6. Cg6. 7 g7.5:g6.
- Givengfloatgxg=g10.2gandgfloatgyg=g1.0. Whatgisgthegvaluegofgthegexpressiongxg/gyg? Ag0. Bg1. Cg 10
7 g/g 38
- Whichgexpressiongevaluatesgtogtruegonlygwhengthegusergisgwithing 3 gyearsgofg 2 1 gyears,ggivengagvariablegxgcontaininggaguser'sgage? Agxg>=g18)gorg(gxg<=g24) Bg(gxg>=g18)gandg(gxg<=g24)
8 g/g 38 Cg(gxg<g18)gorg(gxg>g24) Dg(gxg<g18)gandg(gxg>g24):g(gxg>=g18)gandg(gxg<=g24)
- ^^gWhichgdatagtypegisgusedgforgitemsgthatgaregmeasuredginglength? AgInteger BgFloat CgString DgBoolean:gFloat
- ^^gWhichgdatagtypegshouldgbegusedgtogkeepgtrackgofghowgmanygplanesgareging aghangar? AgInteger Bg Float CgString DgBoolean:gInteger
- Agfunctiongshouldgconvertghoursgandgminutesgtogseconds,gsuchgasgconvert- gingg 1 ghourgandg 10 gminutesgtog4,200gseconds. Whatgshouldgbegtheginputgtogthegfunction? AgHoursgonly
10 g/ g 38 CgHoursgandgminutes DgHours,gminutes,gandgseconds:gHoursgandgminutes
- Agfunctiongreturnsgagnumbergxgcubed.gForgexample,gifgxgisg3,gthegfunctiongret urnsg 3 gg 3 gg3,gorg27. Whatgshouldgbegtheginputgtogthegfunction? Agx Bgx,gx Cgx,gx,gx Dg27:gx
- Agfunctiongcalculatesgthegweightgdifferenceg(Diff)ggivengtwogsamplegweightsg (S1gandgS2). Whatgshouldgbegthegoutputgfromgthegfunction? AgS1gonly BgS2gonly CgS1gandgS DgDiff:gDiff
- functiongP(integergx)greturnsgintegergy
11 g/ g 38 yg=g 2 g*gx
13 g/ g 38
- AgfunctiongMyFctghasganginputgxgandgangoutputgz. WhatgdoesgMyFctgreturn? AgNothing Bgxgonly Cgzgonly Dgxgandgz:gzgonly
- Whatgisgthegreturngvaluegofgagfunction? AgOutputgofgagfunction BgCallgtogrungthegfunction CgDatagpassedgtogthegfunction DgVariablegingthegdeclarationgofgthegfunction:gOutputgofgagfunction
- Agprogramgshouldgcontinuegacceptingginputgnumbers,gaddinggeachgtogags um,guntilgag 0 gisginput. Whichgcontrolgstructuregshouldgbegused? AgIfgstatement BgForgloop
14 g/ g 38 CgMultiplegifgstatements
16 g/ g 38
- Joegisgbuildinggangonlineggame.gHegwantsgtogprovidegagriddlegandghave thegplayergguessgtheganswer.gTheggamegneedsgtogpromptgthegusergtogentergthegan swer,gcheckgtogseegifgitgtheginputgprovidedgdoesgnotgmatchgthegcorrectganswer,gan dgcontinuegpromptinggtheguserguntilgtheganswergenteredgmatchesgthegcorrectgan swer. WhichgcontrolgstructuregsupportsgJoe'sgneeds? AgForgloop BgWhilegloop CgDo-whilegloop DgIf-elsegbranch:gDo-whilegloop
- Whatgisgputgtogoutputgbygthegfollowinggpseudocode? xg=g 3 gd o PutgxgtogoutputgP utg"g"gtogoutputgxg =gxg-g 1
17 g/ g 38 whilegxg>g 0
19 g/ g 38 Putgigtogoutput
20 g/ g 38 ig=gig+g 1 Agi Bgi<20g/> Cgig=g 0 Dgig=gig+g1:gi<20g/>
- Whatgisgthegloopgvariableginitializationgingthegfollowinggpseudocode? yg=g 0 sg=g100. whilegyg<g 10 sg=gsg+g(sgg5.0)gy g=gyg+g 1 Agyg=g 0 Bgyg=g yg+g 1 Cgsg=g100. Dgsg=gsg+g(gsgg5.0):gyg=g 0
- Ordergthegstepsgneededgtogoutputgthegminimumgofgxgandgygfromgfirstg(1)gtog las