APCS-A Final
Exam Information -- December 2025
|
General Exam Information Exam Value: 20% of your overall semester grade Allotted Time: Approximately 90 minutes (but you may begin up to 45
minutes before the start of the period) Allowed Materials: Nothing (no electronics, networks, mobile devices,
files, books, notes, or neighbors)* * A Google Doc
will be allowed for the code-writing question (see below) Exam Format: 1) Answer 45 multiple-choice questions relating to
Java 2) Write code for one Java method Suggestions on Preparing for the Exam Make sure you know/learn
all of the information listed on this page Review your coding
assignments from this semester Retake the practice and actual
full quizzes Specifics on Multiple-Choice Questions You will be given a paper
exam with 45 multiple-choice questions Each of the 45 questions
will have five answer choices For each question, you
should read all five answer choices and choose the best answer You will write your answers
(a capital letter for each question) on a separate paper answer sheet Combined, the 45
multiple-choice questions will be worth 75% of your final exam grade Some of the questions will
involve terminology (see below) Some of the questions will
involve finding errors in code (see below) Some of the questions will
involving using operators, variables, and statements correctly Some of the questions will
involve determining the output produced by one or more lines of code [See below for sample multiple-choice questions] Specifics on Code-Writing Question You will be given a paper
exam with the signature for a specific method The method will deal with
one-dimensional Java arrays, ArrayLists, Java String methods, and loops You will write only the
code that goes inside the method You will not write any
import lines or a 'main' method You will not get any user
input or use any global variables You will type your code
directly into a Google Doc (with no access to a code editor, the Web,
other files, or notes) You will need to turn in
your multiple-choice paper answer sheet before logging into your computer The code-writing question
will be worth 25% of your final exam grade Skills and Topics Possibly Needed for
the Final Exam Variable types: String Integer Double Float Boolean Character int double float boolean char Symbols for surrounding code, strings, lists, numbers,
and characters: { } [ ] ( )
<
>
"
" ' ' Operators: = && || == !
!=
% ++ -- += -= *= /= Commenting Characters: // /* */ Output statements: System.out.println() System.out.print() Conditional statement syntax and function: if
if else if else else. . . Loop syntax and function: for while do while Types of errors: syntax logic runtime user ArrayList methods:
.add() .set() .get() .remove() .clear() .size() .contains() .indexOf() .lastIndexOf() String and character methods:
.length() .substring() .charAt() .indexOf() .lastIndexOf() .contains() .equals() .equalsIgnoreCase() .trim() .toUpperCase() .toLowerCase() Identifier naming
conventions and restrictions Casting variables into
different types Converting variable types
via "wrapper" classes The relationship between
the variable types 'char' and 'int' and ASCII
values Using quotation marks
(" ") for variables of type 'string' and apostrophes (' ') for
variables of type 'char' Extracting individual and
groups of characters from strings Constructors: signature lines, naming, purposes, and uses
(including the 'new' keyword) The 'new' keyword and how
it is used to create objects Method signatures Passing values to and from,
and returning values from, methods: when the variable type is needed The format and purpose of
comments Arrays and ArrayLists Two-dimensional arrays,
including determining the number of rows and columns in an array Using '.length()' and '.size()' and '.length' Strings vs. primitive variable
types Custom user types Tracing 'for', 'while', and
'do-while' loops Determining output from
segments of code, including recursive methods Determining the number of
rows and columns in a two-dimensional array Using '.equals()' and '==' Compound 'if' statements Short-circuiting 'if'
statements (with && and ||) Using forward slashes (/)
and backslashes (\) Using 'return' (both with
and without data) to leave a method Additional Coding Notes In Java, ! can be used as part of a != and also by itself in front of a comparison In Java, parentheses must
be used with 'if' and 'for' and 'while' lines In Java, (two) semicolons
separate the three parts of a 'for' statement In a Java 'for' statement, the middle part is a 'while' condition (without the word "while") In Java, a semicolon is
usually not placed at the end of a 'for' or 'if' statement In Java, without braces { }, only one line will be part of an 'if' or 'else' condition or a 'for' or 'while' loop In Java, num++ is equivalent to num
+= 1 is equivalent to num
= num + 1 In Java, numbering for
strings and lists starts at zero (0), not one (1) Order matters when
assigning values to variables (x = 7 vs. 7 = x) With integers, modding by 10 gives the last digit, while dividing by 10
gets rid of the last digit Java variable names can
contain letters, numbers, underscores, and dollar signs, but cannot start
with a number Terms to Understand and Know How They
Relate to Java Programs NOTE: In addition to the definitions below, you should know how these terms
relate to the code in programs Class -- a series of instructions that define how an
object will look (attributes) and act (behaviors); used to create objects and define the initial state of the
objects (via constructors and private variables) and the information that the objects will contain Object -- a specific instance of a class; used to perform
actions or tasks in a program; defined by its attributes and behaviors; unlimited (independent, if not
static) objects can be created from a single class Attributes
-- describe how an object looks; are most often instance variables Behaviors
-- define what an object can do; usually methods Method -- a section of code that performs some action
defined by a class; one or more statements that direct an object to perform a specific task Constructor -- a method in a class that has the same name as
the class; it has no return type and is used to create instances (objects) of the class and
initialize variables, as needed; a class can contain multiple constructors new -- a
keyword used in conjunction with a constructor in a class to create a new
instance of that class Identifier
-- the name used to refer to a variable, method, class, or package Method Signature -- the line at the start of a method that defines the method; it
specifies the level of access to the method, the method's return type, the name of
the method, and the method's parameters (if any) void -- a
keyword that can be used in the signature line of a method to indicate that
the method does not return a value Argument
-- a value, variable, or expression passed to a method (inside the
parentheses) when the method is called; sometimes called an "actual
parameter" Parameter
-- a declaration inside the parentheses of a method signature; it holds a
value (argument) passed to the method when it is called; sometimes called a
"formal parameter" Return Type
-- the type of value (string, double, boolean,
ArrayList, etc.) returned (sent back) from a method; it must match the type of return value specified in
the method's signature Code Block
-- a section of code consisting of two or more statements, usually appearing
within the opening and closing braces of a method, loop, or conditional
statement Infinite Loop
-- a loop that never ends; this is generally caused by the loop's exit
condition(s) never being met Rectangular Two-Dimensional Array -- a 2D array that has the same number of columns
in every row Define a Variable -- to declare the name of a new variable, along with the type of
value that it will hold Initialize a Variable -- to give a variable its starting (initial) value Scope --
the area of a program in which a variable, constant, or method has value and
can be accessed Global Variable -- a variable that is defined inside a class, but outside all
methods, which means that it can be accessed from within all methods defined within the
class; it exists for the life of the class Local Variable -- a variable that is defined inside a method, which means the scope
of the variable is local and the variable has value and can be accessed only from
within the method in which it was defined; the variable can be passed into other methods, where
it will be a local variable in those methods; a
variable defined within the scope of a loop or conditional statement is also
a local variable Counter Variable -- a variable used with a loop that is incremented or decremented by
a set amount every time the loop is run; although it doesn't have to change
by a value of one, it generally does keep track of how many times the code in the loop has
been executed Debug --
to find and fix errors (bugs) in program code Execute --
to run a program or a segment of computer code Escape Sequence -- a blackslash, immediately followed by a
character, that causes the computer to interpret the sequence in a special way; often used to display
characters or symbols that are difficult to display using normal printing techniques (e.g.,
tabs, quotation marks, newlines) Sample Multiple-Choice Questions Sample #1) What is the syntax
error in the following code segment? String word =
"hamburger"; if (word.charAt(5)
== "r") System.out.print("Yeee!\n"); A) the '\n' should be '/n' B) the 'if' line is
missing a semicolon at the very end C) the quotations marks on
the 'if' line (" ") should be apostrophes (' ') D) the method 'charAt()' should be 'charat()' E) [there are no syntax
errors in the code segment] C Sample #2) With regard to Java
double and float variable types: A) the 'double' data type
can be more precise than the 'float' data type B) both 'double' and 'float'
variables can hold decimal numbers C) the 'double' data type
uses less memory than the 'float' data type D) [a & b only] E) [b & c only] D Sample #3) What will be the output
from the following code segment? for (int
w = 7; w < 3; w--) System.out.print(w + ", "); A) 7, 6, 5, 4, B) 7, 6, 5, 4, 3, C) 6, 5, 4, D) [an infinite number of
integers will be displayed] E) [no output will be
produced by the code segment] E Sample #4) With regard to the
method '.equals()' and the '==' operator: A) the method '.equals()'
should be used when comparing objects B) the '==' operator
should be used when comparing primitive data types C) when comparing strings,
the method '.equals()' should always be used D) [all of the above] E) [none of the above] D Sample #5) What will be the output
from the following call to the method 'mystery' below? mystery("Successfully"); public static void
mystery(String str) { if (str.length()
> 1) { if (str.charAt(0)
== str.charAt(1)) System.out.print(str.charAt(0)); mystery(str.substring(1)); } } A) csl B) ccssll C) ccessfullyssfullylly D) SuccessfullySuccessfullySuccessfully E) [no output will be
produced and an infinite loop will occur] A Sample #6) What is a term for a
loop that never ends? A) while loop B) for loop C) infinite loop D) recursive loop E) [none of the above] C Sample #7) What will be the value
of the variable 'word' after the
following code segment is executed? int num1 = 2, num2 = 7; String word =
""; while (num1 < num2) { if (num2 % 2 == 0) { word = word +
"x"; } num1 += 2; num2++; } A) x B) xx C) xxx D) xxxx E) xxxxx B Sample #8) The process of
finding and fixing errors in a computer program is called: A) initializing B) debugging C) defining D) escaping E) [none of the above] B |