Download WGU C173 SCRIPTING AND PROGRAMMING – FOUNDATIONS OBJECTIVE ASSESSMENT QUESTIONS AND FINAL and more Exams Programming Languages in PDF only on Docsity!
1 g/g 18
WGU C173 SCRIPTING AND PROGRAMMING – FOUNDATIONS
OBJECTIVE ASSESSMENT QUESTIONS AND
FINAL EXAM REVIEW AT THE END
- Whichgoperatorgshouldgbegusedgtogdeterminegifgagnumbergisgevenlygdivisiblegb yg5? Ag+ Bg- Cg* Dg%:gD
- Agcargdroveg 200 gmilesgusingg 10 ggallonsgofgfuel. Whichgoperationgshouldgbegusedgtogcomputegthegmilesgperggallon,gwhichgisg20? AgAddition Bg Subtraction CgMultiplication DgDivision:gD
- Agvariablegshouldgholdgagperson'sgheightgingmeters. Whichgdatagtypegshouldgthegvariablegbe?
2 g/g 18 AgInteger BgFloat CgString DgBoolean:Gb
- AgvariablegshouldgholdgthegnamesgofgallgpastgU.S.gpresidents. Whichgdatagtypegshouldgthegvariablegbe? AgIntegergarray BgFloatgarray CgStringgarray DgBooleangarray:gC
- Agprogramgusesgthegnumbergofgsecondsgingagminutegingvariousgcalculations. Howgshouldgthegitemgthatgholdsgthegnumbergofgsecondsgingagminutegbegde-gclared? AgConstantgfloatguserTime BgVariablegfloatguserTime CgConstantgintegergsecondsPerMinute DgVariablegintegergsecondsPerMinute:gC
- Agprogramgdeterminesgifgaguser'sgagegisghighgenoughgtogrungforgU.S.gpresi- gdent.gThegminimumgagegrequirementgisg35. Howgshouldgthegitemgthatgholdsgthegminimumgagegbegdeclared?
4 g/g 18
- Whatgisgthegpurposegofgparenthesesg()gingagprogramminggexpression? AgTogprintgexpressions BgToggroupgexpressions CgTogrungexpressions DgTogcomposegexpressions:gB
- Givengfloatgxg=g3.0. Whichgexpressiongevaluatesgtog2.0? Agxg/g 3 g*g 2 g+g 2 Bgxg-g2/ Cgxg+g0.5g/ Dgxg/g 2 g+g0.5g/2g+g.25:gD
- Whichgexpressiongevaluatesgtogtruegonlygwhengthegusergisgwithing 3 gyearsgofg 2 1 gyears,ggivengagvariablegxgcontaininggaguser'sgage? Agxg>=g18)gorg(gxg<=g24) Bg(gxg>=g18)gandg(gxg<=g24)
5 g/g 18 Cg(gxg<g18)gorg(gxg>g24) Dg(gxg<g18)gandg(gxg>g24):gB
- Whichgdatagtypegisgusedgforgitemsgthatgaregmeasuredginglength? AgInteger BgFloat CgString DgBoolean:gB
- Whichgdatagtypegshouldgbegusedgtogkeepgtrackgofghowgmanygplanesgaregingagh angar? AgInteger Bg Float CgString DgBoolean:gA
- Agfunctiongshouldgconvertghoursgandgminutesgtogseconds,gsuchgasgconvert- gingg 1 ghourgandg 10 gminutesgtog4,200gseconds. Whatgshouldgbegtheginputgtogthegfunction? AgHoursgonly BgMinutesgonly CgHoursgandgminutes DgHours,gminutes,gandgseconds:gC
- Agfunctiongreturnsgagnumbergxgcubed.gForgexample,gifgxgisg3,gthegfunctiongret urnsg 3 gg 3 gg3,gorg27. Whatgshouldgbegtheginputgtogthegfunction?
7 g/g 18 WhatgdoesgP(5)gevaluategto? Ag 2 Bg 5 Cg 10 Dg25:gC
- Functiong F()g Pu tg"Hey"gtogoutput WhatgentiregoutputgappearsgaftergthreegsuccessivegcallsgtogF()? AgHey BgHHHey CgHeyHeyHey DgHeygHeygHey:gC
- Whatgisgagvalidguser-definedgfunctiongname? AgAgreservedgword BgAnygvalidgidentifier CgAnygvariablegname DgAgfloating-pointgnumber:gB
- AgfunctiongMyFctghasganginputgxgandgangoutputgz. WhatgdoesgMyFctgreturn? AgNothing Bgxgonly Cgzgonly
8 g/g 18 Dgxgandgz:gC
10 g/ g 18
- Joegisgbuildinggangonlineggame.gHegwantsgtogprovidegagriddlegandghave thegplayergguessgtheganswer.gTheggamegneedsgtogpromptgthegusergtogentergthegan swer,gcheckgtogseegifgitgtheginputgprovidedgdoesgnotgmatchgthegcorrectganswer,gan dgcontinuegpromptinggtheguserguntilgtheganswergenteredgmatchesgthegcorrectgan swer. WhichgcontrolgstructuregsupportsgJoe'sgneeds? AgForgloop BgWhilegloop CgDo-whilegloop DgIf-elsegbranch:gC
- Whatgisgputgtogoutputgbygthegfollowinggpseudocode? xg=g 3 gd o PutgxgtogoutputgP utg"g"gtogoutputgxg= gxg-g 1 whilegxg>g 0 Ag 3 g 2 g 1 g 0 Bg 3 g 2 g 1 g 0 g- 1 Cg 2 g 1 g 0 Dg 3 g 2 g1:gD
- Agprogrammerghasgdevelopedgthegfollowinggcode:
11 g/ g 18 countg=g 0 whilegcountgisglessgthang5: printg'Hello' Whatgisgthegresultgofgimplementinggthisgcode? Ag'Hello'gwillgprintgfourgtimes. Bg'Hello'gwillgprintgfivegtimes. CgThegprogramgwillgthrowgangerror. Dg'Hello'gwillgprintgindefinitely.:gD
- Whatgisgthegloopgexpressiongingthegfollowinggpseudocode? ig=g 0 whilegig<g 20 gPut gigtogoutput
13 g/ g 18 DgIfgyg<gmin,gsetgming=gy:gACDB
14 g/ g 18
- Ordergthegstepsgneededgtogcalculategspeedgingmilesgperghourggivengagstartgan dgendglocationgandgtimegtraveledginghoursgfromgfirstg(1)gtoglastg(4). Selectgyourganswersgfromgthegpull-downglist. AgPutgspeedMphgtogoutput BgDeclaregvariablesgdistMilesgandgspeedMph CgdistMilesg=gendLocationg-gstartLocation DgspeedMphg=gdistMilesg/gtimeHours:gBCDA
- Ordergthegtasksgneededgtogcreategagpyramidg(largegongbottom,gsmallgongtop)go ngagtablegfromgfirstg(1)gtoglastg(4). Selectgyourganswersgfromgthegpull- downglist.gAgPlaceglargestgshape.
16 g/ g 18 ig=g 0 xg=g 0 g while gig<g 5 gifglist[i ]g<g 0 gxg=g 1 ig=gig+g 1 Putgxgtogoutput AgAllgintegersgaregpositive. BgAllgintegersgaregnegative. CgAtgleastgonegintegergisgnegative. DgAtgleastgonegintegergisgpositive.:gC
17 g/ g 18
- Whengshouldgagprogrammergdevelopgangalgorithmgtogsolvegagproblem? AgBeforegknowinggthegproblem BgBeforegwritinggagprogramgtogsolvegthegproblem CgWhilegwritinggag programg tog solveg theg problem DgAftergwritinggagprogramgtogsolvegthegproblem:gB
- Whichgtextgrepresentsgangalgorithm? AgCatsgandgdogsghavegtails. BgInsertgkey,gturngkey,gopengdoor. CgThegforecastgforgtomorrowgisgrain. DgAgboxghasgballs,gbats,gandghats.:gB
- Whichgtextgrepresentsgangalgorithm? AgShakegbulb;gifgitgrattles,greplacegit. BgWatergisgwet;gfiregisgnotgwet. CgStaringgatgthegsunghurtsgthegeyes. DgThegmaxgspeedgisg 60 gmph.:gA
- Angalgorithmgshouldgoutputg"OK"gifgaglist'sgnumbersgaregallgnon- zero,gelsegthegoutputgisg"NotgOK." Whichgtestgisgagvalidgtestgofgthegalgorithm? AgInputg0,g0,g0.gEnsuregoutputgisg"OK." BgInputg5,g4,g0.gEnsuregoutputgisg"OK." CgInputg-3,g-2,g5.gEnsuregoutputgisg"NotgOK." DgInputg99,g0,g5.gEnsuregoutputgisg"NotgOK.":gD
19 g/ g 18 AgToogyoung BgOK CgToogold DgNothinggisgputgtogoutput.:gB
- Whatgisgputgtogoutputgbygthegfollowinggflowchart,gifgtheginputgisg 3 g 5 g-1? Ag 3 g 5 g- 1 Bg 3 g 5 Cg 6 g 10 Dg 6 g 10 g-2:gC
20 g/ g 18
- Whatgisgthegpurposegofgthegfollowinggclassgdiagram? AgShowsghowgthegEmployeegclassgisgusedgingthegprogram BgDescribesgthegexecutiongflowgofgthegEmployeegclass'goperations CgSpecifiesgthegEmployeegclass'gbehavioralgrequirements DgDepictsgthegEmployeegclass'gname,gdatagmembers,gandgfunctions:gD
- Whatgisgthegpurposegofgagusegcasegdiagram,gsuchgasgthegfollowinggdiagram? AgDescribesghowgagusergcanginteractgwithgagprogram BgDescribesgthegdatagusedgingthegprogram CgIllustratesgthegflowgofgthegprogram'sgalgorithms DgShowsgtheginteractiongbetweengprogramgcomponents:gA
- Whichgelementsgaregcharacteristicgofgagclassgdiagram? AgSystem'sgclasses,gattributes,gandgmethodsgandgtheirgfeatures,gconstraints,gandg relationships BgFlowgofglogicgandgprocessginteractiongwithingagsystem CgPhysicalgresourcesgorglogicalgarchitecturegofgagsystem DgInternalgstructuregofgagclassgandgcollaborationgbetweengclassesgorginstances- :gA
- Reviewgthegfollowinggusegcasegdiagram:g Whatgdoesgagusegcasegdiagramgdo? AgDiagramsgagsinglegusegcase BgConnectsgseveralgusegcasesgtogclassgdiagrams CgProvidesgangoverviewgofgseveralgusegcases