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
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
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
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
25 questions
Christmas Movies
Quiz
•
Professional Development
20 questions
christmas songs
Quiz
•
KG - University
20 questions
Christmas Trivia
Quiz
•
Professional Development
20 questions
Holiday Trivia
Quiz
•
9th Grade - University
15 questions
Holiday Movies
Quiz
•
University
15 questions
Fun Holiday Trivia
Quiz
•
Professional Development
25 questions
Name That Tune - Christmas
Quiz
•
Professional Development
