Python Concepts Quiz: Test Your Knowledge!


Gensen Huang
Idyllic Icon

Gensen Huang

Created 6/20/2024

2

73.33%

Q & A


Share This Quiz

Sources

https://raw.githubusercontent.com/WeitaoZhu/Python/1987308e0acff0fa5a42252557a91d0a2bb3d878/Fluent.Python.2nd.Edition.(z-lib.org).pdf

Discover how well you understand various Python concepts and challenge yourself with this engaging quiz! Can you score 15 out of 15?

Discover how well you understand various Python concepts and challenge yourself with this engaging quiz! Can you score 15 out of 15?

1. What programming language influenced the design of Python?

Java
C++
ABC
Haskell

2. How does Python handle sequence types such as strings, lists, and arrays?

Individually
Through a common interface
With custom operations for each type
Using external libraries

3. What do you call a function inside a class in Python?

Method
Procedure
Macro
Routine

4. Which version of Python introduced the `@` operator?

Python 2.7
Python 3.4
Python 3.5
Python 3.6

5. What are 'dunder' methods?

Deprecated methods
Library functions
Methods with double underscores
Dual-methods

6. In Python, what does the `len()` function do when called on a collection?

Returns the length of the collection
Sorts the collection
Checks if the collection is empty
Iterates through the collection

7. What is a common high-level operation for sequence types in Python?

Execution
Compilation
Slicing
Networking

8. How are dictionaries different in Python 3.7 compared to earlier versions?

They are unordered
Insertion order is preserved
They support nesting
They are immutable

9. When is the `__getitem__` method used?

When appending to a list
When sorting a dictionary
When indexing a collection
When printing a collection

10. Which Python feature allows functions to be passed around as objects?

Decorators
Functions as first-class objects
Modules
Conditional Statements

11. Which types of sequences does Python categorize as mutable?

str and bytes
tuple and str
list and bytearray
int and float

12. What is meant by the 'str versus bytes split' in Python 3?

A change in string concatenation
A type checking mechanism
A distinction between text and binary data
An optimization for large strings

13. Which method is used to construct a simple class to represent individual cards in the book's example?

namedtuple
dataclass
class keyword
staticmethod

14. What does the key argument in sort and sorted functions allow?

Passing additional arguments
Sorting in reverse
Custom sorting criteria
Iterating elements

15. What packaging tool was used to test most of the code in the book?

unittest
pytest
doctest
nose