AP Computer Science A Flashcards: Expressions and Output
Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026
Review key ideas with interactive flashcards. This set includes 10 cards to help you master important concepts.
What are escape sequences in a string?
Escape sequences (e.g., \", \\, \n) are special sequences of characters that can be included in a string.
Card 1 of 10
All Flashcards (10)
What are escape sequences in a string?
Escape sequences (e.g., \", \\, \n) are special sequences of characters that can be included in a string.
What is a string literal?
A string literal is a sequence of characters enclosed in double quotes.
Which arithmetic operators have precedence over addition and subtraction?
Multiplication, division, and remainder have precedence over addition and subtraction.
What is the purpose of the System.out.print and System.out.println methods?
These methods are used to display information on the computer display.
How are operators with the same precedence evaluated in a compound expression?
Operators with the same precedence are evaluated from left to right.
What is the result of the expression: 3 * 5 % 4?
The result is 3, because multiplication and remainder have the same precedence and are evaluated left to right (15 % 4 = 3).
What is the primary difference between System.out.print and System.out.println?
System.out.println moves the cursor to a new line after displaying information, while System.out.print does not.
What output is generated by: System.out.print("AP\nCS");?
The output would be "AP" on the first line and "CS" on a new, second line due to the \n escape sequence.
What is the result of the expression: 10 - 4 / 2?
The result is 8, because division has precedence over subtraction.
How would you write a string literal to display the text: He said "Hi"!
You would use the string literal "He said \"Hi\"!" using the \" escape sequence for the inner quotes.