PAP Module-3 Part-2

PAP Module-3 Part-2

University

16 Qs

quiz-placeholder

Similar activities

Python Basics

Python Basics

KG - University

15 Qs

Python Basics

Python Basics

KG - University

16 Qs

Python Programming Basics

Python Programming Basics

University

14 Qs

Python exam preparation

Python exam preparation

University

18 Qs

ASK T2 - Kod Arahan (Python)

ASK T2 - Kod Arahan (Python)

7th Grade - University

20 Qs

Scope of Variables in Python

Scope of Variables in Python

1st Grade - Professional Development

15 Qs

Day 6 - ONLINE TEST - PL03 PYTHON PROGRAMMING

Day 6 - ONLINE TEST - PL03 PYTHON PROGRAMMING

University

20 Qs

UNIT1-PYTHON

UNIT1-PYTHON

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?