ebook img

AP Computer Science A, 7th Edition PDF

508 Pages·2015·6.44 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview AP Computer Science A, 7th Edition

B SCORE HIGHER BARRON’S A R T e uR k o lsO k y BARRON’S N The Leader in Test Preparation with ’ S AP * For 70 years, BARRON’S experts have been helping students A surpass their expectations on standardized tests. This is the only book you will need to get the score you want on the AP Computer P Science A test. * BOOK 4 P roven test-taking strategies that make the difference between a good score and a great score C COMPUTER 4 O ne full-length diagnostic test to help you pinpoint your O strengths and weaknesses M SCIENCE A 4 T wo additional full-length practice tests to boost your P confidence U 4 T he most up-to-date subject review that covers the specific T material you need to know for the test MOST UP-TO-DATE REVIEW E AND PRACTICE TESTS R ONLINE 4 A ccess to a full-length sample AP Computer Science A exam CURRENTLY AVAILABLE with answer explanations and automatic scoring S See inside front cover for details. C 7TH EDITION I Roselyn Teukolsky, M.S. E n 4 full-length practice tests with explained N answers, including one online C n Expert advice on the best way to approach BARRON’S GIVES YOU THE ANSWERS! the test E Every question in this book comes with a comprehensive answer explanation. n Review covers all relevant topics, including the A new AP Computer Science A labs and changes to the Java subset ISBN: 978-1-4380-0594-2 BOOK New chapter on N Everything you need the Computer EA 7 STUDYGREEN. T Science A labs ON H E to get a 55 ONLINE STUDYGREEN. L D PFurilnlyte rde coync lpaabrletially recycled paper $1w8w.9w.9b a r rConasneadduac $.c2o1m.99 UPINRI SNTTHAEDE INE ITION *AP and Advanced Placement Program are registered trademarks of the College Board, which was not involved in the production of, and does not endorse, this product. 4-0594-AP-ComputerScienceA-fbs.indd All Pages 11/7/14 12:41 PM STUDYGREEN. STUDYGREEN. Y GR D E U E T N S . Now Available! Go to BARRON’S barronsbooks.com/AP/compsci/ to take a free sample Online AP Computer Science A test, AP Exams complete with answer explanations and automated scoring. *This online test was created for devices that support Adobe Flash Player. To access the test on an Apple iPad or iPhone you will need to install a web browser that supports Flash (check the iTunes App Store for free options). 4-0594-AP-ComputerScienceA-IFC.indd All Pages 11/5/14 12:54 PM BARRON’S AP * COMPUTER SCIENCE A 7TH EDITION Roselyn Teukolsky, M.S. Formerly, Ithaca High School Ithaca, New York *AP and Advanced Placement Program are registered trademarks of the College Board, which was not involved in the production of, and does not endorse, this book. 4-0594-APComputerScienceA-tp.indd 1 10/7/14 9:09 AM ✐ ✐ “ap” — 2014/11/4 — 11:10 — page ii — #2 ✐ ✐ AbouttheAuthor: RoselynTeukolskyhasanM.S.degreefromCornellUniversity,andhasbeenteachingprogrammingandcom- puter science since 1980. She has published articles in The Mathematics Teacher and in the National Council ofTeachersofMathematicsYearbook. Sheisthe authorofBarron’sACTMath andScienceWorkbookandco- author of Barron’s SAT 2400: Aiming for the Perfect Score. She has received the Edyth May Sliffe Award for Distinguished Mathematics Teaching and the Alfred Kalfus Distinguished Coach Award from the New York StateMathLeague(NYSML). (cid:13)c Copyright2015,2013,2010byBarron’sEducationalSeries,Inc. Previouseditions(cid:13)c copyright2007underthetitle APComputerScienceLevelsAandAB,2003underthetitle HowtoPreparefortheAPComputerScienceAdvanced PlacementExamination,JAVAVersion,and2001 underthetitleHowtoPreparefortheAPComputer ScienceAdvancedPlacementExamination byBarron’sEducationalSeries,Inc. Allrightsreserved. Nopartofthispublicationmaybereproducedor distributedinanyformorbyanymeanswithoutthewritten permissionofthecopyrightowner. Allinquiriesshouldbeaddressedto: Barron’sEducationalSeries,Inc. 250WirelessBoulevard Hauppauge,NewYork11788 www.barronseduc.com ISBN:978-1-4380-0594-2 ISBN(withCD-ROM):978-1-4380-7553-2 ISSN(Print): 2169-5571 ISSN(PrintwithCD-ROM):2169-558X PRINTED INTHE UNITED STATES OFAMERICA 987654321 ✐ ✐ ✐ ✐ ✐ ✐ “ap” — 2014/11/4 — 11:10 — page iii — #3 ✐ ✐ Contents Preface ix Introduction xi General InformationAbouttheExam . . . . . . . . . . . . . . . . . . . . . . . xi Hints forTakingtheExam. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii TheMultiple-ChoiceSection . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii TheFree-ResponseSection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii How toUseThisBook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii Practice ExamOne / Diagnostic Test 1 ComputerScienceSectionI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 ComputerScienceSectionII. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 AnswerKey (SectionI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 DiagnosticChartforPracticeExam. . . . . . . . . . . . . . . . . . . . . . . . . 45 AnswersExplained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Chapter1. Introductory JavaLanguageFeatures 57 Packages andClasses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 JavadocComments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Types andIdentifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Built-inTypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 StorageofNumbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 HexadecimalandOctalNumbers . . . . . . . . . . . . . . . . . . . . . . . . . 62 FinalVariables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 ArithmeticOperators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 RelationalOperators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 LogicalOperators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 AssignmentOperators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 IncrementandDecrementOperators . . . . . . . . . . . . . . . . . . . . . . . 66 OperatorPrecedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Input/Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 EscapeSequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 ControlStructures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Decision-MakingControlStructures . . . . . . . . . . . . . . . . . . . . . . . 69 Iteration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 ErrorsandExceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Multiple-ChoiceQuestionsonIntroductoryJavaLanguageConcepts . . 77 AnswerKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 AnswersExplained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 iii ✐ ✐ ✐ ✐ ✐ ✐ “ap” — 2014/11/4 — 11:10 — page iv — #4 ✐ ✐ iv Contents Chapter2. Classes and Objects 92 Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Public,Private,andStatic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 TypesofMethods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 MethodOverloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 ThethisKeyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Referencevs.PrimitiveDataTypes . . . . . . . . . . . . . . . . . . . . . . . . 101 TheNullReference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 MethodParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Multiple-ChoiceQuestionsonClassesandObjects. . . . . . . . . . . . . . . 111 AnswerKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 AnswersExplained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 Chapter3. Inheritance and Polymorphism 131 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 SuperclassandSubclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 InheritanceHierarchy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 ImplementingSubclasses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 DeclaringSubclassObjects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 DynamicBinding(LateBinding) . . . . . . . . . . . . . . . . . . . . . . . . . . 138 UsingsuperinaSubclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Type Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Downcasting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 TheClassCastException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 AbstractClasses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 AbstractClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 TheabstractKeyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 DefininganInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 TheimplementsKeyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 TheComparableInterface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Multiple-ChoiceQuestionsonInheritanceandPolymorphism. . . . . . . 150 AnswerKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 AnswersExplained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 Chapter4. Some Standard Classes 174 The Object Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 TheUniversalSuperclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 MethodsinObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 The String Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 StringObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 ConstructingStringObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 TheConcatenationOperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 ✐ ✐ ✐ ✐ ✐ ✐ “ap” — 2014/11/4 — 11:10 — page v — #5 ✐ ✐ Contents v ComparisonofStringObjects . . . . . . . . . . . . . . . . . . . . . . . . . . 178 OtherStringMethods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 Wrapper Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 TheIntegerClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 TheDoubleClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 The Math Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 RandomNumbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Multiple-ChoiceQuestionsonStandardClasses. . . . . . . . . . . . . . . . . 187 AnswerKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 AnswersExplained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 Chapter5. ProgramDesign and Analysis 207 The SoftwareDevelopment LifeCycle . . . . . . . . . . . . . . . . . . . . . . . 207 TheWaterfallModel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 ProgramSpecification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 ProgramDesign. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 ProgramImplementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 TestingandDebugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 ProgramMaintenance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Object-OrientedProgramDesign . . . . . . . . . . . . . . . . . . . . . . . . . . 210 IdentifyingClasses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 IdentifyingBehaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 DeterminingRelationshipsBetweenClasses . . . . . . . . . . . . . . . . . . 211 UMLDiagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 ImplementingClasses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 ImplementingMethods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 VocabularySummary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 ProgramAnalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 ProgramCorrectness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Efficiency. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Multiple-ChoiceQuestionsonProgramDesignandAnalysis. . . . . . . . 221 AnswerKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 AnswersExplained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Chapter6. Arraysand ArrayLists 233 One-DimensionalArrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 LengthofArray. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 TraversinganArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 ArraysasParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 ArrayVariablesinaClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 ArrayofClassObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 AnalyzingArrayAlgorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 ArrayLists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 TheCollectionsAPI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 TheCollectionsHierarchy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 CollectionsandGenerics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 Auto-Boxingand-Unboxing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 The List<E> Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 ✐ ✐ ✐ ✐ ✐ ✐ “ap” — 2014/11/4 — 11:10 — page vi — #6 ✐ ✐ vi Contents TheMethodsofList<E> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 TheArrayList<E>Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 UsingArrayList<E> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 CollectionsandIterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 DefinitionofanIterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 TheIterator<E>Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 UsingaGenericIterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Two-DimensionalArrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 MatrixasArrayofRowArrays. . . . . . . . . . . . . . . . . . . . . . . . . . . 250 ProcessingaTwo-DimensionalArray. . . . . . . . . . . . . . . . . . . . . . . 251 Two-DimensionalArrayasParameter . . . . . . . . . . . . . . . . . . . . . . 253 Multiple-ChoiceQuestionsonArraysandArrayLists . . . . . . . . . . . . 255 AnswerKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 AnswersExplained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Chapter7. Recursion 290 RecursiveMethods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 General Formof SimpleRecursiveMethods . . . . . . . . . . . . . . . . . . . 291 WritingRecursiveMethods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 Analysisof RecursiveMethods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 SortingAlgorithmsThat UseRecursion. . . . . . . . . . . . . . . . . . . . . . 295 RecursiveHelper Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 Recursionin Two-DimensionalGrids. . . . . . . . . . . . . . . . . . . . . . . . 298 SampleFree-ResponseQuestion1 . . . . . . . . . . . . . . . . . . . . . . . . . 300 SampleFree-ResponseQuestion2 . . . . . . . . . . . . . . . . . . . . . . . . . 303 Multiple-ChoiceQuestionsonRecursion . . . . . . . . . . . . . . . . . . . . . 308 AnswerKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 AnswersExplained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 Chapter8. Sorting and Searching 324 Sorts: SelectionandInsertionSorts . . . . . . . . . . . . . . . . . . . . . . . . . 324 SelectionSort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 InsertionSort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 RecursiveSorts: MergesortandQuicksort . . . . . . . . . . . . . . . . . . . . 325 Mergesort. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 Quicksort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 SortingAlgorithmsin Java. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 SequentialSearch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 Binary Search. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 Multiple-ChoiceQuestionsonSortingandSearching . . . . . . . . . . . . . 331 AnswerKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 AnswersExplained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 Chapter9. The AP Computer ScienceA Labs 351 The MagpieLab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 SpecialEmphasis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 The ElevensLab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 SpecialEmphasis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 ✐ ✐ ✐ ✐ ✐ ✐ “ap” — 2014/11/4 — 11:10 — page vii — #7 ✐ ✐ Contents vii The PictureLab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 SpecialEmphasis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 Multiple-ChoiceQuestionsontheLabConcepts . . . . . . . . . . . . . . . . 360 AnswerKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 AnswersExplained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 Practice Exams 377 Practice ExamTwo 379 ComputerScienceSectionI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 ComputerScienceSectionII. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 AnswerKey (SectionI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 AnswersExplained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 Practice ExamThree 433 ComputerScienceSectionI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 ComputerScienceSectionII. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 AnswerKey (SectionI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 AnswersExplained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 AAppendix: Glossaryof UsefulComputer Terms 482 Index 485 ✐ ✐ ✐ ✐ ✐ ✐ “ap” — 2014/11/4 — 11:10 — page viii — #8 5 ✐ ✐ Barron’s Asyou reviewthe content inthis book to work toward Essential 5 earning that onyour APComputer Science A exam,here MUST arefivethings thatyou know aboveeverything else: 1 The Basics.EveryAPexamquestionusesatleastoneofthese: TypesandIdentifiers(p.60) • Operators(p.63) • Controlstructures(p.69) • 2 Objects, Classes, and Inheritance. You may have to write your own class. You’lldefinitelyneedtointerpretatleastoneclassthat’sgiven. Methods(p.95) • Subclasses(p.131) • Abstractclasses(p.142) • Interfaces(p.144) • 3 Lists and Arrays. Learnto manipulate a list. Search, deletean item, insert an item.ItseemsasifeverysecondquestionontheAPexamusesalist! One-dimensionalarrays(p.233) • ArrayLists(p.244) • 4 Two-dimensionalArrays.Learntomanipulateamatrix.Thistopichasbecome moreprominentontheAPexaminrecentyears. Two-dimensionalarrays(p.249) • Row-columntraversal(p.251) • for-eachlooptraversal(p.251) • Row-by-rowarrayprocessing(p.251) • 5 Sorting andSearching.Knowthesealgorithms! SelectionSort(p.324) • InsertionSort(p.325) • MergeSort(p.325) • BinarySearch(p.329) • ✐ ✐ ✐ ✐

Description:
new AP Computer Science A labs and changes to the Java subset She is the author of Barron's ACT Math and Science Workbook and co- author of
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.