Python Code Snippet Quiz

Python Code Snippet Quiz

11th Grade

9 Qs

quiz-placeholder

Similar activities

SOAL PTS 1 KOMPUTER AKUNTANSI KELAS XI

SOAL PTS 1 KOMPUTER AKUNTANSI KELAS XI

11th Grade - University

10 Qs

Podstawy Pythona

Podstawy Pythona

9th - 12th Grade

10 Qs

VB Controls

VB Controls

11th Grade

10 Qs

ITGS - IT Systems (Hardware)

ITGS - IT Systems (Hardware)

10th - 12th Grade

14 Qs

TỪ BÀI TOÁN ĐẾN CHƯƠNG TRÌNH

TỪ BÀI TOÁN ĐẾN CHƯƠNG TRÌNH

11th Grade

10 Qs

ICT and Retail Industry

ICT and Retail Industry

8th - 12th Grade

13 Qs

Python with DataScience

Python with DataScience

7th Grade - University

10 Qs

CE6 - Software

CE6 - Software

7th - 11th Grade

12 Qs

Python Code Snippet Quiz

Python Code Snippet Quiz

Assessment

Quiz

Computers

11th Grade

Practice Problem

Hard

Created by

Harmeet Kaur

Used 4+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output of the following code snippet?

s = "DataScience"

result = s[1:9:2] + s[-3:]

print(result)

ataecine

atsciece

ataceine

aacence

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following code snippet?

lst = [2, 4, 6, 8, 10]

result = [x**2 for x in lst if x % 3 == 2]

print(result)

[4, 64]

[36]

[4, 36, 64]

[16, 64]

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Consider the following tuple:

t = (1, [2, 3], (4, 5))

Which of the following statements will raise an error?

t[1][0] = 9

t[2] = (6, 7)

t[0] = 0

Both B and C

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Given the following dictionary:

d = {'John': 25, 'Jane': 30, 'Doe': 45}

What will be the output of the following code?

d['Jane'] += 5

del d['Doe']

d['Alice'] = 35

print(sorted(d.keys()))

['John', 'Doe', 'Alice']

['Alice', 'Jane', 'John']

['Doe', 'Jane', 'Alice']

['John', 'Jane', 'Alice']

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output of the following code snippet?

s = "Programming is fun!"

result = s[ : 11 ].upper() + s[ 11 : ][ : : -1 ]

print(result)

`PROGRAMMING !nuf si`

`PROGRAMMING is fun!`

`PROGRAMMING !nuf si gnimmargorP`

`Programming IS FUN!`

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output of the following code?

lst = [1, 2, 3, 4]

lst.append([5, 6])

lst.extend([7, 8])

print(lst)

[1, 2, 3, 4, 5, 6, 7, 8]

[1, 2, 3, 4, [5, 6], 7, 8]

[1, 2, 3, 4, 5, 6, [7, 8]]

[1, 2, 3, 4, [5, 6, 7, 8]]

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the result of the following code snippet?

t = (3, 1, 4, 1, 5, 9)

result = t.index(1, 2)

print(result)

1

2

3

IndexError

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?