PYTHON QUIZ2

PYTHON QUIZ2

University - Professional Development

10 Qs

quiz-placeholder

Similar activities

uas-siber

uas-siber

University

10 Qs

Cha-ching 2

Cha-ching 2

1st Grade - University

8 Qs

Gen. Assembly Recap Day 1

Gen. Assembly Recap Day 1

Professional Development

15 Qs

JDBC_Objective_Exam_2

JDBC_Objective_Exam_2

Professional Development

15 Qs

EXAM 4

EXAM 4

Professional Development

15 Qs

Mastering KineMaster

Mastering KineMaster

Professional Development

10 Qs

PSSI Chp 1 dan 2

PSSI Chp 1 dan 2

University

12 Qs

TES AWAL MODUL 2

TES AWAL MODUL 2

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?