
Python Quiz
Quiz
•
Computers
•
Professional Development
•
Practice Problem
•
Hard
Harsha vardhan
Used 10+ times
FREE Resource
Enhance your content in a minute
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
10
15
25
125
Error: invalid syntax
Answer explanation
Using two multiplication symbols, we can make a power relationship in Python. We call operator an exponent operator. For example, the result of expression 5 3 is 125.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
var = "James" * 2 * 3
print(var)
JamesJamesJamesJamesJamesJames
JamesJamesJamesJamesJames
Error: invalid syntax
Answer explanation
We can use * operator to repeat the string n number of times. For example, in the above question, First, we repeated the string two times, and again we repeated the output string three times.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
sampleSet = {"Jodi", "Eric", "Garry"}
sampleSet.add(1, "Vicki")
print(sampleSet)
{‘Vicki’, ‘Jodi’, ‘Garry’, ‘Eric’}
{‘Jodi’, ‘Vicki’, ‘Garry’, ‘Eric’}
The program executed with error
Answer explanation
The set is an unordered data structure. Therefore, we cannot access/add/remove its elements by index number.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
listOne = [20, 40, 60, 80]
listTwo = [20, 40, 60, 80]
print(listOne == listTwo)
print(listOne is listTwo)
True
True
True
False
False
True
False
False
Answer explanation
The == (Equal To) operator used to compare the values of two objects and The is operator compares the identity of two objects.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
sampleList = ["Jon", "Kelly", "Jessa"]
sampleList.append(2, "Scott")
print(sampleList)
The program executed with errors
[‘Jon’, ‘Kelly’, ‘Scott’, ‘Jessa’]
[‘Jon’, ‘Kelly’, ‘Jessa’, ‘Scott’]
[‘Jon’, ‘Scott’, ‘Kelly’, ‘Jessa’]
Answer explanation
The append() method appends an item to the end of the list. Therefore, we cannot pass the index number to it.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code
Salary: 12000 Salary: 8000
Salary: 8000 Salary: 12000
Salary: 1200 Salary: 8000
The program failed with errors
Answer explanation
If you define a variable with the same name inside the function and global scope, a function will refer to the local variable by default.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
p, q, r = 10, 20 ,30
print(p, q, r)
10 20
10 20 30
10 30 20
Error: invalid syntax
Answer explanation
In Python, We can do simultaneous assignments to more than one variable.
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
20 questions
System and network support and management
Quiz
•
11th Grade - Professi...
10 questions
CEH Pre Assessment
Quiz
•
Professional Development
10 questions
Microsoft 365 for Teachers
Quiz
•
Professional Development
10 questions
Introduction to AI - Healthcare & Business
Quiz
•
University - Professi...
15 questions
SEC+ Ch.8 Review Test
Quiz
•
Professional Development
20 questions
ICT ວິຊາຊີບຄູ ເຄມີປີ 3
Quiz
•
Professional Development
15 questions
Cloud Computing Model Exam-IV PART-B
Quiz
•
Professional Development
10 questions
Name that App/Site
Quiz
•
Professional Development
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
Discover more resources for Computers
10 questions
How to Email your Teacher
Quiz
•
Professional Development
6 questions
3RD GRADE DECLARATION OF INDEPENDENCE EXIT TICKET
Quiz
•
Professional Development
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
22 questions
Multiplying Exponents with the Same Base
Quiz
•
9th Grade - Professio...
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...
