Python Programming Advanced Quiz 2
Select your answers and check your results. Use Reset to start again.
Search
Practice Pronunciation (Merriam-Webster)
Navigation
Python Programming Beginner Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
Python Programming Intermediate Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
Python Programming Advanced Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
SQL Programming Beginner Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
SQL Programming Intermediate Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
SQL Programming Advanced Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
JavaScript Programming Beginner Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
JavaScript Programming Intermediate Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
JavaScript Programming Advanced Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
C# Programming Beginner Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
C# Programming Intermediate Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
C# Programming Advanced Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
Java Programming Beginner Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
Java Programming Intermediate Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
Java Programming Advanced Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
C Programming Beginner Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
C Programming Intermediate Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
C Programming Advanced Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
Advanced Quiz 2
1. What is a closure in Python?
A function defined inside another function that remembers variables from the enclosing scope
A function with no parameters
A function that closes a file
2. What does the "global" keyword do?
Declares a variable as global inside a function
Imports global modules
Creates a global dictionary
3. How do you catch any exception in Python?
except Exception:
except:
Both are valid
4. What is the output of {x:x**2 for x in range(3)}?
{0: 0, 1: 1, 2: 4}
[0, 1, 4]
(0, 1, 4)
5. Which function returns an iterator that produces items only when needed?
iter()
range()
generator()
6. What does the "assert" statement do?
Tests if a condition is true and raises an error if not
Assigns a value
Imports a module
7. What is the difference between a shallow copy and a deep copy?
Shallow copies nested objects by reference, deep copies them by value
Shallow copy is faster
There is no difference
8. Which module is used for working with dates and times?
datetime
calendar
dateutil
9. What does the "super()" function do?
Calls a method from the parent class
Creates a superclass
Returns a super integer
10. How do you make a class attribute private?
Prefix with two underscores
Prefix with one underscore
Use the private keyword
Previous
Check Quiz
Reset
Next
Other
Timer
00:00
Start
Stop
Reset
Vocabulary Quiz
Score: 0
Reset Score
Submit Answer
Next Word
Spin the Wheel
SPIN
Promo's
Explore More
Python Tutorial
Real Python