Search Header Logo

AP CSP - Unit Programming (2)

Authored by Quốc Thư

Computers

8th - 10th Grade

Used 30+ times

AP CSP - Unit Programming (2)
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

About

This quiz focuses on fundamental programming concepts within computer science, specifically targeting list manipulation, loops, conditionals, procedures, and code analysis. The content aligns with high school level Advanced Placement Computer Science Principles coursework, appropriate for grades 10-12. Students need a solid understanding of programming logic, including how loops iterate through data structures, how conditionals control program flow, and how procedures organize code for reusability. The problems require students to trace through code execution step-by-step, predict outputs, analyze algorithmic efficiency, and understand the principles of code refactoring. Core skills assessed include debugging logic errors, understanding variable scope and assignment, recognizing patterns in iterative processes, and applying abstraction concepts to reduce code complexity. Created by Quốc Thư, a Computers teacher in VN who teaches grade 8 and 10. This quiz serves as an excellent formative assessment tool for students studying programming fundamentals, particularly useful for reviewing key concepts before AP Computer Science Principles assessments. Teachers can deploy this as a warm-up activity to activate prior knowledge about loops and conditionals, assign it as independent practice homework to reinforce classroom instruction, or use it as a review session before unit exams. The varied question formats make it ideal for identifying specific areas where students need additional support, whether in code tracing, procedure design, or algorithmic thinking. This assessment directly supports Common Core Mathematical Practice standards MP1 (Make sense of problems and persevere in solving them) and aligns with CSTA K-12 Computer Science Standards 2-AP-10 (use flowcharts and/or pseudocode to address complex problems), 2-AP-11 (create clearly named variables that represent different data types), and 2-AP-13 (decompose problems and subproblems into parts to facilitate program implementation).

    Content View

    Student View

23 questions

Show all answers

1.

FILL IN THE BLANKS QUESTION

2 mins • 5 pts

Media Image

The following code snippet processes a list of strings with a loop and conditionals:

The code relies on one string procedure, LEN(string), which returns the number of characters in the string.

(a)  

2.

MULTIPLE CHOICE QUESTION

2 mins • 5 pts

Media Image

A movie website lets users create lists of their favorite movies.

When the user first starts, the website runs this code to create an empty list:

favMovies ← []

The user can then insert and remove items from the list.

Here's the code that was executed from one user's session:

"The Lion King", "The Matrix", "Lord of the Rings", "Shrek", "Spider-Man"

"The Lion King", "The Matrix", "Shrek", "Lord of the Rings", "Spider-Man"

"The Lion King", "Toy Story", "Lord of the Rings", "The Matrix", "Shrek", "Spider-Man"

"The Lion King", "Toy Story", "Shrek", "Lord of the Rings", "Spider-Man"

"The Lion King", "Toy Story", "The Matrix", "Lord of the Rings", "Shrek", "Spider-Man"

3.

MULTIPLE CHOICE QUESTION

2 mins • 5 pts

Media Image

The following numbers are displayed by a program:

4 8 12 16

The program code is shown below, but it is missing three values: <COUNTER>, <AMOUNT>, and <STEP>.

Given the displayed output, what must the missing values be?

<COUNTER> = 2, <AMOUNT> = 4, <STEP> = 2

<COUNTER> = 1, <AMOUNT> = 4, <STEP> = 2

<COUNTER> = 4, <AMOUNT> = 4, <STEP> = 1

<COUNTER> = 4, <AMOUNT> = 2, <STEP> = 1

<COUNTER> = 2, <AMOUNT> = 2, <STEP> = 1

4.

MULTIPLE CHOICE QUESTION

2 mins • 5 pts

Media Image

A program races four avatars against each other: Piceratops, Leafers, Duskpin, and Aqualine.

Here they are lined up at the start line, in that order:

After the first 3 repetitions of each loop, which avatar will be ahead?

Media Image
Media Image
Media Image
Media Image

Two avatars will be tied for the lead.

5.

MULTIPLE CHOICE QUESTION

2 mins • 5 pts

Media Image

A javelin thrower is writing code to track the distance of their throws and how far they are from their target distance.

This is what they have so far:

A friend points out that they can reduce the complexity of their code by using the abstractions of lists and loops.

The programmer decides to "refactor" the code, to rewrite it so that it produces the same output but is structured better.

Which of these is the best refactor of the code?

Media Image
Media Image
Media Image
Media Image
Media Image

6.

MULTIPLE CHOICE QUESTION

2 mins • 5 pts

Media Image

The two programs below are both intended to display the total number of overtime hours worked, based on a list of logged hours for each day of a week.

Which of these statements best describes these two programs?

Program 1 and Program 2 display the same output and involve the same number of computations.

Program 1 and Program 2 display the same output, but Program 2 requires more computations.

Program 1 and Program 2 display the same output, but Program 1 requires more computations.

Program 1 displays the expected output, while Program 2 displays more output than necessary.

Program 2 displays the expected output, while Program 1 displays more output than necessary.

7.

MULTIPLE CHOICE QUESTION

2 mins • 5 pts

Media Image

A vending machine manufacturer is writing code to determine the optimal prices for their products.

The program below processes a list of costs (in dollars and cents). The goal of the program is to create a new list that contains only the costs that can be paid entirely in quarters.

A line of code is missing, however.

What can replace <MISSING CODE> so that this program will work as expected?

APPEND(quarterCosts, costs)

INSERT(quarterCosts, costs)

APPEND(costs, cost)

INSERT(quarterCosts, cost)

APPEND(quarterCosts, cost)

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?