chapter 2 getting started with python Flashcards
What is Python?
Python is a high-level, interpreted programming language known for its readability and simplicity.
Which of the following is a key advantage of Python? (a) Low readability (b) Extensive libraries (c) Complex syntax
b) Extensive libraries
True or False: Python is primarily used for web development.
False
Fill in the blank: Python supports multiple _________, including procedural, object-oriented, and functional programming.
paradigms
What is one major disadvantage of Python?
Python can be slower than compiled languages like C or C++.
What does ‘interpreted language’ mean in the context of Python?
It means that Python code is executed line by line, rather than being compiled into machine code beforehand.
Name one application area where Python is commonly used.
Data analysis, web development, artificial intelligence, or automation.
True or False: Python has a strong community and extensive documentation.
True
What is the purpose of the Python Package Index (PyPI)?
PyPI is a repository of software for the Python programming language, allowing users to find and install packages.
Which of the following is a popular web framework for Python? (a) Django (b) React (c) Angular
a) Django
Fill in the blank: Python’s syntax is designed to be ________ and easy to read.
clear
What is a common use of Python in data science?
Data manipulation and analysis using libraries like Pandas and NumPy.
List one reason why Python is considered beginner-friendly.
Its simple and readable syntax makes it easy for beginners to learn.
True or False: Python supports both object-oriented and functional programming.
True
What is one limitation of using Python for mobile app development?
Python is not natively supported on most mobile platforms, making it less efficient for mobile app development.
Which command is used to install packages in Python?
pip install [package_name]
What is a ‘virtual environment’ in Python?
A virtual environment is a self-contained directory that contains a Python installation for a particular version of Python, plus several additional packages.
What is the purpose of the ‘if __name__ == ‘__main__’:’ construct in Python?
It allows code to be run only when the module is executed directly, not when it is imported.
Identify one reason Python is preferred for scripting.
Its ease of use and quick learning curve make it ideal for writing scripts.
Fill in the blank: Python’s indentation is significant, as it defines ________.
blocks of code
What is the main reason for Python’s popularity in machine learning?
The availability of powerful libraries like TensorFlow and Scikit-learn.
True or False: Python is only suitable for small-scale projects.
False
What type of programming does Python’s ‘asyncio’ library facilitate?
Asynchronous programming
Which data structure is not built-in in Python? (a) List (b) Tree (c) Dictionary
b) Tree
What is the main function of the ‘import’ statement in Python?
To include external modules or libraries into the current script.
Name one drawback of Python in terms of performance.
Python’s dynamic typing can lead to slower execution times compared to statically typed languages.