Search Header Logo

Python Quiz 1

Authored by Thomas Sheeba

Computers

Professional Development

Used 13+ times

Python Quiz 1
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following

aList = [5, 10, 15, 25]

print(aList[::-2])

· [15, 10, 5]

· [10, 5]

[25,10]

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following

aList = [1, 2, 3, 4, 5, 6, 7]

pow2 = [2 * x for x in aList]

print(pow2)

· [2, 4, 6, 8, 10, 12, 14]

· [2, 4, 8, 16, 32, 64, 128]

· [2, 4, 8, 16, 32, 64]

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code

my_list = ["Hello", "Python"]

print("-".join(my_list))

HelloPython-

Hello-Python

-HelloPython

4.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Select all the correct options to copy a list

aList = ['a', 'b', 'c', 'd']

· newList = copy(aList)

· newList = aList.copy()

· newList.copy(aList)

· newList = list(aList)

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code?

sampleList = [10, 20, 30, 40]

del sampleList[0:6]

print(sampleList)

· []

· list index out of range.

· [10, 20]

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following list operation

aList = [10, 20, 30, 40, 50, 60, 70, 80]

print(aList[2:5])

print(aList[:4])

print(aList[3:])

·[20, 30, 40, 50]

[10, 20, 30, 40]

[30, 40, 50, 60, 70, 80]

[30, 40, 50]

[10, 20, 30, 40]

[40, 50, 60, 70, 80]

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following list comprehension

resList = [x+y for x in ['Hello ', 'Good '] for y in ['Dear', 'Bye']]

print(resList)

[‘Hello Dear’, ‘Hello Bye’, ‘Good Dear’, ‘Good Bye’]

[‘Hello Dear’, ‘Good Dear’, ‘Hello Bye’, ‘Good Bye’]

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?