Pseudocode Pretest 24-25

Pseudocode Pretest 24-25

Assessment

Flashcard

Computers

11th Grade

Hard

Created by

Quizizz Content

FREE Resource

Student preview

quiz-placeholder

28 questions

Show all answers

1.

FLASHCARD QUESTION

Front

After running the following code segment, what is contained in the array data?

Back

Media Image

2.

FLASHCARD QUESTION

Front

Choose the best description of what the mystery procedure below does. The procedure accepts two parameters: a list of a values and a number n.

PROCEDURE mystery (list, n)
{
i = 1
REPEAT LENGTH(list) TIMES
{
IF ( list[i] = n )
{
DISPLAY (i)
}
i = i+1
}
}

Back

Mystery displays the index of every occurrence of the value n in the list.

3.

FLASHCARD QUESTION

Front

A robot starts in a grid facing north (B3). What is the robot's location and direction after the following program is executed?
data = ["F", "F", "R", "F", "L", "F", "R", "R", "F"]
FOR EACH move IN data
{
IF ( move = "F" AND CAN_MOVE(forward) )
{
MOVE_FORWARD()
}
ELSE IF (move = "R"){
rotate_right()
}
ELSE IF ( move = "L") {
rotate_left()
}
}

Back

Media Image

4.

FLASHCARD QUESTION

Front

Which of the following best describes the result of running the procedure below?
PROCEDURE mystery (a, b, c)
{
IF ( a >= b AND a >= c)
{
RETURN (a)
}
ELSE IF ( b >= a AND b >= c)
{
RETURN (b)
}
ELSE
{
RETURN (c)
}
}

Back

It returns the largest of the three input values

5.

FLASHCARD QUESTION

Front

The following program processes the list data shown below. What is the output of the following program?
val = 0
i = 1
REPEAT 3 TIMES
{
val = val + data[i]
i = i + 1
}
DISPLAY (val)

Back

17

6.

FLASHCARD QUESTION

Front

Cecelia would like to write an app to help manage a trip to the grocery store. The app will maintain a shopping list (a list of words) of all the items to buy. Describe how Cecelia might use a second list in the app. What else might be tracked? Describe how the list would be used and updated in the app.

Back

Cecilia could keep a separate list to track which of the items on her list she has actually found and placed in her shopping cart. So for example if she had a shopping list called list and list of true/false values called got that is initially filled with false to indicate she hasn’t gotten anything yet. Then as she shops if list[i] is “eggs”, and she got eggs, then the app would update got[i]=true.
Other uses:
List of prices
Date of last purchase
List of categories

7.

FLASHCARD QUESTION

Front

What is contained in the list after running the following program?
```plaintext
i = 1
val = 0
n = LENGTH(data)
REPEAT n TIMES
{
val = val + data[i]
data[i] = val
i = i + 1
}
```

Back

Media Image

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?