chapter 2 getting started with python Flashcards

(26 cards)

1
Q

What is Python?

A

Python is a high-level, interpreted programming language known for its readability and simplicity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which of the following is a key advantage of Python? (a) Low readability (b) Extensive libraries (c) Complex syntax

A

b) Extensive libraries

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

True or False: Python is primarily used for web development.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Fill in the blank: Python supports multiple _________, including procedural, object-oriented, and functional programming.

A

paradigms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is one major disadvantage of Python?

A

Python can be slower than compiled languages like C or C++.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does ‘interpreted language’ mean in the context of Python?

A

It means that Python code is executed line by line, rather than being compiled into machine code beforehand.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Name one application area where Python is commonly used.

A

Data analysis, web development, artificial intelligence, or automation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or False: Python has a strong community and extensive documentation.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the purpose of the Python Package Index (PyPI)?

A

PyPI is a repository of software for the Python programming language, allowing users to find and install packages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which of the following is a popular web framework for Python? (a) Django (b) React (c) Angular

A

a) Django

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Fill in the blank: Python’s syntax is designed to be ________ and easy to read.

A

clear

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a common use of Python in data science?

A

Data manipulation and analysis using libraries like Pandas and NumPy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

List one reason why Python is considered beginner-friendly.

A

Its simple and readable syntax makes it easy for beginners to learn.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True or False: Python supports both object-oriented and functional programming.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is one limitation of using Python for mobile app development?

A

Python is not natively supported on most mobile platforms, making it less efficient for mobile app development.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which command is used to install packages in Python?

A

pip install [package_name]

17
Q

What is a ‘virtual environment’ in Python?

A

A virtual environment is a self-contained directory that contains a Python installation for a particular version of Python, plus several additional packages.

18
Q

What is the purpose of the ‘if __name__ == ‘__main__’:’ construct in Python?

A

It allows code to be run only when the module is executed directly, not when it is imported.

19
Q

Identify one reason Python is preferred for scripting.

A

Its ease of use and quick learning curve make it ideal for writing scripts.

20
Q

Fill in the blank: Python’s indentation is significant, as it defines ________.

A

blocks of code

21
Q

What is the main reason for Python’s popularity in machine learning?

A

The availability of powerful libraries like TensorFlow and Scikit-learn.

22
Q

True or False: Python is only suitable for small-scale projects.

23
Q

What type of programming does Python’s ‘asyncio’ library facilitate?

A

Asynchronous programming

24
Q

Which data structure is not built-in in Python? (a) List (b) Tree (c) Dictionary

25
What is the main function of the 'import' statement in Python?
To include external modules or libraries into the current script.
26
Name one drawback of Python in terms of performance.
Python's dynamic typing can lead to slower execution times compared to statically typed languages.