PAP Module-3 Part-2

PAP Module-3 Part-2

University

16 Qs

quiz-placeholder

Similar activities

Python

Python

University

20 Qs

Evaluasi Python Tuple

Evaluasi Python Tuple

University

20 Qs

Understanding Python Functions

Understanding Python Functions

University

20 Qs

Python Control Structures

Python Control Structures

University

20 Qs

C Programming Quiz

C Programming Quiz

12th Grade - University

20 Qs

JDVP Activity

JDVP Activity

12th Grade - University

20 Qs

Gerbang Logika

Gerbang Logika

10th Grade - University

19 Qs

Introduction To Computers

Introduction To Computers

University

20 Qs

PAP Module-3 Part-2

PAP Module-3 Part-2

Assessment

Quiz

Computers

University

Hard

Created by

Manzoor Ahmed

Used 6+ times

FREE Resource

16 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use?

d.size()

len(d)

size(d)

d.len()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Python code snippet?

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

print(list(d.keys()))

[“john”, “peter”]

[“john”:40, “peter”:45]

(“john”, “peter”)

(“john”:40, “peter”:45)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Python code snippet?

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

d2 = {"john":466, "peter":45}

d1 == d2

True

False

None

Error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements create a dictionary?

d = {}

d = {“john”:40, “peter”:45}

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

All of the mentioned

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these about a dictionary is false?

The values of a dictionary can be accessed using keys

The keys of a dictionary can be accessed using values

Dictionaries aren’t ordered

Dictionaries are mutable

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What will be the output of the following Python code snippet?

a={1:"A",2:"B",3:"C"}

for i,j in a.items():

print(i,j,end=" ")

1 A 2 B 3 C

1 2 3

A B C

1:”A” 2:”B” 3:”C”

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Python code snippet?

a={1:"A",2:"B",3:"C"}

print(a.setdefault(3))

{1: ‘A’, 2: ‘B’, 3: ‘C’}

C

{1: 3, 2: 3, 3: 3}

No method called setdefault() exists for dictionary

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?