CramX Logo
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Document preview page 1

Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 1

Document preview content for Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020)

Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020)

Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) provides detailed explanations to help you understand key concepts.

Emma Thompson
Contributor
4.3
102
over 1 year ago
Preview (31 of 497 Pages)
100%
Log in to unlock
Page 1 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 1 preview image
Page 2 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 2 preview imageDownloadedfromStudyXY.com[=Ww+StudyXYoias.Za\Rr'BE\StudyAnythingThisContentHasbeenPostedOnStudyXY.comassupplementarylearningmaterial.StudyXYdoesnotendroseanyuniversity,collegeorpublisher.Allmaterialspostedareundertheliabilityofthecontributors.|8)www.studyxy.com
Page 3 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 3 preview image
Page 4 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 4 preview imageEditorialRobFranek,Editor-in-ChiefDeborahWeber,DirectorofProductionGabrielBerlin,ProductionDesignManagerSelenaCoppock,ManagingEditorAaronRiccio,SeniorEditorMeaveShelton,SeniorEditorChrisChimera,EditorEleanorGreen,EditorOrionMcBean,EditorBrianSaladino,EditorPatriciaMurphy,EditorialAssistantRandomHousePublishingTeamTomRussell,VP,PublisherAlisonStoltzfus,PublishingDirectorAmandaYee,AssociateManagingEditorEllenL.Reed,ProductionManagerSuzanneLee,DesignerThePrincetonReview110East42ndSt,7thFloorNewYork,NY10017Email:editorialsupport@review.comCopyright©2019byTPREducationIPHoldings,LLC.Allrightsreserved.PublishedintheUnitedStatesbyPenguinRandomHouseLLC,NewYork,andinCanadabyRandomHouseofCanada,adivisionofPenguinRandomHouseLtd.,Toronto.TermsofService:ThePrincetonReviewOnlineCompanionTools(“StudentTools”)forretailbooksareavailableforonlythetwomostrecenteditionsofthatbook.StudentToolsmaybeactivatedonlyoncepereligiblebookpurchasedforatotalof24monthsofaccess.ActivationofStudentToolsmorethanonceperbookisindirectviolationoftheseTermsofServiceandmayresultindiscontinuationofaccesstoStudentToolsServices.TradePaperbackISBN9780525568193EbookISBN9780525568575
Page 5 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 5 preview imageAPisatrademarkregisteredandownedbytheCollegeBoard,whichisnotaffiliatedwith,anddoesnotendorse,thisproduct.ThePrincetonReviewisnotaffiliatedwithPrincetonUniversity.Editor:SelenaCoppockProductionEditors:SaraKuperstein,KathyCarterProductionArtist:JenniferChapmanCoverartbyCulturaCreative(RF)/AlamyStockPhotoCoverdesignbySuzanneLeev5.4a+StudyXxy
Page 6 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 6 preview imageSpecialthankstoClaudeKeswaniandMattGironda,fortheirworkonthe2020Editionofthisbook.Additionally,thestaffofThePrincetonReviewwouldliketothankJenniferChapman,SaraKuperstein,KathyCarter,andDeborahWeberfortheircontributionstothistitle.
Page 7 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 7 preview imageContentsCoverTitlePageCopyrightAcknowledgmentsGetMore(Free)ContentPartI:UsingThisBooktoImproveYourAPScorePreview:YourKnowledge,YourExpectationsYourGuidetoUsingThisBookHowtoBeginPartll:PracticeTest1PracticeTest1PracticeTest1:AnswersandExplanationsPartlll:AbouttheAPComputerScienceAExamTheStructureoftheAPComputerScienceAExamHowAPExamsAreUsedOtherResourcesDesigningYourStudyPlanHaveYouHeardofAPComputerSciencePrinciples?APCompSciPrinciples:CourseWorkInConclusionPartIV:Test-TakingStrategiesfortheAPComputerScienceAExamPreview
Page 8 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 8 preview image1HowtoApproachMultiple-ChoiceQuestions2HowtoApproachFree-ResponseQuestionsReflectAlignmentwithunitsestablishedintherevisedCollegeBoardCourseDescriptioneffectivefall2019shownaboveeachchapter.PartV:ContentReviewfortheAPComputerScienceAExamUnit1:PrimitiveTypes(2.5-5%ExamWeighting)3BasicTechniquesProgrammingStyleComments,Identifiers,WhiteSpaceCompiling&ErrorsObjects&PrimitiveDataOutput(andsomeinput)Variables&AssignmentTheFourDataTypes—int,double,boolean,charArithmeticOperationsChapter3ReviewDrillSummaryKeyTermsUnit3:BooleanExpressionsandifStatements(15-17.5%ExamWeighting)andUnit4:Iteration(17.5-22.5%ExamWeighting)4FlowControlandConstructsTheifStatement
Page 9 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 9 preview imageThewhileStatementTheforStatementChapter4ReviewDrillSummaryKeyTermsUnit2:UsingObjects(57.5%ExamWeighting)andUnit5:WritingClasses(5-7.5%ExamWeighting)5ClassesDesign&StructureMethodsCompositionReferencesStaticModifierInterfacesChapter5ReviewDrillSummaryKeyTermsUnit6:Array(10-15%ExamWeighting)Unit7:ArrayList(2.5-7.5%ExamWeighting)Unit8:2DArray(7.5-10%ExamWeighting)6ArraysPrimitives&ObjectsSearchesSorts2DArraysLists&ArrayLists
Page 10 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 10 preview imageMoreStringsChapter6ReviewDrillSummaryKeyTermsUnit9:Inheritance(5-10%ExamWeighting)7InheritanceHierarchies&DesignPolymorphismChapter7ReviewDrillSummaryKeyTermsUnit10:Recursion(5-7.5%ExamWeighting)8AdvancedControlStructuresRecursionRecursivelyTraversingArraysChapter8ReviewDrillSummaryKeyTerms9ChapterReviewDrillAnswersandExplanations10RequiredLabTimeandSuggestedLabsPartVI:PracticeTest2PracticeTest2PracticeTest2:AnswersandExplanationsGlossary
Page 11 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 11 preview image1GotoPrincetonReview.com/crackingandenterthefollowingISBNforyourbook:97805255685752AnswerafewsimplequestionstosetupanexclusivePrincetonReviewaccount.(Ifyoualreadyhaveone,youcanjustlogIn.)
Page 12 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 12 preview image3EnjoyaccesstoyourFREEcontent!Needtoreportapotentialcontentissue?ContactEditorialSupport@review.comandinclude:ofulltitleofthebook«ISBN
Page 13 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 13 preview image*pagenumberNeedtoreportatechnicalissue?ContactTPRStudentTech@review.comandprovide:*yourfullname+emailaddressusedtoregisterthebook«fullbooktitleandISBNeOperatingsystem(Mac/PC)andbrowser(Firefox,Safari,etc.)Onceyou’veregistered,youcan...oTakeafull-lengthpracticeSATandACT+Getvaluableadviceaboutthecollegeapplicationprocess,includingtipsforwritingagreatessayandwheretoapplyforfinancialaid«[Ifyou'restillchoosingbetweencolleges,useoursearchablerankingsofTheBest385Collegestofindoutmoreinformationaboutyourdreamschool*Accesscomprehensivestudyguidesandavarietyofprintableresources,includingtheKeyTermsandGlossary«Checktoseeiftherehavebeenanycorrectionsorupdatestothisedition«GetourtakeonanyrecentorpendingupdatestotheAPComputerScienceAExam
Page 14 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 14 preview imageBookPROVENTECHNIQUESAPPLIEDSTRATEGIESSTUDYBREAKOTHERREFERENCESONLINEARTICLES
Page 15 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 15 preview imagePartI
Page 16 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 16 preview imageUsingThisBooktoImproveYourAPScore*Preview:YourKnowledge,YourExpectationseYourGuidetoUsingThisBook+HowtoBegin
Page 17 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 17 preview imagePREVIEW:YOURKNOWLEDGE,YOUREXPECTATIONSYourroutetoahighscoreontheAPComputerScienceAExamdependsalotonhowyouplantousethisbook.Startthinkingaboutyourplanbyrespondingtothefollowingquestions.1.RateyourlevelofconfidenceinyourknowledgeofthecontenttestedbytheAPComputerScienceAExam:A.Veryconfident—IknowitallB.I'mprettyconfident,buttherearetopicsforwhichIcouldusehelpC.Notconfident—IneedquiteabitofsupportD.I'mnotsure2.Ifyouhaveagoalscoreinmind,chooseyourgoalscorefortheAPComputerScienceAExam:54321I'mnotsureyet3.Whatdoyouexpecttolearnfromthisbook?Chooseallthatapplytoyou.A.AgeneraloverviewofthetestandwhattoexpectB.StrategiesforhowtoapproachthetestC.ThecontenttestedbythisexamD.I'mnotsureyetYOURGUIDETOUSINGTHISBOOKThisbookisorganizedtoprovideasmuch—oraslittle—supportasyouneed,soyoucanusethisbookinwhateverwaywillbemosthelpfultoimprovingyourscoreontheAPComputerScienceAExam.
Page 18 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 18 preview imageoTheremainderofPartIwillprovideguidanceonhowtousethisbookandhelpyoudetermineyourstrengthsandweaknesses.oPartIIofthisbookcontainsPracticeTest1,itsanswersandexplanations,andascoringguide.Werecommendthatyoutakethistestbeforegoinganyfurtherinordertorealisticallydetermine:oyourstartingpointrightnowowhichquestiontypesyou'rereadyforandwhichyoumightneedtopracticeowhichcontenttopicsyouarefamiliarwithandwhichyouwillwanttocarefullyreviewIt’sBubbleTimeBubblesheetsforthetestsinthisbookcanbefoundinthebackofthebookandareavailableonline—youcanprintthemoutfromyouronlinestudenttools.Wehighlyrecommendthatyoudosobeforetakingapracticetest,aslearninghowtotransferyouranswerstoabubblesheetisanimportantpartofpreparingforthetest.NotethattheanswerkeyforPracticeTest1hasbeenspecificallydesignedtohelpyouself-diagnoseanypotentialareasofweakness,sothatyoucanbestfocusyourtestpreparationandbeefficientwithyourtime.ePartIIIofthisbookwill:oprovideinformationaboutthestructure,scoring,andcontentoftheAPComputerScienceAExamohelpyoutomakeastudyplan
Page 19 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 19 preview imageopointyoutowardadditionalresourcesoPartIVofthisbookwillexplorevariousstrategies:ohowtoattackmultiple-choicequestions(MCQs)ohowtoeffectivelyanswerfree-responsequestions(FRQs)ohowtomanageyourtimetomaximizethenumberofpointsavailabletoyou*PartVofthisbookcoversthecontentyouneedfortheAPComputerScienceAExam.ePartVIofthisbookcontainsPracticeTest2,itsanswersandexplanations,andascoringguide.IfyouskippedPracticeTest1,werecommendthatyoudoboth(withatleastadayortwobetweenthem)sothatyoucancompareyourprogressbetweenthetwo.Additionally,takingbothtestswillhelptoidentifyanyexternalissues:ifyouansweracertaintypeofquestionwrongonbothtests,youprobablyneedtoreviewthematerialcoveredinthatquestion.Ifyouonlyanswereditwrongonce,youmayhaverunoutoftimeorbeendistractedbysomething.Ineithercase,evaluatingbothtestswillallowyoutofocusonthefactorsthatcausedthediscrepancyinscoresandtobeaspreparedaspossibleonthedayofthetest.Youmaychoosetousesomepartsofthisbookoverothers,oryoumayworkthroughtheentirebook.Yourapproachwilldependonyourneedsandhowmuchtimeyouhave.Nowlet’slookathowtomakethisdetermination.HOWTOBEGIN1.TakePracticeTest1Beforeyoucandecidehowtousethisbook,youneedtotakeapracticetest.Doingsowillgiveyouinsightintoyourstrengths
Page 20 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 20 preview imageandweaknesses,andthetestwillalsohelpyoumakeaneffectivestudyplan.Ifyou'refeelingtest-phobic,remindyourselfthatapracticetestisatoolfordiagnosingyourself—it’snothowwellyoudothatmattersbuthowyouuseinformationgleanedfromyourperformancetoguideyourpreparation.So,beforeyoureadfurther,takePracticeTest1startingonthispageofthisbook.Besuretofinishitinonesitting,followingtheinstructionsthatappearbeforethetest.2.CheckYourAnswersUsingtheanswerkeyonthispage,countthenumberofmultiple-choicequestionsyouansweredcorrectlyandthenumberyoumissed.Don’tworryabouttheexplanationsfornow,anddon’tworryaboutwhyyoumissedquestions.We'llgettothatsoon.3.ReflectontheTestAfteryoutakeyourfirsttest,respondtothefollowingquestions:eHowmuchtimedidyouspendonthemultiple-choicequestions?oHowmuchtimedidyouspendoneachfree-responsequestion?¢Howmanymultiple-choicequestionsdidyoumiss?*Doyoufeelyouhadtheknowledgetoaddressthesubjectmatterofthefree-responsequestions?oUsingtheAnswerKey,determinewhatchaptersyoushouldreviewforquestionsthatyouansweredincorrectly.Inthisway,youcanbesurethatyouallowplentyoftimeforcontentreviewinthemost-neededareas.4.ReadPartIIIofthisBookandCompletetheSelf-
Page 21 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 21 preview imageEvaluationPartIIIwillprovideinformationonhowthetestisstructuredandscored.Itwillalsosetoutareasofcontentthataretested.AsyoureadPartI11,re-evaluateyouranswerstothequestionsabove.AttheendofPartIII,youwillrevisitandrefinethosequestions.Youwillthenbeabletomakeastudyplan,basedonyourneedsandavailabletime,thatwillallowyoutousethisbookmosteffectively.5.EngagewithPartsIVandVasNeededNoticethewordengage.You'llgetmoreoutofthisbookifyouuseitintentionallythanifyoureaditpassively,hopingforanimprovedscorethroughosmosis.Strategychapterswillhelpyouthinkaboutyourapproachtothequestiontypesonthisexam.PartIVwillopenwitharemindertothinkabouthowyouapproachquestionsnowandthenclosewithareflectionsectionaskingyoutothinkabouthoworwhetheryouwillchangeyourapproachinthefuture.ThecontentchaptersinPartVaredesignedtoprovideareviewofthecontenttestedontheAPComputerScienceAExam,includingthelevelofdetailyouneedtoknowandhowthecontentistested.Youwillhavetheopportunitytoassessyourmasteryofthecontentofeachchapterthroughtest-appropriatequestionsandareflectionsection.6.TakePracticeTest2andAssessYourPerformanceOnceyoufeelyouhavedevelopedthestrategiesyouneedandgainedtheknowledgeyoulacked,youshouldtakePracticeTest2,whichstartsonthispageofthisbook.Youshoulddosoinonesitting,followingtheinstructionsatthebeginningofthetest.
Page 22 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 22 preview imageWhenyouarefinished,checkyouranswerstothemultiple-choicesections.Seeifateacherorfriendwillreadyourfree-responseanswersandprovidefeedback,andgooverthemwithyou.Onceyouhavetakenthetest,reflectontheareasonwhichyoustillneedwork,andrevisitthechaptersinthisbookthataddressthosedeficiencies.Throughthistypeofreflectionandengagement,youwillcontinuetoimprove.Ifyou'relookingforawaytogetthemostoutofyourstudying,checkoutourfreestudyguideforthisexam,whichyoucanaccessviayouronlinestudenttools.Seethe“GetMore(Free)Content”pagefordetailsonaccessingthisgreatresourceandmore.7.KeepWorkingAsmentionedearlier,thereareotherresourcesavailabletoyou,includingawealthofinformationontheAPStudentswebsite(https://apstudent.collegeboard.org/apcourse/ap-computer-science-a).Onthissite,youcancontinuetoexploreareasthatyoucouldimproveuponandengageinthoseareasrightupuntilthedayofthetest.Youshoulduseamixofwebresourcesandbookreviewtosolidifyyourunderstandingofanyquestionsubjectsthatyoukeepgettingwrong.
Page 23 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 23 preview imagePartIIPracticeTest1*PracticeTest1*PracticeTest1:AnswersandExplanations
Page 24 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 24 preview imagePracticeTest1ClickheretodownloadaPDFofPracticeTest1.
Page 25 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 25 preview imageTheExamAP®ComputerScienceAExamSECTIONI:Multiple-ChoiceQuestionsDONOTOPENTHISBOOKLETUNTILYOUARETOLDTODOSO.AtaGlanceTotalTime1hour30minutesNumberofQuestions40PercentofTotalScore50%WritingInstrumentPencilrequiredInstructionsSectionIofthisexaminationcontains40multiple-choicequestions.Fillinonlytheovalsfornumbers1through40onyouranswersheet.Indicateallofyouranswerstothemultiple-choicequestionsontheanswersheet.Nocreditwillbegivenforanythingwritteninthisexambooklet,butyoumayusethebookletfornotesorscratchwork.Afteryouhavedecidedwhichofthesuggestedanswersisbest,completelyfillinthecorrespondingovalontheanswersheet.Giveonlyoneanswertoeachquestion.Ifyouchangeananswer,besurethatthe
Page 26 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 26 preview imagepreviousmarkiserasedcompletely.Hereisasamplequestionandanswer.SampleQuestionChicagoisa(A)state(B)city(C)country(D)continent(E)countySampleAnswerUseyourtimeeffectively,workingasquicklyasyoucanwithoutlosingaccuracy.Donotspendtoomuchtimeonanyonequestion.Goontootherquestionsandcomebacktotheonesyouhavenotansweredifyouhavetime.Itisnotexpectedthateveryonewillknowtheanswerstoallthemultiple-choicequestions.AboutGuessingManycandidateswonderwhetherornottoguesstheanswerstoquestionsaboutwhichtheyarenotcertain.Multiple-choicescoresarebasedonthenumberofquestionsansweredcorrectly.Pointsarenotdeductedforincorrectanswers,andnopointsareawardedforunansweredquestions.Becausepointsarenotdeductedforincorrectanswers,youareencouragedtoanswerallmultiple-choicequestions.Onanyquestionsyoudonotknowtheanswerto,youshouldeliminateasmanychoicesasyoucan,andthenselectthebestansweramongtheremainingchoices.
Page 27 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 27 preview imageCOMPUTERSCIENCEASECTIONITime—1hourand30minutes
Page 28 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 28 preview imageNumberofQuestions—40Percentoftotalexamgrade—50%Directions:Determinetheanswertoeachofthefollowingquestionsorincompletestatements,usingtheavailablespaceforanynecessaryscratchwork.Thendecidewhichisthebestofthechoicesgivenandfillinthecorrespondingovalontheanswersheet.Nocreditwillbegivenforanythingwrittenintheexaminationbooklet.Donotspendtoomuchtimeonanyoneproblem.Notes:oAssumethattheclasseslistedintheQuickReferencehavebeenimportedwhereappropriate.oAssumethatdeclarationsofvariablesandmethodsappearwithinthecontextofanenclosingclass.oAssumethatmethodcallsthatarenotprefixedwithanobjectorclassnameandarenotshownwithinacompleteclassdefinitionappearwithinthecontextofanenclosingclass.oUnlessotherwisenotedinthequestion,assumethatparametersinthemethodcallsarenotnullandthatmethodsarecalledonlywhentheirpreconditionsaresatisfied.1.Considerthefollowingmethods.publicvoidtrial(){inta=10;intb=5;doublevalues(a,b);System.out.print(b);System.out.print(a);}publicvoiddoublevValues(intc,intd){
Page 29 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 29 preview imagec=c*2;d=4d*2;System.out.print(c);System.out.print(d);3Whatisprintedastheresultofthecalltrial()?(A)2010(B)2010105(C)2010510(D)20102010(E)201010202.Considerthefollowingmethod.Jen*Precondition:a>b>0*/publicstaticintmystery(inta,intb){intd=0;for(int¢c=a;¢>b;c--){d=4d+c;3returnd;3Whatisreturnedbythecallmystery(x,y)?(A)Thesumofallintegersgreaterthanybutlessthanorequaltox(B)Thesumofallintegersgreaterthanorequaltoybutlessthanorequaltox(C)Thesumofallintegersgreaterthanybutlessthanx(D)Thesumofallintegersgreaterthanorequaltoybutlessthanx
Page 30 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 30 preview image(E)Thesumofallintegerslessthanybutgreaterthanorequaltox3.Considerthefollowingmethod.publicvoidmystery(intn){intk;for(k=0;k<n;k++){mystery(k);System.out.print(k);}}Whatisprintedbythecallmystery(3)?(A)0123(B)00123(C)0010012(D)00100123(E)0010012001001234.Consideranarrayofintegers.418126735Ifselectionsortisusedtoorderthearrayfromsmallesttolargestvalues,whichofthefollowingrepresentsapossiblestateofthearrayatsomepointduringtheselectionsortprocess?5.Considerthefollowingcodesegment:
Page 31 of 31
Cracking the AP Computer Science A Exam, 2020 Edition: Practice Tests and Prep for the NEW 2020 Exam (2020) - Page 31 preview imageintk;intal];a=newint[7];for(k=0;k<a.length;k++){alk]=a.length-k;}for(k=0;k<a.length-1;k++){a[k+1]=a[k];}WhatvalueswillAcontainafterthecodesegmentisexecuted?Questions6—7refertothefollowingtwoclasses.publicclassPostOffice{//constructorinitializesboxes//tolength100publicPostOffice(){/*implementationnotshown*/}//returnstheP.O.BoxbasedonthegivenP.O.Boxnumber//0<=theBox<getNumBoxes()publicBoxgetBox(inttheBox){/*implementationnotshown*/}//returnsthenumberofp.o.boxes+Studyxy
Preview Mode

This document has 497 pages. Sign in to access the full document!