AP CSA Unit 1.3: Operator Precedence and Expressions Practice

Unit 1, Section 1.3
Day 3 Practice • January 9, 2026
🎯 Focus: Expressions and Operator Precedence

Practice Question

Consider the following code segment:
int a = 3;
int b = 4;
int c = 5;
int result = a + b * c - a;
System.out.println(result);
What is printed as a result of executing this code segment?

What This Tests: Section 1.3 covers expressions and output. This question tests operator precedence—the order in which Java evaluates mathematical operations. Multiplication and division happen before addition and subtraction.

Key Concept: Operator Precedence

Java follows standard mathematical order of operations:

// Order of operations (highest to lowest):
// 1. Parentheses ()
// 2. Multiplication *, Division /, Modulus %
// 3. Addition +, Subtraction -
// Same level: left to right

Step-by-Step Trace

Step Expression Explanation
1 3 + 4 * 5 - 3 Original expression
2 3 + 20 - 3 Multiply first: 4 * 5 = 20
3 23 - 3 Add: 3 + 20 = 23
4 20 Subtract: 23 - 3 = 20

Common Mistakes

Mistake: Answer A (32)

This comes from evaluating left to right without precedence: (3+4)*5-3 = 7*5-3 = 32. But multiplication happens before addition!

Mistake: Answer E (35)

This is (3+4)*5 = 35, forgetting the -3 at the end.

Practice Technique

The Parentheses Method

Add parentheses around higher-precedence operations first:

a + b * c - aa + (b * c) - a3 + (20) - 3

Related Topics

  • Section 1.2: Variables and Data Types
  • Section 1.4: Assignment Statements
  • Section 1.5: Casting and Range
Difficulty: Medium • Time: 2-3 minutes • AP Skill: 2.A - Apply operators

Ready to Level Up Your AP CSA Skills?

Get personalized help or access our complete question bank

Premium Question Bank - Coming Soon! Schedule 1-on-1 Tutoring

300+ Unit 1 questions • Expert tutoring • 5.0 rating

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.