[PDF] AP Computer Science A 7th Edition





Previous PDF Next PDF



AP® Computer Science A Magpie Chatbot Lab Student Guide

Your teacher may have a specific list of chatbots for you to try. Exploration. Have several conversations with your chatbot and answer the following questions:.



AP® Computer Science A Magpie Chatbot Lab Student Guide

Your teacher may have a specific list of chatbots for you to try. Exploration. Have several conversations with your chatbot and answer the following questions:.



ap-computer-science-a.pdf

precedence to correctly write code that yields a given answer. Magpie. Chatbot Lab. Activity 1 & 2. Barrons ch 6. Curriculum Map.



The Labs: To Use or not to Use

29 janv. 2014 will be replaced by a required lab component consisting of three new AP Computer Science A labs. To ensure that teachers have greater ...



AP® Computer Science A Sample Syllabus 4 - Syllabus 1172780v1

Introduction to AP Computer Science. A with Greenfoot. • Java Basics with Magpie Lab and. Text-Based Game. • 1D Arrays with Bioinformatics or Finch.



Pre-AP Computer Programming (6640P)

The Magpie Chatbot Lab is suggested by the College Board as foundational material for the AP exam. It is highly recommended. 6. When students have completed 



AP Daily Videos AP Computer Science A

videos cover every topic and skill outlined in the AP Course and Exam Description This video uses the CSA Magpie Lab to demonstrate the.



AP Computer Science A 7th Edition

answer explanations and automated scoring. BARRON'S. Online. AP Exams AP Computer Science Levels A and AB 2003 under the title ... The Magpie Lab .



AP Daily Videos AP Computer Science A

videos cover every topic and skill outlined in the AP Course and Exam Description This video uses the CSA Magpie Lab to demonstrate the.



2017 AP Computer Science A Syllabus - UCHS

Welcome to AP Computer Science at University Christian High School! Magpie Lab; Assessment ... Week 8: Elevens Lab; MC Practice; FRQ.

MOST UP-TO-DATE REVIEW

AND PRACTICE TESTS

CURRENTLY AVAILABLE

7TH EDITION

Roselyn Teukolsky, M.S.

4 full-length practice tests with explained

answers, including one online

Expert advice on the best way to appr oach

the test

Review covers all relevant topics, including the

new AP Computer Science A labs and changes to the Java subset

BARRON'S

The Leader in Test Preparation

*AP and Advanced Placement Program are registered trademarks of the College Boar d, which was not involved in the production of, and does not endorse, this product. with BARRON'S

SCORE HIGHER

ISBN: 978-1-4380-0594-2

EAN $18.99 Canada $21.99 www.barronseduc.com

PRINTED

IN THE

USA

BARRON'S

Teukolsky

AP

COMPUTERSCIENCE A

APSTUDYGREEN.

STUDY

GREEN.

STUDY

GREEN.

STUDYGREEN.

S T U D Y G R E E N

Printed on partially recycled paper

Fully recyclable

COMPUTER SCIENCE A

BARRON'S GIVES YOU THE ANSWERS!

Every question in this book comes with a comprehensive answer explanatio n.

New chapter on

the Computer

Science A labs

7TH EDITION

Everything you need

to get a 5 5

For 70 years,

BARRON'S

experts have been helping students surpass their expectations on standardized tests. This is the only book you will need to get the score you want on the AP Computer

Science A test.

Proven test-taking strategies that make the difference between a good score and a great score One full-length diagnostic test to help you pinpoint your strengths and weaknesses Two additional full-length practice tests to boost your condence The most up-to-date subject review that covers the specic material you need to know for the test

Access to a full-length sample AP Computer Science A exam with answer explanations and automatic scoring

See inside front cover for details.

4-0594-AP-ComputerScienceA-fbs.indd All Pages11/7/14 12:41 PM

4-0594-AP-ComputerScienceA-IFC.indd All Pages11/5/14 12:54 PM

Roselyn Teukolsky, M.S.

Formerly, Ithaca High School

Ithaca, New York

BARRON'S

*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.

7TH EDITION

COMPUTER

SCIENCE A

AP

4-0594-APComputerScienceA-tp.indd 110/7/14 9:09 AM

i i “ap" — 2014/11/4— 11:10 — page ii — #2i i i i i i

About the Author:

Roselyn Teukolsky has an M.S. degree from Cornell University, and has been teaching programming and com-

puter science since 1980. She has published articles inThe Mathematics Teacherand in the National Council

of Teachers of Mathematics Yearbook. She is the author of Barron'sACT Math and Science Workbookand co-

author of Barron'sSAT 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

State Math League (NYSML).

c Copyright 2015, 2013, 2010 by Barron's Educational Series, Inc.

Previous editionsc

copyright 2007 under the title AP Computer Science Levels A and AB, 2003 under the title How to Prepare for the AP Computer Science Advanced

Placement Examination, JAVA Version, and 2001

under the titleHow to Prepare for the AP Computer

Science Advanced Placement Examination

by Barron's Educational Series, Inc.

All rights reserved.

No part of this publication may be reproduced or

distributed in any form or by any means without the written permission of the copyright owner.

All inquiries should be addressed to:

Barron's Educational Series, Inc.

250 Wireless Boulevard

Hauppauge, New York 11788

www.barronseduc.com

ISBN: 978-1-4380-0594-2

ISBN (with CD-ROM): 978-1-4380-7553-2

ISSN (Print): 2169-5571

ISSN (Print with CD-ROM): 2169-558X

PRINTED IN THE UNITED STATES OF AMERICA

9 8 7 6 5 4 3 2 1

i i “ap" — 2014/11/4— 11:10 — page iii — #3i i i i i i

Contents

Prefaceix

Introductionxi

General Information About the Exam . . . . . . . . . . . . . . . . . . . . . . . xi Hints for Taking the Exam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii The Multiple-Choice Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii The Free-Response Section. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii How to Use This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii

Practice Exam One / Diagnostic Test1

Computer Science Section I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Computer Science Section II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Answer Key (Section I) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Diagnostic Chart for Practice Exam . . . . . . . . . . . . . . . . . . . . . . . . . 45 Answers Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Chapter 1. Introductory Java Language Features57

Packages and Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Javadoc Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Types and Identiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Identiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Built-in Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Storage of Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Hexadecimal and Octal Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 62 Final Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Relational Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Assignment Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Increment and Decrement Operators . . . . . . . . . . . . . . . . . . . . . . . 66 Operator Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Input/Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Escape Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Control Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Decision-Making Control Structures . . . . . . . . . . . . . . . . . . . . . . . 69 Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Errors and Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Multiple-Choice Questions on Introductory Java Language Concepts . . 77 Answer Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Answers Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 iii i i “ap" — 2014/11/4— 11:10 — page iv — #4i i i i i i ivContents

Chapter 2. Classes and Objects92

Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Public, Private, and Static . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Types of Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Method Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 ThethisKeyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Reference vs. Primitive Data Types . . . . . . . . . . . . . . . . . . . . . . . . 101 The Null Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Method Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Multiple-Choice Questions on Classes and Objects . . . . . . . . . . . . . . . 111 Answer Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 Answers Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

Chapter 3. Inheritance and Polymorphism131

Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 Superclass and Subclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 Inheritance Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 Implementing Subclasses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Declaring Subclass Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Dynamic Binding (Late Binding) . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Usingsuperin a Subclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Type Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Downcasting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 TheClassCastException. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Abstract Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Abstract Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 TheabstractKeyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Dening an Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 TheimplementsKeyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 TheComparableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Multiple-Choice Questions on Inheritance and Polymorphism . . . . . . . 150 Answer Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 Answers Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

Chapter 4. Some Standard Classes174

TheObjectClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 The Universal Superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 Methods inObject. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 TheStringClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 StringObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 ConstructingStringObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 The Concatenation Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 i i “ap" — 2014/11/4— 11:10 — page v — #5i i i i i i

Contentsv

Comparison ofStringObjects . . . . . . . . . . . . . . . . . . . . . . . . . . 178 OtherStringMethods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 Wrapper Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 TheIntegerClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 TheDoubleClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 TheMathClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 Random Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Multiple-Choice Questions on Standard Classes . . . . . . . . . . . . . . . . . 187 Answer Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 Answers Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

Chapter 5. Program Design and Analysis207

The Software Development Life Cycle . . . . . . . . . . . . . . . . . . . . . . . 207 The Waterfall Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 Program Specication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Program Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Program Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Testing and Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Program Maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Object-Oriented Program Design . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Identifying Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Identifying Behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 Determining Relationships Between Classes . . . . . . . . . . . . . . . . . . 211 UML Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Implementing Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Implementing Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 Vocabulary Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Program Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Program Correctness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Efciency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Multiple-Choice Questions on Program Design and Analysis . . . . . . . . 221 Answer Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Answers Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

Chapter 6. Arrays and Array Lists233

One-Dimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Length of Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Traversing an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Arrays as Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Array Variables in a Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 Array of Class Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Analyzing Array Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 Array Lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 The Collections API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 The Collections Hierarchy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 Collections and Generics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 Auto-Boxing and -Unboxing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 TheListInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 i i “ap" — 2014/11/4— 11:10 — page vi — #6i i i i i i viContents The Methods ofList. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 TheArrayListClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 UsingArrayList. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 Collections and Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Denition of an Iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 TheIteratorInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Using a Generic Iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Two-Dimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Matrix as Array of Row Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Processing a Two-Dimensional Array . . . . . . . . . . . . . . . . . . . . . . . 251 Two-Dimensional Array as Parameter . . . . . . . . . . . . . . . . . . . . . . 253 Multiple-Choice Questions on Arrays and Array Lists . . . . . . . . . . . . 255 Answer Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Answers Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284

Chapter 7. Recursion290

Recursive Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 General Form of Simple Recursive Methods . . . . . . . . . . . . . . . . . . . 291 Writing Recursive Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 Analysis of Recursive Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 Sorting Algorithms That Use Recursion . . . . . . . . . . . . . . . . . . . . . . 295 Recursive Helper Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 Recursion in Two-Dimensional Grids . . . . . . . . . . . . . . . . . . . . . . . . 298 Sample Free-Response Question 1 . . . . . . . . . . . . . . . . . . . . . . . . . 300 Sample Free-Response Question 2 . . . . . . . . . . . . . . . . . . . . . . . . . 303 Multiple-Choice Questions on Recursion . . . . . . . . . . . . . . . . . . . . . 308 Answer Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 Answers Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319

Chapter 8. Sorting and Searching324

Sorts: Selection and Insertion Sorts . . . . . . . . . . . . . . . . . . . . . . . . . 324 Selection Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 Insertion Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 Recursive Sorts: Mergesort and Quicksort . . . . . . . . . . . . . . . . . . . . 325 Mergesort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 Quicksort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 Sorting Algorithms in Java. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 Sequential Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 Binary Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 Multiple-Choice Questions on Sorting and Searching . . . . . . . . . . . . . 331 Answer Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 Answers Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346

Chapter 9. The AP Computer Science A Labs351

The Magpie Lab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 Special Emphasis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 The Elevens Lab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 Special Emphasis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 i i “ap" — 2014/11/4— 11:10 — page vii — #7i i i i i i

Contentsvii

The Picture Lab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 Special Emphasis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 Multiple-Choice Questions on the Lab Concepts . . . . . . . . . . . . . . . . 360 Answer Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 Answers Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373

Practice Exams377

Practice Exam Two379

Computer Science Section I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 Computer Science Section II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 Answer Key (Section I) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 Answers Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420

Practice Exam Three433

Computer Science Section I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 Computer Science Section II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 Answer Key (Section I) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 Answers Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472

AAppendix: Glossary of Useful Computer Terms482

Index485

i i “ap" — 2014/11/4— 11:10 — page viii — #8 i i i i i i 5

Barron'sEssential

As you review the content in this book to work toward earning that5on your AP Computer Science A exam, here are five things that youMUSTknow above everything else:

1The Basics.Every AP exam question uses at least one of these:

Types and Identifiers (p. 60)

Operators (p. 63)

Control structures (p. 69)

2Objects, Classes, and Inheritance.You may have to write your own class.

You'll definitely need to interpret at least one class that's given.

Methods (p. 95)

Subclasses (p. 131)

Abstract classes (p. 142)

Interfaces (p. 144)

3Lists and Arrays.Learn to manipulate a list. Search, delete an item, insert an

item. It seems as if every second question on the AP exam uses a list!

One-dimensional arrays (p. 233)

ArrayLists (p. 244)

4 Two-dimensional Arrays.Learnto manipulate a matrix. Thistopic has become more prominent on the AP exam in recent years.

Two-dimensional arrays (p. 249)

Row-column traversal (p. 251)

for-each loop traversal (p. 251)

Row-by-row array processing (p. 251)

5Sorting and Searching.Know these algorithms!

Selection Sort (p. 324)

Insertion Sort (p. 325)

Merge Sort (p. 325)

Binary Search (p. 329)

i i “ap" — 2014/11/4— 11:10 — page ix — #9 i i i i i i

Preface

This book is aimed at students reviewing for the AP Computer Science A exam. It would normally be used at the completion of an AP course. However, it contains a complete summary of all topics for the exam, and it can be used for self-study if accompanied by a suitable textbook. The book provides a review of object-oriented programming, algorithm analysis, and data structures. It can therefore be used as a supplement to rst-year college courses where Java is the programming language and as a resource for teachers of high school and introductory college courses. This seventh edition includes all features of Java that will be tested on the AP exam. The AP Computer ScienceDevelopmentCommittee is placing greater emphasison two-dimensional arrays. As a result, the following new sections have been added: using a for-each loop traversal treating a matrix as an array of arrays All students should be able to create, initialize, modify, and traverse two-dimensional arrays. More questions on two-dimensional arrays have been added for this edition. The GridWorld Case Study is gone! Starting in May 2015 there will be no questions on GridWorld. All GridWorld questions in the practice exams have been replaced by new questions, both multiple-choice and free-response. The AP Computer Science Labs were developed as a replacement for GridWorld. However, there will be no questions on the specic content of the labs on the AP exam. Instead, there will be questions that test the concepts developed in the labs. This seventh edition has a new chapter that summarizes the labs and highlights the conceptsthat are emphasizedin them. The chapter contains a new sectionof multiple- choice questionsbasedonthese concepts. A newsymbolin the margin, asshownhere, is used throughout the book to draw attention to these concepts. Another topic that is gone is theComparableinterface, which will no longer be tested on the AP exam. Students will, however, be expected to understand how the compareTomethod is used for typeString. The style of all questions and examples in the book has been revamped to better reect the style of recent exams. There are three complete practice exams. The exams follow the format of the AP exam, with multiple-choice and free-response sections. One exam is presented after the introduction to the book for possible use as a diagnostic test. A diagnostic chart accompaniesthis test. Detailed solutions with explanations are provided for all exams. Two additional exams are provided on the optional CD-ROM. This edition contains several new questions. There is no overlap of questions between the exams. Note that the scoring worksheets that accompany each exam, in both the book and CD-ROM, have been updated in this edition. They reect the new College Board policy of not penalizing students for wrong answers on the multiple-choice section. ix i i “ap" — 2014/11/4— 11:10 — page x — #10 i i i i i i xPreface

ACKNOWLEDGMENTS

I owe thanks to many people who helped in the creation of this book. Iam mostgratefulto my excellenteditor, Linda Turner, ofBarron's, forher friendly guidance and moral support throughout this project, over many years. I also thank all the other members of the Barron's staff who worked on the production of the book. I am grateful to Steven Andrianoffand David Levine of St. Bonaventure University,quotesdbs_dbs14.pdfusesText_20
[PDF] ap computer science multiple choice

[PDF] ap computer science multiple choice 2014

[PDF] ap computer science multiple choice pdf

[PDF] ap computer science pdf

[PDF] ap computer science practice exam 2018

[PDF] ap computer science practice test pdf

[PDF] ap computer science principles 2019 exam date

[PDF] ap computer science principles algorithms

[PDF] ap computer science principles barron's pdf

[PDF] ap computer science principles book pdf

[PDF] ap computer science principles crash course pdf

[PDF] ap computer science principles exam

[PDF] ap computer science principles exam 2019

[PDF] ap computer science principles exam date

[PDF] ap computer science principles exam due date