Skip to content

Incorrect answer for Q5 in high_school_computer_science_dev.csv #18

Description

@TenType

The answer of the last question in high_school_computer_science_dev.csv is incorrect:

A list of numbers has n elements, indexed from 1 to n.
The following algorithm is intended to display the number of elements in the list that have a value greater than 100.
The algorithm uses the variables count and position. Steps 3 and 4 are missing.
 Step 1: Set count to 0 and position to 1.
 Step 2: If the value of the element at index position is greater than 100, increase the value of count by 1.
 Step 3: (missing step)
 Step 4: (missing step)
 Step 5: Display the value of count.
 Which of the following could be used to replace steps 3 and 4 so that the algorithm works as intended?
 
(A) Step 3: Increase the value of position by 1.
    Step 4: Repeat steps 2 and 3 until the value of count is greater than 100.
(B) Step 3: Increase the value of position by 1.
    Step 4: Repeat steps 2 and 3 until the value of position is greater than n.
(C) Step 3: Repeat step 2 until the value of count is greater than 100.
    Step 4: Increase the value of position by 1.
(D) Step 3: Repeat step 2 until the value of position is greater than n.
    Step 4: Increase the value of count by 1.

The answer is listed as D in the CSV file, but the correct answer is B.
See the official question PDF from College Board to double check: Question 8 and its answer key. If you also think about it, D would not make sense because it does not update position and runs as an infinite loop.

The dataset from README.md was used: people.eecs.berkeley.edu/~hendrycks/data.tar

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions