Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 130 pages
Exam (elaborations)

Solution Manual and Test Bank for Absolute C++ 6th Edition by Walter Savitch Kenrick Mock All Chapters. PACKAGE DEAL!!!

Document preview thumbnail
Preview 4 out of 130 pages

Solution Manual and Test Bank for Absolute C++ 6th Edition by Walter Savitch Kenrick Mock All Chapters. PACKAGE DEAL!!!

Content preview

,DOWNLOADgTHEgTestgBankgforgAbsolutegC++g6thgEditiongSavitch



Chapterg2g-gTestgQuestions
Thesegtestgquestionsgaregtrue-
false,gfillgingthegblank,gmultiplegchoice,gandgfreegformgquestionsgthatgmaygrequiregcode.gT
hegmultiplegchoicegquestionsgmayghavegmoregthangonegcorrectganswer.gYougaregrequiredgt
ogmarkgandgcommentgongcorrectganswers..gMarkgallgofgthegcorrectganswersgforgfullgcredit.
Thegtruegfalsegquestionsgrequiregangexplanationgingadditiongtogthegtrue/falsegresponse,gan
g

d,gifgfalse,galsogrequiregagcorrection.

TruegFalse:

1. Theg if,gwhilegandgforgstatementsgcontrolgonlygonegstatement.g

Answer:gTrue

Explanation:gThegonegstatementgmaygbegagblockg(statementsgthatgaregenclosedgwithgcu
rlygbracesg{g})gorgagsimplegstatement.

2. Givengthegdeclaration

intgxg=g0;

Thegfollowinggexpressiongcausesgagdividegbygzerogerror:

(xg!=0)g||g(2/xg<g1);

Answer:gFalse.

Explanation:gTheg||goperatorgusesgshort-
circuitgevaluation.gThegfirstgmembergofgthisgexpressiongisgtrue;gthegtruthgvaluegofgt
hegcompletegexpressiongcangbegdeterminedgfromgthis;gconsequently,gthegsecondgexp
ressiongisgnotgevaluated.gTheregisgnogdivide-gby-zerogerror.

3. Supposegweghavegthesegdeclarations,

intgxg=g-1,gyg=g0,gzg=g1;

ThisgBooleangexpressiongisgcorrectgandgitgdoesgwhatgthegprogrammergintends.

xg<gyg<gz

Answer:gFalse




mynursytest.store

,DOWNLOADgTHEgTestgBankgforgAbsolutegC++g6thgEditiongSavitch
TestgBankgforgSavitchgAbsolutegC++g 6e Pageg2


Explanation:gUnfortunately,gthegexpressiongcompilesgwithoutgerrorgandgruns.gTheg<
operatorgassociatesg(groups)gleftgtogright,gsogthegexpressiongevaluatesgas
(xg<gy)g<gz
Thegleftghandgexpressiongevaluatesgtogtrue,gwhich,gifgcomparedgtogagnumericgtype,gco
nvertsgtog1.gWhengcomparedgtog1,gthisgisgfalse.gWhatgthegprogrammergintends,gexpr
essedgasgmathematacsgmightgisg-1g<g0<g1,gagresultgthatgisgclearlygtrue.
4. Yougwantgtogdeterminegwhethergtimeghasgrungout.gThegfollowinggcodegcorrectl
ygimplementsgthis.
!timeg>glimit

Answer:gFalse.

Explanation:gThegexpressiongalwaysgevaluatesgtogfalse.gThisgcannotgbegwhatgth
egprogrammergintended.gThegcompilergdoesn’tgcatchgthegproblemgbecausegthegcod
egisglegal,gcorrectgC++.gCorrectedgcodegisg!(timeg>glimit)

Codegexecutiongproceedsgasgfollows:gThegoperatorg!gtakesgagboolgargument.gItgreturn
sgthegoppositegboolgvalue.gThegvaluegofgtimegisgconvertedgtogagbool.gThegvaluegofg
timegisgcertainlygnonzero,ghenceg!timegisg!true,gi.e.,gfalse.gTheg>gcomparesgt
hisgresultgwithgagnumericgvalue,glimit,g(angintgorgperhapsgsomegkindgofgfloatinggpo
int).gThegvaluegongthegleftg(false)gisgconvertedgtogag0gvaluegofgthatgtype.gThegvalueg
ofglimitgisgunlikelygtogbegagnegativegnumbergandgwegaregconcernedgaboutgtimegrunni
nggout,gsogitgisgunlikelygthatgtimegisgzero.gConsequently,gtheginequalitygbecomesg0>l
imit,gwhereglimitgisgnonzero.gThisgisgfalse.

5. Thegvaluegofgcountgisg0;glimitgisg10.gEvaluate:
(countg==g0)&&(limitg<g20)
Answer:gtrue
6. Thegvaluegofgcountgisg0;glimitgisg10.gEvaluate:
countg==g0g&&glimitg<g20
Answer:gtrue




©2016gPearsongEducation,gInc.gUppergSaddlegRiver,gNJ.gAllgRightsgReserve
d.

mynursytest.store

, DOWNLOADgTHEgTestgBankgforgAbsolutegC++g6thgEditiongSavitch
TestgBankgforgSavitchgAbsolutegC++g 6e Pageg3


Explanation:gThegoperatorsg ==gandg <ghaveghighergprecedencesgthang &&,ghencegtheg
expressions,gcountg==g0gandg limitg<g10garegevaluatedg(togtrue)gthengtheg&&gi
sgexecuted.
7. Thegvaluegofgcountgisg0;glimitgisg10.gEvaluate:
(countg!=g0)||(limitg<g20)
Answer:gtrue.
Explanation:gThegfirstgexpressiongevaluatesgtogfalse,gthegvaluegofgtheg||gexpression
gisgdeterminedgbygthegsecondgexpression.gThegsecondgexpressiongisgtruegsogtheg ||g
expressiongevaluatesgtogtrue.
8. Ingagwhilegloop,gthegBoolean_Expressiongisgexecutedgbeforegeachgexecutiongofgth
egloopgbody.
Answer:gtrue
9. Ingagdo-
whilegloop,gagcontinuegstatementgterminatesgthegloop.gAnswer:
gFalse
Explanation:gThegcontinuegstatementgcausesgthegBoolean_Expressiongtogbegexecute
d.gIfgtrue,gthegbodygexecutes,gotherwisegthegloopgterminates.
10. Agbreakgstatementgisgusedgingloopsgonly.
gAnswer:gFalse.
Explanation:gIngadditiongtogitsgusegingloops,gagbreakgstatementgisgusedgingthe
switchgstatementgtogtransfergcontrolgtogthegnextgstatementgaftergthegswitchgblock.
11. Whengagloopgisgnestedgingsideganothergloop,gagbreakgorgcontinuegstatement
gterminatesgorgrestartsgthegoutermostgloopgofgthegnestedgloopgstructure.
Answer:gFalse
Explanation:gAgbreakgorgcontinuegterminatesgorgrestartsgonlygtheginnermostgloopgcontaini
nggthegbreakgorgcontinue.




©2016gPearsongEducation,gInc.gUppergSaddlegRiver,gNJ.gAllgRightsgReserve
d.

mynursytest.store

Connected book
 image
Walter Savitch, Kenrick Mock Absolute C++
Publisher: 2015 ISBN: 9780133970784 Edition: Unknown

Document information

Uploaded on
March 22, 2025
Number of pages
130
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$21.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
BESTSOLUTIONSS
4.5
(360)
Sold
8
Followers
0
Items
501
Last sold
1 day ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions