
Python Practice Test #2
Authored by Matt Little
Professional Development
Professional Development
Used 30+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What do you expect the following code will print given the first input is apple (stored in variable a) and the second input is banana (stored in variable b)?
apple:banana
apple::banana
banana:apple:
banana::apple
Answer explanation
The inputs were swapped during the assignment. x is assigned the value stored inside b, and y is assigned the value stored inside a.
2.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What will the output be after running the following code snippet?
0
4
2
1
Answer explanation
The if clause inside myfun() will evaluate to true since the value passed to the function is >= 4. The if block will then be executed, and the value of 4 will be returned.
3.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What will the output be after running the following code snippet?
['bananas', '']
['bananas']
['apples']
['apples', 'bananas', '']
Answer explanation
The element 'apples' will be removed from the list from the .remove('apples') method
4.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What will the output be after running the following code snippet?
[7, 6, 5, 4, 3, 2, 1]
[1, 2, 3, 4, 5, 6, 7]
[1, 2, 3, 4, 5, 6]
[2, 3, 4, 5, 6, 7]
Answer explanation
The symbol [:] accesses all elements in the list. [::-1] accesses all elements in the list but in reverse order.
5.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What will the output be after running the following code snippet?
0b01
0b11
0b10
10
6.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What is the output of the following program?
1
9
10
90
7.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What will the output be after running the following code snippet?
Not equal
Equal
False
True
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
25 questions
Happy-happy Review Agenda II
Quiz
•
Professional Development
25 questions
Y-Rule
Quiz
•
4th Grade - Professio...
25 questions
Sound Engineering Quiz #5
Quiz
•
Professional Development
25 questions
Pre-Test Training Dec.2021
Quiz
•
KG - Professional Dev...
25 questions
Job Qualifications
Quiz
•
8th Grade - Professio...
25 questions
TECHNICIAN L1
Quiz
•
Professional Development
25 questions
evaluasi B Indo tanggal 11 Juni
Quiz
•
Professional Development
25 questions
Tax Accounting: Vocabulary
Quiz
•
University - Professi...
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