PYTHON QUIZ2
Quiz
•
Computers
•
University - Professional Development
•
Hard
MSK PSGRKCW
Used 9+ times
FREE Resource
Enhance your content in a minute
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

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
13 questions
Week 2 Before Class
Quiz
•
University
10 questions
POP QUIZ 4 (DFC40243)
Quiz
•
University
10 questions
Google Productivity day 3
Quiz
•
Professional Development
10 questions
6-文件操作
Quiz
•
University
10 questions
Microsoft 365 for Teachers
Quiz
•
Professional Development
13 questions
Chap 1: What is a program made of?
Quiz
•
University
10 questions
Pos-Prueba (Libreta Profesional-One Note)
Quiz
•
Professional Development
11 questions
Arduino - Contador
Quiz
•
9th Grade - University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
