AP Computer Science a Flashcards: Expressions And Output

Study Expressions And Output in AP Computer Science a with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.

AP Computer Science a

Expressions And Output

0 mastered0 still learning

0% Complete

QUESTION
1/ 70

What is the output of: System.out.println('A' + 1);?

Tap card or press Space to flip

ANSWER
  1. Character 'A' has ASCII value 65, so 65+1=6665 + 1 = 66.

How well did you know it?

Card 1 / 70

What this deck covers

This deck focuses on Expressions And Output, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.

How to use these flashcards

Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.

All flashcards

Flashcard 1: What is the output of: System.out.println('A' + 1);?

Answer:

  1. Character 'A' has ASCII value 65, so 65+1=6665 + 1 = 66.

Flashcard 2: What is the result of 10 % 3 in Java?

Answer:

  1. Modulus operator returns the remainder after division.

Flashcard 3: What does System.out.print() do differently than println()?

Answer: Output without a newline. Does not add a newline character after output.

Flashcard 4: Identify the error: System.out.println('Hello' - 'World');

Answer: Operator '-' cannot be applied to Strings. Subtraction operator is not defined for String operands.

Flashcard 5: What will be printed: System.out.println(true && false);?

Answer: false. Logical AND requires both operands to be true.

Flashcard 6: What is the operator precedence of *, /, %, +, - in Java?

Answer: *, /, % have higher precedence than +, -. Multiplication, division, and modulus are evaluated before addition and subtraction.

Flashcard 7: What is the output of: System.out.println(4 + 2 * 3 - 1);?

Answer:

  1. Order: 2×3=62 \times 3 = 6, then 4+61=94 + 6 - 1 = 9.

Flashcard 8: What is the result of: System.out.println(10 % 2);?

Answer:

  1. 10 divided by 2 has no remainder.

Flashcard 9: How is a string concatenated with an integer in Java?

Answer: Using the + operator. The ++ operator performs concatenation when one operand is a string.

Flashcard 10: What will be printed: System.out.println('a' + 'b');?

Answer:

  1. ASCII values: a=97, b=98, so 97+98=19597 + 98 = 195.

Flashcard 11: What is the output of: System.out.println(8 / 3.0);?

Answer: 2.6666666666666665. Double division produces precise floating-point result.

Flashcard 12: What does the expression 2 * (3 + 4) evaluate to?

Answer:

  1. Parentheses force addition first: (3+4)=7(3 + 4) = 7, then 2×7=142 \times 7 = 14.

Flashcard 13: Identify the error: System.out.println('Sum: ' + 5 + 3);

Answer: Output is 'Sum: 53', not 'Sum: 8'. String concatenation with ++ operator evaluates left-to-right without parentheses.

Flashcard 14: How do you declare a constant in Java?

Answer: Using the final keyword. Makes variables immutable after initialization.

Flashcard 15: What is the result of: System.out.println(4 * 0.5);?

Answer: 2.0. Integer multiplied by double results in double type.

Flashcard 16: What is the output of: System.out.println(9 / 2.0);?

Answer: 4.5. Double divisor produces floating-point division result.

Flashcard 17: What is the operator used for modulus in Java?

Answer: %. Returns the remainder of integer division.

Flashcard 18: What is the result of: System.out.println(6.0 / 3);?

Answer: 2.0. Double dividend produces floating-point division.

Flashcard 19: What is the result of: System.out.println('a' + 1);?

Answer:

  1. Character 'a' has ASCII value 97, so 97+1=9897 + 1 = 98.

Flashcard 20: What is the result of: System.out.println(12 / 5);?

Answer:

  1. Integer division truncates the decimal portion.

Flashcard 21: What does the '==' operator compare in Java?

Answer: Primitive values or object references. Compares actual values for primitives, memory addresses for objects.

Flashcard 22: What will be printed: System.out.println('2' + 3 + 4);?

Answer:

  1. Character '2' concatenates, then numeric addition occurs.

Flashcard 23: What is the output of: System.out.println('A' + 'B');?

Answer:

  1. ASCII values: A=65, B=66, so 65+66=13165 + 66 = 131.

Flashcard 24: Identify the error: System.out.println('Hello' - 'World');

Answer: Operator '-' cannot be applied to Strings. Subtraction operator is not defined for String operands.

Flashcard 25: What is the result of: System.out.println('Java' + 1 + 2);?

Answer: Java12. String concatenation evaluates left-to-right without grouping.

Flashcard 26: What is the result of: System.out.println(7 - 3 * 2);?

Answer:

  1. Multiplication has higher precedence: 3×2=63 \times 2 = 6, then 76=17 - 6 = 1.

Flashcard 27: What is the result of: System.out.println('a' + 1);?

Answer:

  1. Character 'a' has ASCII value 97, so 97+1=9897 + 1 = 98.

Flashcard 28: Which data type can store a single character in Java?

Answer: char. Stores a single Unicode character in 16 bits.

Flashcard 29: What is the output of: System.out.println(0.1 + 0.2 == 0.3);?

Answer: false. Floating-point arithmetic precision issues cause inequality.

Flashcard 30: What is the result of 10 % 3 in Java?

Answer:

  1. Modulus operator returns the remainder after division.

Flashcard 31: What does System.out.print() do differently than println()?

Answer: Output without a newline. Does not add a newline character after output.

Flashcard 32: What is the output of: System.out.println(3.0 / 2);?

Answer: 1.5. Double division produces a floating-point result.

Flashcard 33: What is the result of: System.out.println(12 / 5);?

Answer:

  1. Integer division truncates the decimal portion.

Flashcard 34: What will be printed: System.out.println('2' + 3 + 4);?

Answer:

  1. Character '2' concatenates, then numeric addition occurs.

Flashcard 35: What is the output of: System.out.println(8 / 3.0);?

Answer: 2.6666666666666665. Double division produces precise floating-point result.

Flashcard 36: How is a string concatenated with an integer in Java?

Answer: Using the + operator. The ++ operator performs concatenation when one operand is a string.

Flashcard 37: What does the expression 2 * (3 + 4) evaluate to?

Answer:

  1. Parentheses force addition first: (3+4)=7(3 + 4) = 7, then 2×7=142 \times 7 = 14.

Flashcard 38: What does the expression 2 + 3 * 4 evaluate to?

Answer:

  1. Multiplication precedence: 3×4=123 \times 4 = 12, then 2+12=142 + 12 = 14.

Flashcard 39: What is the output of: System.out.println('A' + 1);?

Answer:

  1. Character 'A' has ASCII value 65, so 65+1=6665 + 1 = 66.

Flashcard 40: What is the value of a boolean expression: 5 > 3 && 3 > 5?

Answer: false. Second condition is false, making the entire AND expression false.

Flashcard 41: What is the output of: System.out.println(5 + 2 * 3);?

Answer:

  1. Multiplication precedence: 2×3=62 \times 3 = 6, then 5+6=115 + 6 = 11.

Flashcard 42: What will be printed: System.out.println(true && false);?

Answer: false. Logical AND requires both operands to be true.

Flashcard 43: What is the output of: System.out.println(4 + 2 * 3 - 1);?

Answer:

  1. Order: 2×3=62 \times 3 = 6, then 4+61=94 + 6 - 1 = 9.

Flashcard 44: What is the output of: System.out.println(0.1 + 0.2 == 0.3);?

Answer: false. Floating-point arithmetic precision issues cause inequality.

Flashcard 45: What is the output of: System.out.println(3.0 / 2);?

Answer: 1.5. Double division produces a floating-point result.

Flashcard 46: How do you declare a constant in Java?

Answer: Using the final keyword. Makes variables immutable after initialization.

Flashcard 47: What is the result of: System.out.println('Java' + 1 + 2);?

Answer: Java12. String concatenation evaluates left-to-right without grouping.

Flashcard 48: What is the output of: System.out.println(5 + 2 * 3);?

Answer:

  1. Multiplication precedence: 2×3=62 \times 3 = 6, then 5+6=115 + 6 = 11.

Flashcard 49: What is the result of: System.out.println(6.0 / 3);?

Answer: 2.0. Double dividend produces floating-point division.

Flashcard 50: What is the result of: System.out.println(10 % 2);?

Answer:

  1. 10 divided by 2 has no remainder.

Flashcard 51: What does the '==' operator compare in Java?

Answer: Primitive values or object references. Compares actual values for primitives, memory addresses for objects.

Flashcard 52: What does the expression 2 + 3 * 4 evaluate to?

Answer:

  1. Multiplication precedence: 3×4=123 \times 4 = 12, then 2+12=142 + 12 = 14.

Flashcard 53: What is the result of: System.out.println(7 - 3 * 2);?

Answer:

  1. Multiplication has higher precedence: 3×2=63 \times 2 = 6, then 76=17 - 6 = 1.

Flashcard 54: What does the expression 5 + 3 * 2 evaluate to in Java?

Answer:

  1. Multiplication has higher precedence than addition: 3×2=63 \times 2 = 6, then 5+6=115 + 6 = 11.

Flashcard 55: Identify the error: System.out.println('Sum: ' + 5 + 3);

Answer: Output is 'Sum: 53', not 'Sum: 8'. String concatenation with ++ operator evaluates left-to-right without parentheses.

Flashcard 56: What is the result of: System.out.println(10 / 3);?

Answer:

  1. Integer division truncates the decimal portion in Java.

Flashcard 57: What is the output of: System.out.println('Java' + (1 + 2));?

Answer: Java3. Parentheses force addition first, then concatenation.

Flashcard 58: What is the result of: System.out.println(10 / 3);?

Answer:

  1. Integer division truncates the decimal portion in Java.

Flashcard 59: What is the output of: System.out.println(9 / 2.0);?

Answer: 4.5. Double divisor produces floating-point division result.

Flashcard 60: What is the result of: System.out.println(4 * 0.5);?

Answer: 2.0. Integer multiplied by double results in double type.

Flashcard 61: How do you print a double quote in a string in Java?

Answer: Using escape sequence ". Backslash escapes special characters in string literals.

Flashcard 62: What is the value of a boolean expression: 5 > 3 && 3 > 5?

Answer: false. Second condition is false, making the entire AND expression false.

Flashcard 63: What is the operator precedence of *, /, %, +, - in Java?

Answer: *, /, % have higher precedence than +, -. Multiplication, division, and modulus are evaluated before addition and subtraction.

Flashcard 64: What is the output of: System.out.println('A' + 'B');?

Answer:

  1. ASCII values: A=65, B=66, so 65+66=13165 + 66 = 131.

Flashcard 65: What will be printed: System.out.println('a' + 'b');?

Answer:

  1. ASCII values: a=97, b=98, so 97+98=19597 + 98 = 195.

Flashcard 66: What does the expression 5 + 3 * 2 evaluate to in Java?

Answer:

  1. Multiplication has higher precedence than addition: 3×2=63 \times 2 = 6, then 5+6=115 + 6 = 11.

Flashcard 67: How do you print a double quote in a string in Java?

Answer: Using escape sequence ". Backslash escapes special characters in string literals.

Flashcard 68: Which data type can store a single character in Java?

Answer: char. Stores a single Unicode character in 16 bits.

Flashcard 69: What is the output of: System.out.println('Java' + (1 + 2));?

Answer: Java3. Parentheses force addition first, then concatenation.

Flashcard 70: What is the operator used for modulus in Java?

Answer: %. Returns the remainder of integer division.