AP Computer Science Course Description
AP Computer Science Course Description
Science A
Course Description
E f f e c t i v e Fa l l 2 0 1 0
© 2010 The College Board. All rights reserved. College Board, Advanced Placement Program, AP, AP Central, SAT, and the acorn
logo are registered trademarks of the College Board. PSAT/NMSQT is a registered trademark of the College Board and National
Merit Scholarship Corporation. All other products and services may be trademarks of their respective owners. Permission to use
copyrighted College Board materials may be requested online at: www.collegeboard.com/inquiry/cbpermit.html.
Contents
Welcome to the AP Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
AP Courses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
AP Exams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
AP Course Audit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
AP Reading. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
AP Exam Grades . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Credit and Placement for AP Grades . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Setting Credit and Placement Policies for AP Grades . . . . . . . . . . . . . . . . . . . . . . . 3
AP Computer Science A. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Important Revisions to This Course Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
The Course. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Goals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Computer Language. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Equipment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Teaching the Course. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Topic Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Commentary on the Topic Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Case Studies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
The Exam. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Computer Science A: Sample Multiple-Choice Questions. . . . . . . . . . . . . . . . . . . 17
Answers to Computer Science A Multiple-Choice Questions. . . . . . . . . . . . . . 37
Sample Free-Response Questions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Suggested Solutions to Free-Response Questions. . . . . . . . . . . . . . . . . . . . . . . 52
Appendix A: AP Computer Science Java Subset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Appendix B: Standard Java Library Methods Required for AP CS A . . . . . . . . . . . . 65
Teacher Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
AP Central (apcentral.collegeboard.com). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
AP Publications and Other Resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Teacher’s Guides. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Course Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Released Exams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. i
Welcome to the AP® Program
For over 50 years, the College Board’s Advanced Placement Program (AP) has
partnered with colleges, universities, and high schools to provide students with the
opportunity to take college-level course work and exams while still in high school.
Offering more than 30 different subjects, each culminating in a rigorous exam, AP
provides motivated and academically prepared students with the opportunity to earn
college credit or placement and helps them stand out in the college admissions
process. Taught by dedicated, passionate AP teachers who bring cutting-edge content
knowledge and expert teaching skills to the classroom, AP courses help students
develop the study skills, habits of mind, and critical thinking skills that they will need
in college.
AP is accepted by more than 3,600 colleges and universities worldwide for college
credit, advanced placement, or both on the basis of successful AP Exam grades. This
includes over 90 percent of four-year institutions in the United States.
More information about the AP Program is available at the back of this Course
Description and at AP Central®, the College Board’s online home for AP teachers
(apcentral.collegeboard.com). Students can find more information at the AP student
site (www.collegeboard.com/apstudents).
AP Courses
More than 30 AP courses in a wide variety of subject areas are now available. A
committee of college faculty and master AP teachers designs each AP course to cover
the information, skills, and assignments found in the corresponding college course.
AP Exams
Each AP course has a corresponding exam that participating schools worldwide
administer in May. Except for AP Studio Art, which is a portfolio assessment, each AP
Exam contains a free-response section (essays, problem solving, oral responses, etc.)
as well as multiple-choice questions.
Written by a committee of college and university faculty and experienced AP
teachers, the AP Exam is the culmination of the AP course and provides students with
the opportunity to earn credit and/or placement in college. Exams are scored by
college professors and experienced AP teachers using scoring standards developed by
the committee.
AP Course Audit
The intent of the AP Course Audit is to provide secondary and higher education
constituents with the assurance that an “AP” designation on a student’s transcript is
credible, meaning the AP Program has authorized a course that has met or exceeded
the curricular requirements and classroom resources that demonstrate the academic
rigor of a comparable college course. To receive authorization from the College Board
to label a course “AP,” teachers must participate in the AP Course Audit. Courses
authorized to use the “AP” designation are listed in the AP Course Ledger made
available to colleges and universities each fall. It is the school’s responsibility to ensure
that its AP Course Ledger entry accurately reflects the AP courses offered within each
academic year.
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 1
The AP Program unequivocally supports the principle that each individual school
must develop its own curriculum for courses labeled “AP.” Rather than mandating any
one curriculum for AP courses, the AP Course Audit instead provides each AP teacher
with a set of expectations that college and secondary school faculty nationwide have
established for college-level courses. AP teachers are encouraged to develop or main-
tain their own curriculum that either includes or exceeds each of these expectations;
such courses will be authorized to use the “AP” designation. Credit for the success of
AP courses belongs to the individual schools and teachers that create powerful, locally
designed AP curricula.
Complete information about the AP Course Audit is available at www.collegeboard
.com/apcourseaudit.
AP Reading
AP Exams—with the exception of AP Studio Art, which is a portfolio assessment—
consist of dozens of multiple-choice questions scored by machine, and free-response
questions scored at the annual AP Reading by thousands of college faculty and expert
AP teachers. AP Readers use scoring standards developed by college and university
faculty who teach the corresponding college course. The AP Reading offers educators
both significant professional development and the opportunity to network with
colleagues. For more information about the AP Reading, or to apply to serve as a
Reader, visit apcentral.collegeboard.com/readers.
AP Exam Grades
The Readers’ scores on the free-response questions are combined with the results of
the computer-scored multiple-choice questions; the weighted raw scores are summed
to give a composite score. The composite score is then converted to a grade on AP’s
5-point scale:
AP GRADE QUALIFICATION
5 Extremely well qualified
4 Well qualified
3 Qualified
2 Possibly qualified
1 No recommendation
2 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Credit and Placement for AP Grades
Thousands of four-year colleges grant credit, placement, or both for qualifying AP
Exam grades because these grades represent a level of achievement equivalent to that
of students who have taken the corresponding college course. This college-level
equivalency is ensured through several AP Program processes:
• College faculty are involved in course and exam development and other AP
activities. Currently, college faculty:
• Serve as chairs and members of the committees that develop the Course
Descriptions and exams in each AP course.
• Are responsible for standard setting and are involved in the evaluation of
student responses at the AP Reading. The Chief Reader for each AP subject
is a college faculty member.
• Lead professional development seminars for new and experienced AP teachers.
• Serve as the senior reviewers in the annual AP Course Audit, ensuring AP
teachers’ syllabi meet the curriculum guidelines of college-level courses.
• AP courses and exams are reviewed and updated regularly based on the results of
curriculum surveys at up to 200 colleges and universities, collaborations among the
College Board and key educational and disciplinary organizations, and the inter-
actions of committee members with professional organizations in their discipline.
• Periodic college comparability studies are undertaken in which the performance of
college students on AP Exams is compared with that of AP students to confirm that
the AP grade scale of 1 to 5 is properly aligned with current college standards.
For more information about the role of colleges and universities in the AP Program,
visit the Higher Ed Services section of the College Board Web site at professionals
.collegeboard.com/higher-ed.
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 3
AP Computer Science A
I n tr o d u cti o n
The Advanced Placement Program offers a course and exam in introductory computer
science. The course emphasizes object-oriented programming methodology with a
concentration on problem solving and algorithm development, and is meant to be the
equivalent of a first-semester college-level course in computer science. It also includes
the study of data structures, design, and abstraction. For a listing of the topics addressed,
see the AP Computer Science A topic outline on pages 8–10.
The nature of the AP course is suggested by the words “computer science” in the
title. Their presence indicates a disciplined approach to a more broadly conceived
subject than would a descriptor such as “computer programming.” There are no
computing prerequisites for the AP course. It is designed to serve as a first course in
computer science for students with no prior computing experience.
Because of the diversity of introductory computer science courses currently offered
by colleges and universities, the outline of topics described here may not match any
course exactly. The Association for Computing Machinery (ACM) and the Institute of
Electrical and Electronics Engineers (IEEE) Computer Society have published
standards for the content of a college-level program in computer science that include
recommendations for topics to be taught in the first two years of college. The AP
Computer Science A course is compatible with those topics that are taught in a typical
CS1 course as described in the example curricula in the ACM/IEEE guidelines. Some
colleges and universities may organize their curricula in alternative ways so that the
topics of the AP Computer Science A course are spread over the first one or two
college courses, with other topics from computer science interspersed.
The AP Computer Science A course can be offered by any secondary school that
has faculty who possess the necessary expertise and have access to appropriate
computing facilities. The course represents college-level achievement for which most
colleges and universities can be expected to grant advanced placement and credit.
Placement and credit are granted by institutions in accordance with their own policies,
not by the College Board or the AP Program.
4 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
T h e C o u rse
The AP Computer Science A course is an introductory course in computer science.
Because the design and implementation of computer programs to solve problems
involve skills that are fundamental to the study of computer science, a large part of the
course is built around the development of computer programs that correctly solve a
given problem. These programs should be understandable, adaptable, and, when
appropriate, reusable. At the same time, the design and implementation of computer
programs is used as a context for introducing other important aspects of computer
science, including the development and analysis of algorithms, the development and
use of fundamental data structures, the study of standard algorithms and typical
applications, and the use of logic and formal methods. In addition, the responsible use
of these systems is an integral part of the course. The topic outline on pages 8–10
summarizes the content typically taught in the AP Computer Science A course.
Goals
The goals of the AP Computer Science A course are comparable to those in the
introductory course for computer science majors offered in college and university
computer science departments. It is not expected, however, that all students in the AP
Computer Science A course will major in computer science at the university level. The
AP Computer Science A course is intended to serve both as an introductory course for
computer science majors and as a course for people who will major in other disciplines
that require significant involvement with technology. It is not a substitute for the usual
college-preparatory mathematics courses.
The following goals apply to the AP Computer Science A course when interpreted
within the context of the course. Students should be able to:
• design and implement solutions to problems by writing, running, and debugging
computer programs.
• use and implement commonly used algorithms and data structures.
• develop and select appropriate algorithms and data structures to solve problems.
• code fluently in an object-oriented paradigm using the programming language
Java. Students are expected to be familiar with and be able to use standard Java
library classes from the AP Java subset.
• read and understand a large program consisting of several classes and interacting
objects. Students should be able to read and understand a description of the
design and development process leading to such a program. (An example of such
a program is the AP Computer Science Case Study.)
• recognize the ethical and social implications of computer use.
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 5
Computer Language
The content of the college-level introductory programming course has evolved
significantly over the years. Starting as a treatment merely of language features, it
eventually incorporated first the notions of procedures and procedural abstraction,
then the use of modules and data abstraction. At most institutions, the current
introductory programming course takes an object-oriented approach to programming
that is based on encapsulating procedures and data and creating programs with
interacting objects. The AP Computer Science A course has evolved to incorporate
this approach.
Current offerings of the AP Computer Science A Exam require the use of Java.
Those sections of the exam that require the reading or writing of actual programs will
use Java. The exam will not include all the features of Java; it will be consistent with the
AP Java subset (see Appendix A). The AP Java subset can be found in the Computer
Science section of AP Central (apcentral.collegeboard.com). Students who study a
language other than Java during an AP Computer Science A course will need
to be prepared to use standard Java, as specified in the AP Java subset, on
the AP Computer Science A Exam.
Equipment
Students should have access to a computer system that represents relatively recent
technology. The system must be able to compile in seconds programs comparable in
size to the current AP Computer Science Case Study, and response time should be
reasonably rapid. This will require large hard disk drives either on individual machines
or shared via a network.
Each student in the course should have a minimum of three hours per week alone
on a computer throughout the academic year; additional time is desirable. This access
can be made available at any time during the school day or after school and need not
be made available to all students in the AP course simultaneously. It should be
stressed that (1) this requirement represents a bare minimum of access; and (2) this
time is not instructional time at a computer with the teacher or a tutor but is time that
the student spends alone at a computer in addition to the instructional time. Schools
that do not allow their facilities to be used after school hours may wish to reevaluate
such a policy in light of the needs of their students who take the AP Computer
Science A course.
Schools offering AP Computer Science A will need to have Java software and enough
memory in their lab machines so that students will be able to compile and run Java
programs efficiently. Both free and commercial Java systems are available from a
variety of sources. At a minimum, the hardware configuration will need large hard
drives and sufficient memory to support current operating systems and compilers.
6 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Prerequisites
The necessary prerequisites for entering the AP Computer Science A course
include knowledge of basic algebra and experience in problem solving. A student in
the AP Computer Science A course should be comfortable with functions and the
concepts found in the uses of functional notation, such as f(x) 5 x 1 2 and
f(x) 5 g(h(x)). It is important that students and their advisers understand that
any significant computer science course builds upon a foundation of mathematical
reasoning that should be acquired before attempting such a course.
One prerequisite for the AP Computer Science A course, competence in written
communication, deserves special attention. Documentation plays a central role in the
programming methodology that forms the heart of the AP Computer Science A
course. Students should have already acquired facility in written communication before
entering the course.
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 7
T o pic O u tli n e
Following is an outline of the major topics considered for the AP Computer Science A
Exam. This outline is intended to define the scope of the course but not necessarily
the sequence.
I. Object-Oriented Program Design
The overall goal for designing a piece of software (a computer program) is to correctly
solve the given problem. At the same time, this goal should encompass specifying and
designing a program that is understandable, can be adapted to changing circumstances,
and has the potential to be reused in whole or in part. The design process needs to be
based on a thorough understanding of the problem to be solved.
A. Program design
1. Read and understand a problem description, purpose, and goals.
2. Apply data abstraction and encapsulation.
3. Read and understand class specifications and relationships among the classes
(“is-a,” “has-a” relationships).
4. Understand and implement a given class hierarchy.
5. Identify reusable components from existing code using classes and class
libraries.
B. Class design
1. Design and implement a class.
2. Choose appropriate data representation and algorithms.
3. Apply functional decomposition.
4. Extend a given class using inheritance.
A. Implementation techniques
1. Methodology
a. Object-oriented development
b. Top-down development
c. Encapsulation and information hiding
d. Procedural abstraction
B. Programming constructs
1. Primitive types vs. objects
2. Declaration
a. Constant declarations
b. Variable declarations
c. Class declarations
d. Interface declarations
e. Method declarations
f. Parameter declarations
8 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
3. Console output (System.out.print/println)
4. Control
a. Methods
b. Sequential
c. Conditional
d. Iteration
e. Understand and evaluate recursive methods
C. Java library classes (included in the AP Java subset)
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 9
IV. Standard Data Structures
Data structures are used to represent information within a program. Abstraction is an
important theme in the development and application of data structures.
A. Simple data types (int, boolean, double)
B. Classes
C. Lists
D. Arrays
V. Standard Algorithms
Standard algorithms serve as examples of good solutions to standard problems. Many
are intertwined with standard data structures. These algorithms provide examples for
analysis of program efficiency.
A. Operations on data structures previously listed
1. Traversals
2. Insertions
3. Deletions
B. Searching
1. Sequential
2. Binary
C. Sorting
1. Selection
2. Insertion
3. Mergesort
10 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
C o m m e n tar y o n t h e T o pic O u tli n e
The topic outline below summarizes the content of the AP Computer Science A
curriculum. In this section, we provide more details about the topics in the outline.
A. Program Design
Students should be able to develop the parts of a program when given its design. This
would include an understanding of how to apply the data abstractions included in the
course (classes and arrays). Students are not expected to develop a full program
design.
Students should be able to understand the inheritance and composition relationships
among the different classes that comprise a program. They should also be able to
implement a class inheritance hierarchy when given the specifications for the classes
involved—which classes are subclasses of other classes.
B. Class Design
A fundamental part of the development of an object-oriented program is the design of a
class. Students should be able to design a class—write the class declaration including
the instance variables and the method signatures (the method bodies would comprise
the implementation of this design)—when they are given a description of the type of
entity the class represents. Such a description would include the data that must be
represented by the class and the operations that can be applied to that data. These
operations range from simple access to the data or information that can be derived
from the data, to operations that change the data (which stores the state) of an
instance of the class. The design of a class includes decisions on appropriate data
structures for storing data and algorithms for operations on that data. The decomposition
of operations into subsidiary operations—functional decomposition—is part of the
design process. An example of the process of designing a class is given in the sample
free-response question, which documents the logical considerations for designing a
savings account class.
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 11
Given a design for a class, either their own or one provided, students should then be
able to implement the class. They should also be able to extend a given class using
inheritance, thereby creating a subclass with modified or additional functionality.
An interface is a specification for a set of operations that a class must implement. In
Java, there is a specific construct, the interface, that can be specified for this
purpose, so that another class can be specified to implement that interface. Students
should be able to write a class that implements an interface.
12 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
II. Program Implementation
To implement a program, one must understand the fundamental programming
constructs of the language, as well as the design of the program. The fundamental
principles of encapsulation and information hiding should be applied when imple-
menting classes and data structures. A good program will often have components
that can be used in other programs.
There are topics not included in the course outline that will be part of any intro-
ductory course. For example, input and output must be part of a course on computer
programming. However, in a modern object-oriented approach to programming, there
are many ways to handle input and output, including console-based character I/O,
graphical user interfaces, and applets. Consequently, the AP CS A course does not
prescribe any particular approach and will not test the details of input and output
(except for the basic console output, System.out.print/ln in Java), so that
teachers may use an approach that fits their own style and whatever textbook and
other materials they use.
Students are expected to demonstrate an understanding of the concept of recursion
and to trace recursive method calls.
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 13
IV. Standard Data Structures
There are a number of standard data structures used in programming. Students
should understand these data structures and their appropriate use. Students need to
be able to use the standard representations of integers, real numbers, and Boolean
(logical) variables. The other primitive types in Java, char and float, are not part
of the AP Java subset but may be useful in the AP CS A course.
Students are responsible for understanding the Java String class and the
methods of the String class that are listed in the AP Java subset (see Appendixes).
Students should be comfortable working with one-dimensional and two-dimensional
lists of data and should be familiar with using Java arrays and the ArrayList class to
implement such lists. They should be able to use either in a program and should be
able to select the most appropriate one for a given application. The methods for the List
interface (and its implementation by the ArrayList class) for which students are
responsible are specified in the AP Java subset (see Appendixes).
14 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
• need for fault-tolerant and highly reliable systems for life-critical applications and
the resulting need for software engineering standards; and
• intellectual property rights of writers, musicians, and computer programmers and
fair use of intellectual property.
Attitudes are acquired, not taught. Hence, references to responsible use of computer
systems should be integrated into the AP CS A course wherever appropriate, rather
than taught as a separate unit. Participation in the AP CS A course provides an
opportunity to discuss issues such as the responsible use of a system and respect for
the rights and property of others. Students should learn to take responsibility for the
programs they write and for the consequences of the use of their programs.
C ase S t u dies
Case studies provide a vehicle for presenting many of the topics of the AP Computer
Science A course. They provide examples of good style, programming language
constructs, fundamental data structures, algorithms, and applications. Large programs
give the student practice in the management of complexity and motivate the use of
certain programming practices (including decomposition into classes, use of
inheritance and interfaces, message passing between interacting objects, and selection
of data structures tailored to the needs of the classes) in a much more complete way
than do small programs.
Case studies also allow the teacher to show concretely the design and implemen-
tation decisions leading to the solution of a problem and thus to focus more effectively
on those aspects of the programming process. This approach gives the student a
model of the programming process as well as a model program. The use of case
studies also gives the student a context for seeing the importance of good design when
a program is to be modified.
The AP Computer Science A Exam will include questions based on the case study
described in the document AP Computer Science Case Study. These questions may
explore design choices, alternative choices of data structures, extending a class via
inheritance, etc., in the context of a large program without requiring large amounts of
reading during the exam. The AP Computer Science A Exam will contain several
multiple-choice questions and one free-response question targeting material from the
case study. Printed excerpts from the case study programs will accompany the exam.
Questions will deal with activities such as the following:
a. modifying the procedural and data organization of the case study program to
correspond to changes in the program specification;
b. extending the case study program by writing new code (including new methods
for existing classes, new subclasses extending existing classes, and new classes);
c. evaluating alternatives in the representation and design of objects and classes;
d. evaluating alternative incremental development strategies; and
e. understanding how the objects/classes of the program interact.
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 15
Sample questions for the AP Computer Science Case Study appear on AP Central. The
text and code for the AP Computer Science Case Study are available for downloading
from AP Central.
The Exam
The AP Computer Science A Exam is 3 hours long and seeks to determine how well
students have mastered the concepts and techniques contained in the course outline.
The exam consists of two sections: a multiple-choice section (40 questions in
1 hour and 15 minutes), which tests proficiency in a wide variety of topics, and a free-
response section (4 questions in 1 hour and 45 minutes), which requires the student to
demonstrate the ability to solve problems involving more extended reasoning.
The multiple-choice and the free-response sections of the AP Computer Science A
Exam require students to demonstrate their ability to design, write, analyze, and
document programs and subprograms.
Minor points of syntax are not tested on the exam. All code given is consistent with
the AP Java subset. All student responses involving code must be written in Java.
Students are expected to be familiar with and able to use the standard Java classes
listed in the AP Java subset. For both the multiple-choice and the free-response
sections of the exam, an appendix containing a quick reference to both the case study
and the classes in the AP Java subset will be provided.
In the determination of the grade for the exam, the multiple-choice section and the
free-response section are given equal weight. Because the exam is designed for full
coverage of the subject matter, it is not expected that many students will be able to
correctly answer all the questions in either the multiple-choice section or the free-
response section.
16 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 17
Sample Questions for Computer Science A
list.add("P");
list.add("Q");
list.add("R");
list.set(2, "s");
list.add(2, "T");
list.add("u");
System.out.println(list);
18 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
while (k , nums.size())
{
if (nums.get(k).equals(zero))
nums.remove(k);
k11;
}
}
[0, 0, 4, 2, 5, 0, 3, 0]
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 19
Sample Questions for Computer Science A
Which of the following code segments will assign the correct string to grade
for a given integer score ?
I. if (score .5 93)
grade 5 "A";
if (score .5 84 && score ,5 92)
grade 5 "B";
if (score .5 75 && score ,5 83)
grade 5 "C";
if (score , 75)
grade 5 "F";
(a) II only
(b) III only
(c) I and II only
(d) I and III only
(e) I, II, and III
20 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 21
Sample Questions for Computer Science A
6. A car dealership needs a program to store information about the cars for sale.
For each car, they want to keep track of the following information: number of
doors (2 or 4), whether the car has air conditioning, and its average number of
miles per gallon. Which of the following is the best design?
(a) Use one class, Car, which has three data fields:
int numDoors, boolean hasAir, and
double milesPerGallon.
(b) Use four unrelated classes: Car, Doors, AirConditioning, and
MilesPerGallon.
(c) Use a class Car which has three subclasses: Doors, AirConditioning,
and MilesPerGallon.
(d) Use a class Car, which has a subclass Doors, with a subclass
AirConditioning, with a subclass MilesPerGallon.
(e) Use three classes: Doors, AirConditioning, and MilesPerGallon,
each with a subclass Car.
22 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
/* missing code */
}
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 23
Sample Questions for Computer Science A
24 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 25
Sample Questions for Computer Science A
26 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
12. Which of the following changes should be made so that method findLongest
will work as intended?
(a) Insert the statement lenCount 5 0;
between lines 2 and 3.
(b) Insert the statement lenCount 5 0;
between lines 8 and 9.
(c) Insert the statement lenCount 5 0;
between lines 10 and 11.
(d) Insert the statement lenCount 5 0;
between lines 11 and 12.
(e) Insert the statement lenCount 5 0;
between lines 12 and 13.
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 27
Sample Questions for Computer Science A
return -1;
}
Which of the following best describes the contents of myStuff after the
following statement has been executed?
int m 5 mystery(n);
28 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
/** Precondition: x ≥ 0
*/
public void mystery(int x)
{
System.out.print(x % 10);
if ((x / 10) !5 0)
{
mystery(x / 10);
}
System.out.print(x % 10);
}
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 29
Sample Questions for Computer Science A
30 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
return loc;
}
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 31
Sample Questions for Computer Science A
private String s;
private int n;
Assume s has the value "world" and n is 6. What are the values of s
and n after the call changer(s, n) ?
s n
(a) world 6
(b) worldpeace 6
(c) world 12
(d) worldpeace 12
(e) peace 12
32 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
What are the contents of mat after the code segment has been executed?
(a) {
{2 1 1}
{3 2 1}
{3 3 2}
{3 3 3}}
(b) {
{2 3 3}
{1 2 3}
{1 1 2}
{1 1 1}}
(c) {
{2 3 3 3}
{1 2 3 3}
{1 1 2 3}}
(d) {
{2 1 1 1}
{3 2 1 1}
{3 3 2 1}}
(e) {
{1 1 1 1}
{2 2 2 2}
{3 3 3 3}}
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 33
Sample Questions for Computer Science A
return someList;
}
return someList;
}
34 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
21. Consider the following instance variable and incomplete method, partialSum,
which is intended to return an integer array sum such that for all i, sum[i] is
equal to arr[0] 1 arr[1] 1 ... 1 arr[i]. For instance, if arr
contains the values { 1, 4, 1, 3 }, the array sum will contain the values
{ 1, 5, 6, 9 }.
return sum;
}
Implementation 1
Implementation 2
22. Consider the following declaration for a class that will be used to represent
points in the xy-coordinate plane.
public Point()
{
myX 5 0;
myY 5 0;
}
The following incomplete class declaration is intended to extend the above class
so that points can be named.
// constructors go here
36 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 37
Sample Questions for Computer Science A
1. In an instant runoff election there are two or more candidates and there are many
voters. Each voter votes by submitting a ballot that is an ordered list of all the
candidates, where the first name listed is the voter’s first choice, the second
name is the voter’s second choice, and so on. There are no ties allowed on a
voter’s ballot.
38 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
In the first pass, Chris has 3 votes, Pat has 2 votes, Sandy has 1 vote, and Jamie has
1 vote. Jamie and Sandy are tied for the fewest votes; so both are eliminated, leaving
Chris and Pat on the current candidate list. Voter preferences for these two candidates
are shown in the following table.
In the second pass, Chris has 3 votes and Pat has 4 votes. Chris has fewest votes and is
eliminated. Pat is the only remaining candidate and is therefore the winner of the
election.
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 39
Sample Questions for Computer Science A
// There may be instance variables, constructors, and methods that are not shown.
}
The Ballot method firstChoiceFrom returns the name of the candidate from
candidateList that appears first on this ballot.
The set of ballots for all voters in an election is modeled with the following partial
class declaration.
public class VoterBallots
{
private List<Ballot> ballotList;
// each entry represents one voter’s ballot
// There may be instance variables, constructors, and methods that are not shown.
}
40 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 41
Sample Questions for Computer Science A
/** If str is found in myLine the first occurrence of str has been
* removed from myLine; otherwise myLine is left unchanged.
* @param str the string to be removed
*/
public void delete(String str)
{ /* to be implemented in part (b) */ }
42 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
Complete method insert below. Assume that the other class methods work
as specified.
/** Inserts str into myLine at position index;
* no characters from myLine are overwritten.
* @param str the string to be inserted
* @param index the position at which to insert str
* Precondition: 0 ≤ index ≤ myLine.length()
*/
public void insert(String str, int index)
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 43
Sample Questions for Computer Science A
44 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
In writing deleteAll, you may call any of the methods in the LineEditor
class, including insert and delete from parts (a) and (b). Assume
that these methods work as specified, regardless of what you wrote in
parts (a) and (b).
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 45
Sample Questions for Computer Science A
Note: The following question is somewhat longer than what may appear on the
AP Computer Science A Exam. In particular, a question of this type appearing on the
AP Computer Science A Exam might be limited to two parts.
The abstract class Account models a bank account with the following data and
operations.
Data
• t he identity number for the account (The identity number is never
changed once the account has been constructed.)
• t he balance in the account (The balance can change as a result of
some operations.)
Operations
• create an account with a given identity number and initial balance
• return the identity number
• return the current balance
• deposit some positive amount into the account, increasing the balance
• d
ecrease the balance by a specified positive amount; if the amount is
greater than the balance, throw an IllegalArgumentException
• return the monthly interest due
46 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 47
Sample Questions for Computer Science A
(a) A savings account at a bank “is-a” bank account and is modeled by the class
SavingsAccount. A savings account has all the characteristics of a bank
account. In addition, a savings account has an interest rate, and the interest
due each month is calculated from that interest rate. The operations for a
savings account that differ from those specified in the class Account are
the following.
• create a new savings account with a given annual interest rate, as well as
the parameters required for all accounts
• withdraw a positive amount that does not exceed the current balance,
decreasing the balance by the amount withdrawn
• calculate the monthly interest by multiplying the current balance by the
annual interest rate divided by twelve
Write the complete definition of the class SavingsAccount, including
the implementation of methods.
48 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
(b) A checking account at a bank “is-a” bank account and is modeled by the
class CheckingAccount. A checking account has all the characteristics
of a bank account. In addition, a checking account can have checks written
on it. Each check written decreases the account by the amount of the check
plus a per-check charge. The operations for a checking account that differ
from those specified in the class Account are the following.
• create a new checking account with a given per-check charge, as well as
the parameters required for all accounts
• clear a check for a given amount by decreasing the balance by the
amount of the check plus the per-check charge
• compute and return the monthly interest
A declaration of the class CheckingAccount is shown below.
public class CheckingAccount extends Account
{
private double checkCharge;
public CheckingAccount(
int idNumber, double startBal,
double chkCharge)
{
super(idNumber, startBal);
checkCharge 5 chkCharge;
}
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 49
Sample Questions for Computer Science A
/** F
or each account in this bank, deposits the monthly interest due into that
* account.
*/
public void postMonthlyInterest()
{
// to be implemented in this part
}
// There may be instance variables, constructors, and methods that are not
// shown.
}
50 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
/** F
or each account in this bank, deposits the monthly interest due into that
* account.
*/
public void postMonthlyInterest()
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 51
Sample Questions for Computer Science A
if (candidate.equals(first))
numVotes++;
}
return numVotes;
}
(b)
return result;
}
52 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
if (thisVotes , minVotes)
{
minVotes 5 thisVotes;
result 5 new ArrayList<String>();
}
if (thisVotes 55 minVotes)
result.add(candidateList.get(c));
}
return result;
}
Question 2
(a)
(b)
if (index !5 -1)
{
myLine 5 myLine.substring(0, index)
1 myLine.substring(index 1 str.length());
}
}
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 53
Sample Questions for Computer Science A
(c)
Question 3
(a)
54 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Sample Questions for Computer Science A
(b)
(c)
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 55
A ppe n di x A
56 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Language Features
1. The primitive types int, double, and boolean are part of the AP
Java subset. The other primitive types short, long, byte, char, and
float are not in the subset. In particular, students need not be aware that
strings are composed of char values. Introducing char does not increase
the expressiveness of the subset. Students already need to understand string
concatenation, String.substring, and String.equals. Not introducing
char avoids complexities with the char/int conversions and confusion between
"x" and 'x'.
2. Arithmetic operators: 1, 2, *, /, % are part of the AP Java subset.
3. The increment/decrement operators 11 and 22 are part of the AP Java subset.
These operators are used only for their side effect, not for their value. That is,
the postfix form (for example, x11) is always used, and the operators are not
used inside other expressions. For example, a[x11] is not used.
4. The assignment operator 5 is part of the AP Java subset. The combined
arithmetic/assignment operators 15, 25, *5, /5, %5 are part of the AP Java
subset, although they are used simply as a shorthand and will not be used in the
adjustment part of a for loop.
5. Relational operators 55, !5, ,, ,5, ., .5 are part of the AP Java subset.
6. Logical operations &&, ||, ! are part of the AP Java subset. Students need to
understand the “short circuit” evaluation of the && and || operators. The logical
&, | and ^ and the bit operators ,,, .., . . ., &, ~, |, ^ are not in the subset.
7. The ternary ?: operator is not in the subset.
8. The numeric casts (int) and (double) are part of the AP Java subset.
Since the only primitive types in the subset are int, double, and boolean,
the only required numeric casts are the cast (int) and the cast (double).
Students are expected to understand “truncation towards 0” behavior as well
as the fact that positive floating-point numbers can be rounded to the nearest
integer as (int)(x 1 0.5), negative numbers as (int)(x 2 0.5).
Autoboxing, that is, the automatic conversion between primitive types (int,
double) and the corresponding wrapper classes (Integer, Double) is not
in the subset.
9. String concatenation 1 is part of the AP Java subset. Students are expected
to know that concatenation converts numbers to strings and invokes
toString on objects. String concatenation can be less efficient than using the
StringBuffer class. However, for greater simplicity and conceptual clarity, the
StringBuffer class is not in the subset.
10. The escape sequences inside strings \\, \", \n are part of the AP Java subset.
The \t escape and Unicode \uxxxx escapes are not in the subset. The \'
escape is only necessary inside character literals and is not in the subset.
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 57
11. User input is not part of the AP Java subset. There are many possible ways
for supplying user input: e.g., by reading from a Scanner, reading from a
stream (such as a file or a URL), or from a dialog box. There are advantages
and disadvantages to the various approaches. The exam does not prescribe any
one approach. Instead, if reading input is necessary, it will be indicated in a way
similar to the following:
double x 5 . . .;
// read user input
58 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
15. The control structures if, if/else, while, for (including the enhanced
for loop, also called the for-each loop), return are part of the AP Java
subset. The do/while, switch, plain and labeled break and continue
statements are not in the subset.
16. Methods: Method overloading (e.g., MyClass.someMethod(String str)
and MyClass.someMethod(int num)) is part of the AP Java subset.
Students should understand that the signature of a method depends on the
number, types, and order of its parameters but does not include the return type
of the method.
Methods with a variable number of parameters are not in the subset.
17. Classes: Students are expected to construct objects with the new operator, to
supply construction parameters, and to invoke accessor and modifier methods.
Students are expected to modify existing classes (by adding or modifying
methods and instance variables). Students are expected to design their own
classes.
18. Visibility: In the AP Java subset, all classes are public. All instance variables
are private. Methods, constructors, and constants (static final
variables) are either public or private. The AP Java subset does not use
protected and package (default) visibility.
19. The AP Java subset uses /* */, //, and /** */ comments. Javadoc
comments @param and @return are part of the subset.
20. The final keyword is only used for final block scope constants and
static final class scope constants. final parameters or instance
variables, final methods, and final classes are not in the subset.
21. The concept of static methods is a part of the subset. Students are required
to understand when the use of static methods is appropriate. In the exam,
static methods are always invoked through a class, never an object
(i.e., ClassName.staticMethod(), not obj.staticMethod()).
22. static variables are part of the subset.
23. The null reference is part of the AP Java subset.
24. The use of this is restricted to passing the implicit parameter in its entirety
to another method (e.g., obj.method(this)) and to descriptions such as
"the implicit parameter this". Using this.var or this.method(args)
is not in the subset. In particular, students are not required to know the idiom
"this.var 5 var", where var is both the name of an instance variable
and a parameter variable. Calling other constructors from a constructor with the
this(args) notation is not in the subset.
25. The use of super to invoke a superclass constructor (super(args)) or to
invoke a superclass method (i.e., super.method(args)) is part of the AP Java
subset.
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 59
26. Students are expected to implement constructors that initialize all instance
variables. Class constants are initialized with an initializer:
public static final MAX_SCORE 5 5;
The rules for default initialization (with 0, false or null) are not in the
subset. Initializing instance variables with an initializer is not in the subset.
Initialization blocks are not in the subset.
27. Students are expected to extend classes and implement interfaces. Students are
also expected to have a knowledge of inheritance that includes understanding
the concepts of method overriding and polymorphism. Students are expected to
implement their own subclasses.
28. Students are expected to read the definitions of interfaces and abstract classes
and understand that the abstract methods need to be implemented in a subclass.
Students are expected to write interfaces or class declarations when given a
general description of the interface or class.
29. Students are expected to understand the difference between object equality
(equals) and identity (55). The implementation of equals and hashCode
methods are not in the subset.
30. Cloning is not in the subset, because of the complexities of implementing the
clone method correctly and the fact that clone is rarely required in
Java programs.
31. The finalize method is not in the subset.
32. Students are expected to understand that conversion from a subclass reference
to a superclass reference is legal and does not require a cast. Class casts
(generally from Object to another class) are part of the AP Java subset.
The instanceof operator is not included in the subset, although it may be
used in the context of the case study. Array type compatibility and casts between
array types are not in the subset.
33. Students are expected to have a basic understanding of packages and a reading
knowledge of import statements of the form
import packageName.subpackageName.ClassName;
import statements with a trailing *, static imports, packages and methods for
locating class files (e.g., through a class path) are not in the subset.
34. Nested and inner classes are not in the subset.
35. The use of generic collection classes and interfaces are in the AP Java subset,
but students need not implement generic classes or methods.
60 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
36. Enumerations, annotations, and threads are not in the subset.
37. Students are expected to understand the exceptions that occur when
their programs contain errors (in particular, NullPointerException,
ArrayIndexOutOfBoundsException, ArithmeticException,
ClassCastException, IllegalArgumentException). Checked exceptions
are not in the subset. In particular, the try/catch/finally statements and
the throws modifier are not in the subset.
Summary Table
Potentially relevant
Tested in to CS1 course
A Exam but not tested
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 61
Potentially relevant
Tested in to CS1 course
A Exam but not tested
62 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Potentially relevant
Tested in to CS1 course
A Exam but not tested
Conversion to instanceof
supertypes and
(Subtype) casts
Nested classes,
inner classes
enumerations
Package concept, import
import packageName.className; packageName.*
static import
defining packages,
class path
© 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com. 63
Potentially relevant
Tested in to CS1 course
A Exam but not tested
Wrapper classes autoboxing
(Integer, Double)
64 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
APPEnDIx B
APPENDIX B
standard Java
Standard Java Library
Library methods
Methods Required Required
for AP CS Afor AP Cs A
Accessible
Accessible
Accessible methods
Methods
methods from
from from
the the
Java Java library
thelibrary
Java that
Library
that may may
That
be be included
May
included on the
BetheIncluded
on exam onexam
the Exam
class java.lang.Object
class java.lang.Object
x• boolean equals(Objectother)
boolean equals(Object other)
x• String toString()
String toString()
class java.lang.Integer
class java.lang.Integer
• Integer(int value)
x• int
Integer(int value)
intValue()
x int intValue()
• Integer.MIN_VALUE // minimum value represented by an int
• Integer.MAX_VALUE // maximum value represented by an int
class java.lang.Double
xclass java.lang.Double
Double(double value)
x• Double(double
double doubleValue()
value)
• double doubleValue()
class java.lang.String
xclass
intjava.lang.String
length()
x• int length()
String substring(int from, int to) // returns the substring beginning at from
• String substring(int from, int to) ////andreturns
ending the substring beginning at from
at to-1
x String substring(int from) //// and ending
returns at to-1
substring(from, length())
x• String substring(int
int indexOf(String from)
str) ////returns the index
returns of the first occurrence
substring(from, of str;
length())
• int indexOf(String str) ////returns -1the
returns if not found
index of the first occurrence of str;
x int compareTo(String other) returns
// // a value
returns -1< if
0 if foundis less than other
notthis
• int compareTo(String other) returns
// // a value
returns = 0 if< 0this
a value if thisis equal to other
is less than other
class java.lang.Math // returns
// a value
returns a > 0
value if
= 0this
if is
this greater
is than toother
equal other
x static int abs(int x) // returns a value > 0 if this is greater than other
x static double abs(double x)
xclass java.lang.Math
static double pow(double base, double exponent)
x• static int abs(int
static double x)
sqrt(double x)
x• static double random()
static double abs(double x) // returns a double in the range [0.0, 1.0)
• static double pow(double base, double exponent)
class java.util.ArrayList<E>
x
• static double sqrt(double x)
int size()
x• static
boolean double random()
add(E obj) //// returnsobj
appends a double in the
to end of list; rangetrue
returns [0.0, 1.0)
x void add(int index, E obj) // inserts obj at position index (0
index
size) ,
interface java.util.List<E>
// moving elements at position index and higher
• int size()
// to the right (adds 1 to their indices) and adjusts size
x• boolean
E get(intadd(E obj)
index) // appends obj to end of list; returns true
x• void add(int
E set(int index,
index, E obj)
E obj) //// inserts
replaces theobj
elementat position index (0
at positionindex £ index
with obj £ size) ,
moving
returns
//// elements
the element at position
formerly specified and
at the index higher
position
x E remove(int index) to theelement
removes
//// right (adds
from1position
to their indices)
index, and adjusts
moving size
elements
• E get(int index) // at position index + 1 and higher to the left
• E set(int index, E obj) (subtracts
//// replaces1 from their indices)
the element and adjusts
at position size with obj
index
returns
//// the element
returns formerly
the element at theatspecified
formerly position
the specified position
• E remove(int index) // removes element from position index, moving elements
// at position index + 1 and higher to the left
// (subtracts 1 from their indices) and adjusts size
// returns the element formerly at the specified position
66 © 2010 The College Board. Visit the College Board on the Web: www.collegeboard.com.
Contact Us
apcentral.collegeboard.com
I.N. 100083476