100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Examen

Absolute C++ 5th Edition Savitch Test Bank.docx

Puntuación
-
Vendido
-
Páginas
130
Grado
A+
Subido en
12-03-2025
Escrito en
2024/2025

Absolute C++ 5th Edition Savitch Test B

Institución
Grado











Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Libro relacionado

Escuela, estudio y materia

Grado

Información del documento

Subido en
12 de marzo de 2025
Número de páginas
130
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

,DOWNLOADgTHEgTestgBankgforgAbsolutegC++g6thgEditiongSavitch



Chapterg2g-gTestgQuestions
Thesegtestgquestionsgaregtrue-
false,gfillgingthegblank,gmultiplegchoice,gandgfreegformgquestionsgthatgmaygrequiregcode.gT
hegmultiplegchoicegquestionsgmayghavegmoregthangonegcorrectganswer.gYougaregrequiredgt
ogmarkgandgcommentgongcorrectganswers..gMarkgallgofgthegcorrectganswersgforgfullgcredit.
gThegtruegfalsegquestionsgrequiregangexplanationgingadditiongtogthegtrue/falsegresponse,gan
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
$20.99
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
FINETUTORS Teachme2-tutor
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
16
Miembro desde
9 meses
Número de seguidores
2
Documentos
425
Última venta
1 mes hace

4.8

781 reseñas

5
646
4
113
3
15
2
3
1
4

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes