After running the following code segment, what is contained in the array data?
Pseudocode Pretest 24-25

Flashcard
•
Computers
•
11th Grade
•
Hard
Quizizz Content
FREE Resource
Student preview

28 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Back
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
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
Create a free account and access millions of resources
Similar Resources on Quizizz
23 questions
AP CSP Unit 4 Test REVIEW

Flashcard
•
11th Grade
20 questions
AP Computer Science Principles AP MC Practice Questions

Flashcard
•
12th Grade
20 questions
Political Cartoon 2

Flashcard
•
11th Grade
21 questions
Auto Tech Tools

Flashcard
•
10th - 12th Grade
22 questions
Auto Tech Tools

Flashcard
•
10th - 12th Grade
25 questions
Butler AP CSP Midterm Review

Flashcard
•
9th - 12th Grade
19 questions
Computer Parts

Flashcard
•
9th - 10th Grade
25 questions
Adobe InDesign - Chapter 12 Quiz StudyGuide

Flashcard
•
11th Grade
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression

Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing

Quiz
•
9th - 12th Grade
10 questions
Identifying equations

Quiz
•
KG - University