Search Header Logo

AP CSP-Review Session 1 MCQ Quiz

Authored by Thomas Harris

Computers

10th Grade

Used 8+ times

AP CSP-Review Session 1 MCQ Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

A numeric test score is to be converted to a letter grade of A, B, or C according to the following rules: A score greater than 90 is considered an A; a score between 80 and 90, inclusive, is considered a B; and any other score is considered a C. Which of the following code segments will assign the correct letter grade to grade based on the value of the variable score?

A. II only

B. I and II only

C. I and III only

D. II and III only

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

In the above procedure, assume that the parameter x is an integer. Which of the following best describes the behavior of the procedure?

A. It displays nothing if x is negative and displays true otherwise.

B. It displays nothing if x is negative and displays false otherwise.

C. It displays true if x is negative and displays nothing otherwise.

D. It displays true if x is negative and displays false otherwise.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

A student wrote the code segment above, which displays true if the list myList contains any duplicate values and displays false otherwise. The code segment compares pairs of list elements, setting containsDuplicates to true if any two elements are found to be equal in value. Which of the following best describes the behavior of how pairs of elements are compared?

The code segment iterates through myList, comparing each element to all other elements in the list.

The code segment iterates through myList, comparing each element to all subsequent elements in the list.

The code segment iterates through myList, comparing each element to the element that immediately follows it in the list.

The code segment iterates through myList, comparing each element to the element that immediately precedes it in the list.

4.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

Media Image

A homework assignment consists of 10 questions. The assignment is graded using the chart to the right. Let numCorrect represent the number of correct answers for a particular student. The code segment to the left 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 values of numCorrect does the code segment NOT display the intended grade? Select TWO answers.

A. 9

B. 8

C. 7

D. 6

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the code segment shown, 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. The code segment does not work as intended. Which of the following changes can be made so that the code segment works as intended?

A. Changing line 1 to IF(score < 0)

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

C. Changing line 7 to score ← score + penalty

D. Interchanging lines 3 and 7

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider the code segment above. p ← 10 q ← 20 r ← 30 s ← 40 p ← q q ← r s ← q r ← p What is the value of r as a result of executing the code segment?

A. 10

B. 20

C. 30

D. 40

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Three words are stored in the variables word1, word2, and word3. The values of the variables are to be updated as shown in the table below: | Variable | Value Before Updating | Value After Updating | |----------|----------------------|---------------------| | word1 | "xylophone" | "zebra" | | word2 | "yarn" | "yarn" | | word3 | "zebra" | "xylophone" | Which of the following code segments can be used to update the values of the variables as shown in the table?

A. temp ← word1 word3 ← word1 word1 ← temp

B. temp ← word1 word1 ← word3 word3 ← temp

C. temp ← word1 word1 ← word2 word2 ← word3 word3 ← temp

D. temp ← word3 word3 ← word2 word2 ← word1 word1 ← temp

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?