Unit 2: Abstraction, Algorithms, List

Unit 2: Abstraction, Algorithms, List

9th - 12th Grade

18 Qs

quiz-placeholder

Similar activities

Ap computer science a

Ap computer science a

1st - 12th Grade

15 Qs

Arrays and ArrayLists

Arrays and ArrayLists

10th - 12th Grade

15 Qs

10 Design and Apps Revision

10 Design and Apps Revision

10th Grade

20 Qs

ArrayList Quiz

ArrayList Quiz

12th Grade

20 Qs

DATA STRUCTURE USING C

DATA STRUCTURE USING C

KG - University

15 Qs

Data Structures

Data Structures

10th Grade - University

18 Qs

MIT app Inventor

MIT app Inventor

5th - 10th Grade

20 Qs

AP CS ArrayLists

AP CS ArrayLists

12th Grade

17 Qs

Unit 2: Abstraction, Algorithms, List

Unit 2: Abstraction, Algorithms, List

Assessment

Quiz

Computers

9th - 12th Grade

Medium

Created by

Stephannia Kabanakis

Used 12+ times

FREE Resource

18 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Consider the following code segment:


myList ← ["red", "yellow", "green", "blue"]

X ← <MISSING CODE>

DISPLAY(X)


What should <MISSING CODE> be replaced with so that “yellow” is displayed after executing the code?

[2]myList

myList[2]

myList[“yellow”]

“yellow”[myList]

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Consider the following code segment:

numberList ← [2, 5, 8, 1]

X ← numberList[1] + numberList[3]

DISPLAY(X)


What will be displayed after executing the code segment?

10

7

13

3

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Consider the following code segment:

words ← [“hello”, “bye”, “no”, “yes”]


Which of the following is a valid index for the list, words?

5

-1

"bye"

4

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

A programmer is writing a sports program that handles football teams and their players. Which of the following is the most appropriate data type to represent a collection of different football player’s names?

String

Boolean

Numeric

List

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Consider the following code segment:

firstList ← ["apple", "banana", "orange"]

secondList ← ["grape", "lemon"]

thirdList ← []

thirdList ← firstList

firstList ← secondList

secondList ← thirdList


What are the contents of secondList after the code segment is executed?

[ ]

["apple", "banana", "orange"]

["grape", "lemon"]

["apple", "banana", "orange", "grape", "lemon"]

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Consider the following code segment:


numbersList ← [8, 6, 2, 1]

APPEND ( numbersList , 4 )

X ← numbersList[1]

Y ← numbersList[5]

Z ← X MOD Y

DISPLAY (Z)


What displays after the code segment is executed?

4

0

3

1

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following is a benefit of using a list as a data abstraction in a program?

Lists often allow their size to be easily updated to hold as many data values as needed.

Lists convert all elements to strings so that they can be inspected character-by-character.

Lists prevent duplicate data values from appearing in the list.

Lists are used to store all input data so that there is a running record of all user input.

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?