Unit 5 code.org Review

Unit 5 code.org Review

11th Grade

15 Qs

quiz-placeholder

Similar activities

Java Code Tracing Practice A

Java Code Tracing Practice A

9th - 12th Grade

10 Qs

CSA Unit 3 Review

CSA Unit 3 Review

10th - 12th Grade

16 Qs

Programming Fundamentals Part 2

Programming Fundamentals Part 2

9th - 11th Grade

20 Qs

AP CSP Loops Practice

AP CSP Loops Practice

9th - 12th Grade

12 Qs

GCSE Computer Science Data types

GCSE Computer Science Data types

10th - 12th Grade

18 Qs

Java Strings

Java Strings

9th - 12th Grade

12 Qs

Higher SDD Revision

Higher SDD Revision

11th - 12th Grade

20 Qs

Practice for Quiz #12

Practice for Quiz #12

9th - 12th Grade

15 Qs

Unit 5 code.org Review

Unit 5 code.org Review

Assessment

Quiz

Computers

11th Grade

Hard

Created by

Ms Seccafico

Used 148+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

What is displayed as a result of executing the code segment?

1 3 5

5 3 1

100 300 500

500 300 100

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Shoppers at a mall were asked whether they preferred wearing gloves or mittens in cold weather. Shoppers’ preferences were stored in the list voteList as strings, with the string "Gloves" representing a preference for gloves and the string "Mittens" representing a preference for mittens.

The following code segment is intended to traverse the list and display the number of shoppers who chose gloves and the number of shoppers who chose mittens.

numGlovesVotes ←0

numMittensVotes ← 0

<MISSING CODE>

{

IF(vote = "Gloves")

{

numGlovesVotes ← numGlovesVotes + 1

}

ELSE

{

numMittensVotes ← numMittensVotes + 1

}

}

DISPLAY(numGlovesVotes)

DISPLAY(" shoppers chose gloves and")

DISPLAY(numMittensVotes)

DISPLAY(" shoppers chose mittens.")

Which of the following should replace <MISSING CODE> so that the code segment works as intended?

IF(vote ≤ LENGTH(voteList))

FOR EACH vote IN voteList

REPEAT LENGTH(voteList) TIMES

REPEAT UNTIL(vote > LENGTH(voteList))

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Consider the following code segment. Assume that index1 is a number between 1 and LENGTH(theList), inclusive, and index2 is a number between 2 and LENGTH(theList) - 1, inclusive.

theList ← [9, -1, 5, 2, 4, 8]

x ← theList[index1] + theList[index2]

What is the largest possible value that the variable x can have after the code segment executes?

17

14

11

4

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Consider the following code segment, which is intended to store ten consecutive even integers, beginning with 2, in the list evenList. Assume that evenList is initially empty.


i ← 1

REPEAT 10 TIMES

{

<MISSING CODE>

}


Which of the following can be used to replace <MISSING CODE> so that the code segment works as intended?

APPEND(evenList, i)

i ← i + 2

i ← i + 2

APPEND(evenList, i)

APPEND(evenList, 2 * i)

i ← i + 1

i ← i + 1

APPEND(evenList, 2 * i)

5.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

A teacher stores the most recent quiz scores for her class in the list scores. The first element in the list holds the maximum possible number of points that can be awarded on the quiz, and each remaining element holds one student’s quiz score. Assume that scores contains at least two elements. Which of the following code segments will set the variable found to true if at least one student scored the maximum possible number of points on the quiz and will set found to false otherwise?

Media Image
Media Image
Media Image
Media Image

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Consider the following code segment.

theList ← [-2, -1, 0, 1, 2]

count1 ← 0

count2 ← 0

FOR EACH value IN theList

{

IF(value > 0)

{

count1 ← count1 + 1

}

ELSE

{

count2 ← count2 + 1

}

}

What are the values of count1 and count2 as a result of executing the code segment?

count1 = 2, count2 = 2

count1 = 2, count2 = 3

count1 = 3, count2 = 2

count1 = 5, count2 = 0

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Assume that both lists and strings are indexed starting with index 1.

The list wordList has the following contents.

["abc", "def", "ghi", "jkl"]

Let myWord be the element at index 3 of wordList. Let myChar be the character at index 2 of myWord. What is the value of myChar ?

"e"

"f"

"h"

"i"

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?