Search Header Logo

List

Authored by Dhilma Dhilma

Computers

12th Grade

Used 1+ times

List
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

7 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Python code?

names = ['Amir', 'Bear', 'Charlton', 'Daman']

print(names[-1][-1])

A

Daman

n

Amir

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will be the output of the following Python code?

11

12

21

22

Answer explanation

When assigning names1 to names2, we create a second reference to the same list. Changes to names2 affect names1. When assigning the slice of all elements in names1 to names3, we are creating a full copy of names1 which can be modified independently.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Suppose list1 is [1, 3, 2],

What is list1 * 2?

[2, 6, 4]

[1, 3, 2, 1, 3]

[1, 3, 2, 1, 3, 2]

[1, 3, 2, 3, 2, 1]

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Suppose list1 = [0.5 * x for x in range(0, 4)],

list1 is:

[0, 1, 2, 3]

[0, 1, 2, 3, 4]

[0.0, 0.5, 1.0, 1.5]

[0.0, 0.5, 1.0, 1.5, 2.0]

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To insert 5 to the third item in list1, we use which command?

list1.insert(3, 5)

list1.insert(2, 5)

list1.add(3, 5)

list1.insert(5, 2)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3],

what is list1 after listExample.pop(1)?

[3, 4, 5, 20, 5, 25, 1, 3]

[3, 4, 5, 20, 5, 25, 1]

[3, 5, 20, 5, 25, 1, 3]

[4, 5, 20, 5, 25, 1, 3]

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Python code?

list("a#b#c#d".split('#'))

[‘a’, ‘b’, ‘c’, ‘d’]

[‘a b c d’]

[‘a#b#c#d’]

[‘abcd’]

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?