PYTHON QUIZ2

PYTHON QUIZ2

University - Professional Development

10 Qs

quiz-placeholder

Similar activities

C Programming

C Programming

Professional Development

10 Qs

Latex

Latex

University

11 Qs

Tree and Planar Graph

Tree and Planar Graph

University

10 Qs

Streams

Streams

Professional Development

10 Qs

การใช้โปรแกรมประมวลผลคำ

การใช้โปรแกรมประมวลผลคำ

University

10 Qs

Sistem Operasi dan Aplikasi

Sistem Operasi dan Aplikasi

University

10 Qs

JAVA QUIZ-1

JAVA QUIZ-1

University

10 Qs

Bases Numéricas

Bases Numéricas

University

10 Qs

PYTHON QUIZ2

PYTHON QUIZ2

Assessment

Quiz

Computers

University - Professional Development

Hard

Created by

MSK PSGRKCW

Used 9+ times

FREE Resource

AI

Enhance your content in a minute

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

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

1. Which of the following is correct with respect to the python code d = {"a":3,"b":7}?

Dictionary d is created.

a and b are the keys of dictionary d.

3 and 7 are the values of dictionary d

All of the above.

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

2. What will be the output of the Python code?

d1={"abc":5,"def":6,"ghi":7}

print(d1[0])

abc

5

{“abc”:5}

Error

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

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

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

>>> d["john"]

40

45

“john”

“peter”

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

4. 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()

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

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

a = {i: i * i for i in range(6)}

print (a)

Dictionary comprehension doesn’t exist

{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6:36}

{0: 0, 1: 1, 4: 4, 9: 9, 16: 16, 25: 25}

{ 0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

6. To read two characters from a file object infile, we use ________.

infile.read(2)

infile.read()

infile.readline()

infile.readlines()

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

7. Which of the following command is used to open a file “c:\temp.txt” in read-mode only?

infile = open(“c:\temp.txt”, “r”)

infile = open(“c:\\temp.txt”, “r”)

infile = open(file = “c:\temp.txt”, “r+”)

infile = open(file = “c:\\temp.txt”, “r+”)

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