AP CSA Unit 1 & 2 Review

AP CSA Unit 1 & 2 Review

Assessment

Assessment

Created by

James Huval

Computers

9th - 12th Grade

311 plays

Hard

Student preview

quiz-placeholder

10 questions

Show answers

1.

Multiple Choice

1 min

1 pt

Consider the following code segment.


System.out.println("W");

System.out.println("X");

System.out.print("Y");

System.out.print("Z");


What is printed as a result of executing the code segment?

WXYZ

W

XYZ

WX

YZ

W

X

YZ

W

X

Y

Z

2.

Multiple Choice

1 min

1 pt

Consider the following code segment.


int x = 10;

int y = 20;

/* missing code */

System.out.print(top / bottom);


Which of the following replacements for /* missing code */ will cause an ArithmeticException to occur?


I. int top = x - y;int bottom = y - x;

II.int top = 2 * x;int bottom = y - top;

III. int top = x + y;int bottom = 2 * top;

I. only

II. only

III. only

I. and II.

II. and III.

3.

Multiple Choice

1 min

1 pt

Consider the following code segment.


String str = "AP";

str += "CS " + 1 + 2;

System.out.println(str);


What is printed as a result of executing the code segment?

CS AP12

AP CS3

CSAP 12

APCS 12

APCS 3

4.

Multiple Choice

1 min

1 pt

Consider the following code segment.


String one = "ABC123";

String two = "C";

String three = "3";

System.out.println(one.indexOf(two));

System.out.println(one.indexOf(three));

System.out.println(two.indexOf(one));


What is printed when the code segment is executed?

2

5

-1

2

5

2

2

6

-1

3

6

-1

-1

-1

2

5.

Multiple Choice

1 min

1 pt

Consider the following method.


public double calculate(double x)

{

return x + 1.5;

}


The following code segment calls the method calculate in the same class.


Double d1 = new Double(7.5);

System.out.println(calculate(d1));


What, if anything, is printed when the code segment is executed?

8.0

8.5

9

9.0

Nothing is printed because the code does not compile. The actual parameter d1 passed to calculate is a Double, but the formal parameter x is a double.

Explore all questions with a free account

or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?

Find a similar activity

Create activity tailored to your needs using

Quizizz AI
AP Computer Science A Year Review

10 questions

AP Computer Science A Year Review

assessment

9th - 12th Grade

Code.org APCSA Unit

10 questions

Code.org APCSA Unit

assessment

9th - 12th Grade

AP CSA Unit 1 Review

15 questions

AP CSA Unit 1 Review

assessment

10th Grade - University

AP CS Unit 1 Study Quiz

13 questions

AP CS Unit 1 Study Quiz

assessment

9th - 12th Grade

Csa unit 6

15 questions

Csa unit 6

assessment

9th Grade

AP CSA Unit 3

10 questions

AP CSA Unit 3

assessment

10th - 12th Grade

AP CSA Review Unit 2

10 questions

AP CSA Review Unit 2

assessment

9th - 12th Grade

AP CSA Classes

10 questions

AP CSA Classes

assessment

9th - 12th Grade