Search Header Logo

List, Loops, and Traversals

Authored by Devonte Mitchell

Computers

12th Grade

List, Loops, and Traversals
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

37 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Lists

Named the same as variables

Can contain multiple elements

Index starts at 0

Each number(index) contains one value

2.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What is true about var myList=["pizza",4]

The command creates a new list and assigns it to a variable

A list is indicated with square brackets

Each value in the list is separated by commas

3.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What is true about myList[1]

It accesses the value at that index of the list

Also uses square brackets

4.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What does myList[1]="hello" do?

Assigns the value on the right to the index

Throws out the old value and replaces it with a new one.

5.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What does removeItem(list, index) do?

Removes the element in the given list at the given index

All items to the right are shifted over

The last index is removed from the list

6.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What does appendItem(list,item) do?

Adds an element to the end of the list

A new index is added to the list to create a place for the element

The new item is placed in this new index

7.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

What does insertItem(list, index, item) do?

Inserts an element into a list at the index given

A new index is added to the list so there's space for the new element

The new element is placed at the index given, all other items move right

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?