
Python Practice Test #2
Flashcard
•
Professional Development
•
Professional Development
•
Practice Problem
•
Hard
Wayground Content
FREE Resource
Student preview

30 questions
Show all answers
1.
FLASHCARD QUESTION
Front
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)? Options: apple:banana, apple::banana, banana:apple:, banana::apple
Back
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.
FLASHCARD QUESTION
Front
What will the output be after running the following code snippet? Options: 0, 4, 2, 1
Back
4
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.
FLASHCARD QUESTION
Front
What will the output be after running the following code snippet? Options: ['bananas', ''], ['bananas'], ['apples'], ['apples', 'bananas', '']
Back
['bananas', '']
Answer explanation
The element 'apples' will be removed from the list from the .remove('apples') method
4.
FLASHCARD QUESTION
Front
What will the output be after running the following code snippet? Options: [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]
Back
[7, 6, 5, 4, 3, 2, 1]
Answer explanation
The symbol [:] accesses all elements in the list. [::-1] accesses all elements in the list but in reverse order.
5.
FLASHCARD QUESTION
Front
What will the output be after running the following code snippet? Options: 0b01, 0b11, 0b10, 10
Back
0b10
6.
FLASHCARD QUESTION
Front
What is the output of the following program?
Back
90
7.
FLASHCARD QUESTION
Front
What will the output be after running the following code snippet?
Back
False
Create a free account and access millions of resources
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
22 questions
Romanticism: A Movement Across the Arts
Flashcard
•
University
22 questions
EVALUATION UNIT #3
Flashcard
•
University
18 questions
Stative Vs Dynamic Verbs
Flashcard
•
University
26 questions
For Fashion Designer Introduciton
Flashcard
•
Professional Development
17 questions
Philippine History
Flashcard
•
University
21 questions
Unit 5 Test
Flashcard
•
KG - University
24 questions
Innovations in health care - a conceptual framework.
Flashcard
•
University
20 questions
Wednesday Wars: March + April
Flashcard
•
KG - University
Popular Resources on Wayground
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
4:3 Model Multiplication of Decimals by Whole Numbers
Quiz
•
5th Grade
10 questions
The Best Christmas Pageant Ever Chapters 1 & 2
Quiz
•
4th Grade
12 questions
Unit 4 Review Day
Quiz
•
3rd Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
15 questions
Solving Equations with Variables on Both Sides Review
Quiz
•
8th Grade