AP CSP Review Session 2

AP CSP Review Session 2

9th - 12th Grade

6 Qs

quiz-placeholder

Similar activities

String and Math Methods AP CSA

String and Math Methods AP CSA

10th Grade

10 Qs

Java 2D Arrays

Java 2D Arrays

10th - 12th Grade

6 Qs

AP Review Quiz #2

AP Review Quiz #2

9th - 12th Grade

10 Qs

Code.org Unit 5 Data

Code.org Unit 5 Data

9th Grade - University

11 Qs

07 - Nested Structures

07 - Nested Structures

12th Grade

10 Qs

APCSA Unit 4

APCSA Unit 4

10th - 12th Grade

5 Qs

Question Type: Pseudocode

Question Type: Pseudocode

10th - 12th Grade

8 Qs

Variables & Conditional Statements

Variables & Conditional Statements

9th Grade

10 Qs

AP CSP Review Session 2

AP CSP Review Session 2

Assessment

Quiz

Computers

9th - 12th Grade

Hard

Created by

Lewis Boble

Used 1+ times

FREE Resource

6 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

3 mins • 1 pt

Media Image

A homework assignment consists of 10 questions. The assignment is graded as follows.

9-10 correct --> check plus

7-8 correct --> check

Under 7 correct --> check minus

Let numCorrect represent the number of correct answers for a particular student. The following code segment is intended to display the appropriate grade based on numCorrect. The code segment does not work as intended in all cases.

For which of the following values of numCorrect does the code segment NOT display the intended grade? Select two answers.

9

8

7

6

2.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Media Image

In the following procedure, the parameter numList is a list of numbers and the parameters j and k are integers.

Which of the following is the most appropriate documentation to appear with the swapListElements procedure?

Returns a copy of numList with the elements at indices j and k interchanged.

The value of j must be between 0 and the value of k, inclusive.

Returns a copy of numList with the elements at indices j and k interchanged.

The values of j and k must both be between 1 and LENGTH(numList), inclusive.

Interchanges the values of the parameters j and k.

The value of j must be between 0 and the value of k, inclusive.

Interchanges the values of the parameters j and k.

The values of j and k must both be between 1 and LENGTH(numList), inclusive.

3.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Media Image

The following procedure is intended to return true if the list of numbers myList contains only positive numbers and is intended to return false otherwise. The procedure does not work as intended.

For which of the following contents of myList does the procedure NOT return the intended result?

[-3, -2, -1]

[-2, -1, 0]

[-1, 0, 1]

[1, 2, 3]

4.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

In the following code segment, score and penalty are initially positive integers. The code segment is intended to reduce the value of score by penalty. However, if doing so would cause score to be negative, score should be assigned the value 0.

For example, if score is 20 and penalty is 5, the code segment should set score to 15. If score is 20 and penalty is 30, score should be set to 0.

The code segment does not work as intended.

Which of the following changes can be made so that the code segment works as intended?

Changing line 1 to IF(score < 0)

Changing line 1 to IF(score + penalty < 0)

Changing line 7 to score <-- score + penalty

Interchanging lines 3 and 7

5.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Media Image

In the following procedure, the parameter max is a positive integer.

Which of the following is the most appropriate documentation to appear with the printNums procedure?

Prints all positive even integers that are less than or equal to max.

Prints all positive odd integers that are less than or equal to max.

Prints all positive even integers that are greater than max.

Prints all positive odd integers that are greater than max.

6.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Media Image

In the following procedure, the parameters x and y are integers.

Which of the following is the most appropriate documentation to appear with the calculate procedure?

Displays the value of x + (y / x).

The value of the parameter x must not be 0.

Displays the value of x + (y / x).

The value of the parameter y must not be 0.

Displays the value of (x + y) / x.

The value of the parameter x must not be 0.

Displays the value of (x + y) / x.

The sum of the parameters x and y must not be 0.