Search Header Logo

AP CSP 3b Review

Authored by Seoha Min

Other

9th - 12th Grade

AP CSP 3b Review
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

8 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Three different numbers need to be placed in order from least to greatest. For example, if the numbers are ordered 9, 16, 4, they should be reordered as 4, 9, 16. Which of the following algorithms can be used to place any three numbers in the correct order?

If the first number is greater than the middle number, swap them. Then, if the middle number is greater than the last number, swap them. Then, if the first number is greater than the last number, swap them.

If the first number is greater than the middle number, swap them. Then, if the middle number is greater than the last number, swap them. Then, if the first number is greater than the middle number, swap them.

If the first number is greater than the middle number, swap them. Then, if the middle number is greater than the last number, swap them.

If the first number is greater than the last number, swap them. Then, if the first number is greater than the middle number, swap them.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The cost of a customer’s electricity bill is based on the number of units of electricity the customer uses.

  • For the first 25 units of electricity, the cost is $5 per unit.

  • For units of electricity after the first 25, the cost is $7 per unit.

Which of the following code segments correctly sets the value of the variable cost to the cost, in dollars, of using numUnits units of electricity?

Media Image
Media Image
Media Image
Media Image

3.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Assume that the Boolean variable x is assigned the value true and the Boolean variable y is assigned the value false. Which of the following will display the value true ?

Select two answers.

Media Image
Media Image
Media Image
Media Image

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

An algorithm has been developed to compute the sum of all the elements in a list of integers. Which of the following programming structures must be added to the existing algorithm so that the new algorithm computes the sum of only the even integers in the list?

Iteration

Searching

Selection

Sequencing

5.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

In a certain video game, the variable maxPS represents the maximum possible score a player can earn. The maximum possible score depends on the time it takes the player to complete the game. The value of maxPS should be 30 if time is greater than 120 and 50 otherwise.

Which of the following code segments correctly sets the value of maxPS based on the value of time ?

Select two answers.

Media Image
Media Image
Media Image
Media Image

6.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

In a certain video game, players are awarded bonus points at the end of a level based on the value of the integer variable timer. The bonus points are awarded as follows.

  • If timer is less than 30, then 500 bonus points are awarded.

  • If timer is between 30 and 60 inclusive, then 1000 bonus points are awarded.

  • If timer is greater than 60, then 1500 bonus points are awarded.

Which of the following code segments assigns the correct number of bonus points to bonus for all possible values of timer ?

Select two answers.

Media Image
Media Image
Media Image
Media Image

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

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?