Search Header Logo

python quiz

Authored by Sujata B

Computers

University

Used 2+ times

python quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

To which of the following the "in" operator can be used to check if an item is in it?

lists

tuples

dictionaries

All of the above

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What will be the output of the following Python code?

>>>t=(1,2,4,3)

>>>t[1:3]

(1,2)

(1,2,4)

(2,4)

(2,4,3)

3.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What will be the output of the following Python code?

d = {"john":40, "peter":45}

d["john"]

40

50

"jhon"

"peter"

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Python code?

>>>t = (1, 2)

>>>2 * t

(1, 2, 1, 2)

[1, 2, 1, 2]

(1, 1, 2, 2)

[1, 1, 2, 2]

5.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

How do you add an element to end of list in python?

list.add(element)

list.append(0,element)

list.append(element)

list.extend(element)

6.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

How do you find the number of elements in a list in python?

list.size()

list.count()

list.length()

len(list)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

what is the result of the following code:

list1=[1,2,3]

list2=list1

list2[1]=4

print(list1)

[1,2,3]

[1,4,3]

[4,2,3]

error

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?

Discover more resources for Computers