AP Computer Science A Study Guide

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/34

flashcard set

Earn XP

Description and Tags

Flashcards for AP Computer Science A exam review focusing on primitive types, objects, boolean expressions, iterations, classes, arrays, ArrayLists,

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

35 Terms

1
New cards

What is the difference between System.out.print and System.out.println in Java?

println moves the cursor to a new line after displaying the given data, while print does not.

2
New cards

How are single-line and multi-line comments denoted in Java?

Single-line comments are denoted by //, and multi-line comments are demarcated by /* and */.

3
New cards

What are the three primitive types used in AP Computer Science A?

int, double, and boolean

4
New cards

What are literals in Java?

Representations in code of exact values.

5
New cards

What is the result of dividing two int values in Java?

The result is an int, truncating any non-integer part.

6
New cards

What happens when an arithmetic operation involves at least one double value?

The result will be a double.

7
New cards

What is a variable in Java?

A name that is associated with a piece of computer memory that stores a value.

8
New cards

What is a variable declaration statement?

Consists of a type followed by a name (e.g., int age;).

9
New cards

What is the purpose of the 'final' keyword in variable declarations?

It indicates that the variable's value will never change after it is initially assigned.

10
New cards

What is a compound operator in Java?

An operator that combines an arithmetic operation and assignment (e.g., +=, -=, *=, /=, %=).

11
New cards

What are increment and decrement operators in Java?

Operators that add one (++) or subtract one (--) from a variable's value.

12
New cards

What is casting in Java?

Using operators (int) and (double) to create temporary values converted to another type.

13
New cards

What happens when casting a double to an int?

It results in truncation of the decimal portion.

14
New cards

What is a class in Java?

A blueprint, or template, for the objects of a certain type that specifies the attributes and methods an object will have.

15
New cards

How is an object created from a class?

By calling the class constructor along with the new keyword.

16
New cards

What is the signature of a constructor?

The name of the constructor along with the list of types of parameters that it expects.

17
New cards

What does it mean for a constructor to be overloaded?

A class may define multiple constructors as long as their signatures differ.

18
New cards

What is a reference variable?

A variable that refers to an object, storing a reference to the object's location in memory, rather than the object itself.

19
New cards

What is the special value 'null' used for?

Reference variables that do not contain a reference to any actual object.

20
New cards

How is interaction with objects primarily done?

By calling their methods.

21
New cards

What is the signature of a method?

Consists of its name along with a (possibly empty) list of the types of parameters it defines.

22
New cards

What are void methods?

Methods that do not return a value and can only be called as standalone statements.

23
New cards

What happens if a method is called on a 'null' value?

A NullPointerException is thrown.

24
New cards

How can a String object be created?

By simply using literal values, without explicitly calling the constructor with the 'new' keyword.

25
New cards

What is concatenation in the context of strings?

Combining strings using the '+' operator.

26
New cards

What are escape sequences in Java?

Series of characters beginning with a backslash that has special meaning.

27
New cards

What is the index of characters in a string?

The position of a character, starting at 0.

28
New cards

Which of the following methods are included in the AP Computer Science A exam (String(String str))?

constructs a new string that is identical to str

29
New cards

Which of the following methods are included in the AP Computer Science A exam (int length())?

returns the number of characters in the string

30
New cards

How is polymorphism implemented in Java?

It is implemented through method overriding

31
New cards

Which of the following methods are included in the AP Computer Science A exam (String compareTo(String other))?

returns a negative value if the string comes before other, a positive value if the string comes after other, and 0 if the two are equal

32
New cards

What does it mean for strings to be immutable?

They have no mutator methods; methods like substring return a new string and do not modify the original.

33
New cards

What are autoboxing and unboxing?

Features of the Java compiler that automatically convert between wrapper classes and the corresponding primitive types.

34
New cards

Which of the following Boolean expressions are equivalent to the expression (!(A && B))?

(!A || !B)

35
New cards

If an object has an equals method, and you want to check if it is not equal to another object, what idiom you can use?

(!obj1.equals(obj2))