• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar

JavaTutorOnline

1-on-1 Online Java Training by a Senior Software Engineer

  • Home
  • AP CSA
    • FRQ Practice
      • Arrays
      • ArrayList
      • Strings
      • 2D Arrays
    • MCQ Practice
      • Booleans
      • Iteration
      • Arrays
      • View all Units
  • Courses
  • Tutorials
    • Java
    • Servlets
    • Struts
    • Spring
    • Webservice
  • FAQ
  • Testimonials
  • Blog
  • CONTACT US

AP CSA Unit 1.3 MCQ Practice: Expressions & Output

Home » AP CSA MCQ Practice » Unit 1: Using Objects and Methods » Expressions and Output

AP CSA Unit 1.3 MCQ Practice: Expressions and Output

📚 Topic 1.3 ⏱️ 22 Min Practice ✅ Current AP CSA Framework

A common AP CSA mistake is forgetting how Java evaluates expressions, especially when integer division, operator precedence, remainder, and String concatenation appear together.

In this interactive practice set, we cover AP CSA Unit 1.3: Expressions and Output. These 15 multiple-choice questions target integer division, remainder operations, operator precedence, numeric expressions, and String concatenation.

Key Concepts to Remember Before You Start:

  • Integer Division: When two integers are divided, Java performs integer division and discards the fractional part. For example, 11 / 4 evaluates to 2, not 2.75.
  • Remainder (%): The remainder operator returns the remainder after integer division. For example, 23 % 6 evaluates to 5.
  • Operator Precedence: Multiplication (*), division (/), and modulo (%) have higher precedence than addition and subtraction. Operators with the same precedence are evaluated from left to right.
  • String Concatenation: When the + operator is used with a String, it performs concatenation. Evaluation proceeds according to Java’s normal expression rules. For example, "Age: " + 5 + 2 produces "Age: 52".

AP CSA 1.3: Expressions and Output Practice

Question 1 of 15 | Score: 0
1. Consider the following code segment. What is printed as a result of executing the code segment?
int a = 14;
int b = 5;
System.out.println(a / b);
Correct Answer: CBecause both a and b are integers, Java performs integer division. 14 / 5 is mathematically 2.8, but the fractional part is discarded, leaving 2.
2. Consider the following expression. What is printed?
int result = 4 + 5 * 3 – 8 / 2;
System.out.println(result);
Correct Answer: BMultiplication and division have higher precedence than addition and subtraction.

1. 5 * 3 evaluates to 15.
2. 8 / 2 evaluates to 4.
3. The expression becomes 4 + 15 - 4.
4. Evaluating left to right gives 19 - 4 = 15.
3. What is the output of the following code segment?
System.out.println(23 % 6);
Correct Answer: DThe remainder operator (%) returns the remainder. 6 goes into 23 three times, giving 18. The remainder is 23 - 18 = 5.
4. Consider the following code segment. What is printed?
int x = 4;
int y = 10;
System.out.println(x % y);
Correct Answer: BWhen calculating 4 % 10, 10 goes into 4 zero times. Therefore, the remainder is the original value, 4.
5. Consider the following expression. What is printed?
System.out.println(12 / 3 * 2);
Correct Answer: CMultiplication and division have the same precedence, so they are evaluated from left to right.

First, 12 / 3 evaluates to 4. Then 4 * 2 evaluates to 8.
6. What is the output of the following code segment?
System.out.println(17 % 5);
Correct Answer: CThe remainder operator (%) returns the remainder after integer division. 5 goes into 17 three times, giving 15. The remainder is 17 - 15 = 2.
7. Consider the following code segment. What is printed?
int val = 20 – (3 + 2) * 4 / 2;
System.out.println(val);
Correct Answer: AParentheses evaluate first: (3 + 2) becomes 5.

The expression becomes 20 - 5 * 4 / 2.Multiplication and division are then evaluated from left to right: 5 * 4 = 20, followed by 20 / 2 = 10.Finally, 20 - 10 = 10.
8. Consider the following code segment. What gets printed?
System.out.println("Result: " + 3 + 4);
Correct Answer: CEvaluation proceeds from left to right. Because the first operand is a String, the first + performs concatenation. The expression becomes "Result: 3", and the next + concatenates the 4, producing "Result: 34".
9. Consider the following code segment. What gets printed?
System.out.println("Result: " + (3 + 4));
Correct Answer: ABecause of the parentheses around (3 + 4), the arithmetic addition is evaluated first, producing 7. The result is then concatenated with the String, producing Result: 7.
10. Consider the following code segment. What gets printed?
double a = 15;
int b = 4;
System.out.println(a / b);
Correct Answer: BBecause a is a double, the expression performs floating-point division. The result of 15.0 / 4 is 3.75.
11. Consider the following expression. What gets printed?
int result = 5 + 2 * (10 % 4) – 3;
System.out.println(result);
Correct Answer: C1. Parentheses first: 10 % 4 evaluates to 2.
2. The expression becomes 5 + 2 * 2 - 3.
3. Multiplication: 2 * 2 = 4.
4. The expression becomes 5 + 4 - 3.
5. Addition and subtraction are evaluated from left to right: 9 - 3 = 6.
12. Consider the following code segment. What gets printed?
System.out.println(5 + 2 + " equals 7");
Correct Answer: BEvaluation happens from left to right.

First, 5 + 2 is integer addition, producing 7.The next + combines the integer 7 with the String " equals 7", producing 7 equals 7.
13. Consider the following code segment. What gets printed?
System.out.println("Answer: " + 11 / 2);
Correct Answer: CDivision has higher precedence than the String concatenation operation here, so 11 / 2 is evaluated first.Because both operands are integers, integer division produces 5.The result is then concatenated with the String, producing Answer: 5.
14. Which of the following expressions evaluates to 0 if and only if the positive integer variable num is an even number?
Correct Answer: BThe remainder operator returns the remainder. When a positive integer is even, dividing it by 2 leaves a remainder of 0.Therefore, num % 2 evaluates to 0 exactly when num is even.
15. Assume int num = 8473;. Which of the following expressions will correctly extract the last digit (3) from num?
Correct Answer: AUsing modulo 10 (% 10) extracts the rightmost digit of a positive base-10 integer.The remainder of 8473 / 10 is 3.By contrast, num / 10 using integer division removes the last digit and produces 847.

Unit 1.3 Practice Complete!

0 / 15

AP CSA Practice Navigation

← Back to Unit 1: Using Objects and Methods

View All AP CSA Multiple Choice Practice

Why Expressions and Operator Precedence Matter for AP CSA

Expression evaluation is an important part of tracing Java code. Integer division, remainder, operator precedence, and String concatenation can change the value produced by an expression.

When tracing AP CSA code, evaluate parentheses first, then apply the appropriate operator precedence and left-to-right evaluation rules. Pay particular attention when integer and floating-point values or Strings appear in the same expression.

Continue Your AP CSA Practice

After practicing expressions and output, continue with the next available practice topic: Topic 1.5, Casting and Range of Variables. Topic 1.4 is part of the current College Board framework but does not yet have a dedicated practice page on JavaTutorOnline.

← Previous: Topic 1.2 Variables & Data Types
Next Available Practice: Topic 1.5 Casting →

Primary Sidebar

Mr Chinmay

Chinmay Patel
Book a Demo Class

Phone & Whatsapp +919853166385
javatution@gmail.com

Recent Posts

  • Learn Java in One Day: 10-Hour 1-on-1 Crash Course | JavaTutorOnline
  • Constructor in Java: Examples, Types & Constructor Overloading
  • Important Interview Questions on Java Multithreading
  • React Spring Boot Web Services React Integration
  • Spring Boot RESTful Web Services Example
  • Top Spring MVC Interview Questions and Answers for Developers
  • Top Spring Core Interview Questions and Answers for Developers
  • Host Java Web Apps for Free on Mobile with Tomcat and Termux
  • How to Deploy Java Web Application on Aws EC2 with Elastic IP
  • Simple Jsp Servlet Jdbc User Registration using Tomcat Mysql and Eclipse

Additional Resources

  • AP Computer Science A Summer Prep
Copyright © 2026 JavaTutorOnline