Search Header Logo

AP computer science unit 2

Authored by Sherry Dieterich

9th - 12th Grade

Used 809+ times

AP computer science unit 2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

About

This quiz covers fundamental programming concepts in Java, specifically focusing on AP Computer Science A Unit 2 material at the high school level (grades 9-12). The questions assess students' understanding of the Math class methods including Math.random() and Math.abs(), string concatenation and manipulation, method parameters and scope, method overloading principles, and code tracing through various programming constructs. Students need to demonstrate proficiency in predicting program output, understanding data type conversions and casting, recognizing valid method calls based on parameter types, and applying knowledge of variable scope rules. The core reasoning skills required include logical thinking about mathematical operations, understanding how Java handles string and numeric data types, and the ability to mentally execute code step-by-step to determine correct outputs. Created by Sherry Dieterich, a computer science teacher in the US who teaches grades 9-12. This assessment serves as an excellent formative evaluation tool for students progressing through their first programming course, allowing both teacher and students to identify areas where foundational concepts need reinforcement. The quiz works effectively as a warm-up activity to activate prior knowledge before introducing new programming concepts, as homework to reinforce classroom learning, or as review material before unit exams. Teachers can use individual question performance to guide targeted instruction on specific programming concepts that students find challenging. This quiz aligns with College Board AP Computer Science A standards, particularly those addressing primitive data types, arithmetic expressions, method design and implementation, and program analysis skills that form the foundation for more advanced programming concepts.

    Content View

    Student View

13 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Which line of code would set x = to a number between 50 and 100?

int x = (int) (Math.random()*50)+50;

int x = (int) (Math.random()*50)-50;

int x = (int) (Math.random()*50)+51;

int x = (int) (Math.random()*50)+49;

2.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

What is printed when the code is run?

Frankvelt

ranklivelt

Franko

lino

3.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

What will print when this code is run?

7

9.0

5.66

5.0

4.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

What will s equal? int s = Math.abs(13-21);

8

-8

8.0

-8.0

5.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

Which would be a valid call to this code?

PT(21.0, 8);

PT(7,"4");

PT(2,4);

PT(1.0,1.0);

6.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

What will l = after the code is run?

5

6

7

8

7.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

What will p = after the code is run? String p = "cat " + 9;

cat

Nothing will print

The code will not compile

cat 9

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?