python Flashcards

(147 cards)

1
Q

Define Python.

A

A high-level, interpreted programming language known for its readability and versatility.

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

What does PEP stand for?

A

Python Enhancement Proposal, a design document providing information to the Python community.

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

True or false: Python is a compiled language.

A

FALSE

Python is primarily an interpreted language.

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

Fill in the blank: Python uses _______ for defining blocks of code.

A

Indentation

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

What is a list in Python?

A

A mutable, ordered collection of items, defined using square brackets.

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

Define tuple.

A

An immutable, ordered collection of items, defined using parentheses.

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

What is the purpose of lambda functions?

A

To create small, anonymous functions at runtime.

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

True or false: Lists can contain different data types.

A

TRUE

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

Fill in the blank: The main function in Python is defined using _______.

A

if __name__ == ‘__main__’:

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

What is a dictionary in Python?

A

A mutable, unordered collection of key-value pairs, defined using curly braces.

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

Define set.

A

An unordered collection of unique items, defined using curly braces.

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

What does the len() function do?

A

Returns the number of items in an object.

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

True or false: Strings in Python are mutable.

A

FALSE

Strings are immutable; they cannot be changed after creation.

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

Fill in the blank: The for loop in Python iterates over _______.

A

iterable objects

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

What is exception handling?

A

A method to handle errors gracefully using try and except blocks.

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

Define module.

A

A file containing Python code that can be imported into other Python programs.

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

What is the purpose of the import statement?

A

To include external modules or libraries in a Python program.

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

True or false: Python supports object-oriented programming.

A

TRUE

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

Fill in the blank: A class in Python is defined using the _______ keyword.

A

class

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

What is a constructor in Python?

A

A special method called when an object is created, usually named __init__.

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

Define inheritance.

A

A mechanism where a new class derives properties from an existing class.

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

What is polymorphism?

A

The ability to use a single interface to represent different data types.

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

True or false: Python uses static typing.

A

FALSE

Python uses dynamic typing, meaning variable types are determined at runtime.

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

Fill in the blank: A list comprehension is a concise way to create _______.

A

lists

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is the **map()** function?
Applies a function to every item in an iterable and returns a map object.
26
Define **filter()**.
A function that constructs an iterator from elements of an iterable for which a function returns true.
27
What does the **reduce()** function do?
Applies a rolling computation to sequential pairs of values in an iterable.
28
True or false: Python supports **multithreading**.
TRUE
29
Fill in the blank: The **with** statement is used for _______ management.
resource
30
What is the purpose of the **self** parameter?
To refer to the instance of the class in class methods.
31
Define **decorator**.
A function that modifies the behavior of another function.
32
What is **flask**?
A lightweight web framework for Python used to build web applications.
33
True or false: Python can be used for **data analysis**.
TRUE
34
Fill in the blank: The **pandas** library is used for _______ manipulation.
data
35
What does the **numpy** library provide?
Support for large, multi-dimensional arrays and matrices, along with mathematical functions.
36
Define **matplotlib**.
A plotting library for creating static, animated, and interactive visualizations in Python.
37
What is **scikit-learn**?
A machine learning library for Python that provides simple and efficient tools.
38
True or false: Python is commonly used for **web scraping**.
TRUE
39
Fill in the blank: The **requests** library is used for _______ in Python.
HTTP requests
40
What is **beautifulsoup**?
A library for parsing HTML and XML documents and extracting data.
41
Define **API**.
Application Programming Interface; a set of rules for building software applications.
42
What does **JSON** stand for?
JavaScript Object Notation, a lightweight data interchange format.
43
True or false: Python can be used for **machine learning**.
TRUE
44
Fill in the blank: The **tensorflow** library is used for _______ in Python.
deep learning
45
What is **pytest**?
A framework for writing simple and scalable test cases in Python.
46
Define **virtual environment**.
An isolated environment for Python projects to manage dependencies separately.
47
What does the **pip** command do?
Installs and manages Python packages from the Python Package Index.
48
True or false: Python supports **functional programming**.
TRUE
49
Fill in the blank: The **yield** keyword is used to create _______ functions.
generator
50
What is a **generator**?
A function that returns an iterator and yields values one at a time.
51
Define **list slicing**.
Extracting a portion of a list using a specified range of indices.
52
What does the **sorted()** function do?
Returns a new sorted list from the items in an iterable.
53
True or false: Python has **built-in** functions.
TRUE
54
Fill in the blank: The **input()** function reads data from _______.
the user
55
What is **type hinting**?
A feature that allows specifying the expected data types of function arguments and return values.
56
Define **f-string**.
A way to format strings using expressions inside curly braces, introduced in Python 3.6.
57
What is **asyncio**?
A library to write concurrent code using the async/await syntax.
58
True or false: Python supports **multiple inheritance**.
TRUE
59
Fill in the blank: The **break** statement is used to _______ a loop.
exit
60
What does the **continue** statement do?
Skips the current iteration of a loop and proceeds to the next one.
61
Define **list comprehension**.
A concise way to create lists using a single line of code.
62
What is the **pass** statement?
A null operation that is syntactically required but does nothing.
63
True or false: Python allows **nested functions**.
TRUE
64
Fill in the blank: The **assert** statement is used for _______ testing.
debugging
65
What is a **docstring**?
A string literal that describes a module, class, method, or function.
66
Define **enumerate()**.
A built-in function that adds a counter to an iterable and returns it as an enumerate object.
67
What does the **zip()** function do?
Combines two or more iterables into a single iterable of tuples.
68
True or false: Python has **strict** variable declarations.
FALSE ## Footnote Variables in Python can be created without explicit declaration.
69
Fill in the blank: The **try** block is used to handle _______.
exceptions
70
What is a **context manager**?
An object that defines methods for resource management using the with statement.
71
Define **slice**.
An object that specifies how to extract a portion of a sequence.
72
What does the **input()** function return?
The data entered by the user as a string.
73
True or false: Python can be used for **game development**.
TRUE
74
Fill in the blank: The **pygame** library is used for _______ development.
game
75
What is **Tkinter**?
A standard GUI toolkit for Python used to create desktop applications.
76
Define **web framework**.
A software framework designed to aid the development of web applications.
77
What does the **flask** framework provide?
Tools and libraries for building web applications quickly and easily.
78
True or false: Python supports **RESTful APIs**.
TRUE
79
Fill in the blank: The **Django** framework is known for its _______ architecture.
MTV (Model-Template-View)
80
What is **SQLAlchemy**?
An SQL toolkit and Object-Relational Mapping (ORM) system for Python.
81
Define **ORM**.
Object-Relational Mapping; a programming technique for converting data between incompatible type systems.
82
What does the **pytest** framework offer?
Tools for writing simple and scalable test cases for Python code.
83
True or false: Python is not suitable for **scientific computing**.
FALSE ## Footnote Python is widely used in scientific computing and data analysis.
84
Fill in the blank: The **scipy** library is used for _______ computing.
scientific
85
What is **Jupyter Notebook**?
An open-source web application for creating and sharing documents with live code.
86
Define **data visualization**.
The graphical representation of information and data to communicate insights.
87
What does the **seaborn** library provide?
A statistical data visualization library based on matplotlib.
88
True or false: Python can be used for **network programming**.
TRUE
89
Fill in the blank: The **socket** module is used for _______ programming.
network
90
What is **threading**?
A way to run multiple threads (smaller units of a process) simultaneously.
91
Define **multiprocessing**.
A module that allows the creation of multiple processes to run concurrently.
92
What does the **os** module provide?
Functions for interacting with the operating system, such as file manipulation.
93
True or false: Python can be used for **automation**.
TRUE
94
Fill in the blank: The **subprocess** module is used to _______ new processes.
spawn
95
What is **web scraping**?
The process of extracting data from websites using code.
96
Define **data science**.
A field that uses scientific methods, algorithms, and systems to extract knowledge from data.
97
What does **machine learning** involve?
Using algorithms to allow computers to learn from and make predictions based on data.
98
True or false: Python is not used in **artificial intelligence**.
FALSE ## Footnote Python is widely used in AI for its simplicity and extensive libraries.
99
Fill in the blank: The **Keras** library is used for _______ in Python.
deep learning
100
What is **data cleaning**?
The process of correcting or removing inaccurate records from a dataset.
101
Define **data wrangling**.
The process of transforming and mapping raw data into a more usable format.
102
What does the **pandas** library offer?
Data structures and functions for data manipulation and analysis.
103
True or false: Python can be used for **cloud computing**.
TRUE
104
Fill in the blank: The **boto3** library is used for _______ with AWS.
interacting
105
What is **Docker**?
A platform for developing, shipping, and running applications in containers.
106
Define **containerization**.
A lightweight form of virtualization that packages applications and their dependencies together.
107
What does the **flask** framework help with?
Building web applications quickly and with minimal setup.
108
True or false: Python is not suitable for **big data** applications.
FALSE ## Footnote Python is often used in big data processing with libraries like PySpark.
109
Fill in the blank: The **PySpark** library is used for _______ processing.
big data
110
What is **data mining**?
The practice of examining large datasets to uncover patterns and insights.
111
Define **natural language processing**.
A field of AI that focuses on the interaction between computers and human language.
112
What does the **nltk** library provide?
Tools for working with human language data in Python.
113
True or false: Python is not used for **robotics**.
FALSE ## Footnote Python is used in robotics for scripting and automating tasks.
114
Fill in the blank: The **ROS** framework is used for _______ in robotics.
robot operating systems
115
What is **computer vision**?
A field of AI that trains computers to interpret and understand visual data.
116
Define **image processing**.
The manipulation of images to enhance or extract information.
117
What does the **opencv** library provide?
Tools for computer vision and image processing in Python.
118
True or false: Python is not used in **finance**.
FALSE ## Footnote Python is widely used in finance for data analysis and algorithmic trading.
119
Fill in the blank: The **quantlib** library is used for _______ in finance.
quantitative finance
120
What is **backtesting**?
The process of testing a trading strategy using historical data.
121
Define **algorithmic trading**.
Using algorithms to automate trading decisions in financial markets.
122
What does the **pandas-datareader** library do?
Allows for easy access to financial data from various sources.
123
True or false: Python is not used in **healthcare**.
FALSE ## Footnote Python is used in healthcare for data analysis and machine learning.
124
Fill in the blank: The **pyspark** library is used for _______ in healthcare.
big data analysis
125
What is **bioinformatics**?
An interdisciplinary field that uses software and algorithms to analyze biological data.
126
Define **genomics**.
The study of genomes, the complete set of DNA within an organism.
127
What does the **biopython** library provide?
Tools for biological computation and bioinformatics in Python.
128
True or false: Python is not used in **education**.
FALSE ## Footnote Python is used in education for teaching programming and data science.
129
Fill in the blank: The **jupyter** notebook is widely used for _______ in education.
interactive learning
130
What is **e-learning**?
Learning conducted via electronic media, typically on the Internet.
131
Define **MOOC**.
Massive Open Online Course; a course available online to a large number of participants.
132
What does the **scikit-image** library provide?
Tools for image processing in Python.
133
True or false: Python is not used in **social media**.
FALSE ## Footnote Python is used in social media for data analysis and automation.
134
Fill in the blank: The **tweepy** library is used for _______ with Twitter.
interacting
135
What is **sentiment analysis**?
The computational task of identifying and categorizing opinions expressed in text.
136
Define **web development**.
The work involved in developing a website for the Internet or an intranet.
137
What does the **django** framework provide?
A high-level Python web framework that encourages rapid development.
138
True or false: Python is not used in **cybersecurity**.
FALSE ## Footnote Python is used in cybersecurity for scripting and automation tasks.
139
Fill in the blank: The **scapy** library is used for _______ in cybersecurity.
packet manipulation
140
What is **penetration testing**?
The practice of testing a computer system for vulnerabilities.
141
Define **malware analysis**.
The process of examining malicious software to understand its behavior.
142
What does the **pyshark** library provide?
Tools for packet analysis in Python.
143
True or false: Python is not used in **blockchain**.
FALSE ## Footnote Python is used in blockchain for developing smart contracts and applications.
144
Fill in the blank: The **web3.py** library is used for _______ with Ethereum.
interacting
145
What is **smart contract**?
A self-executing contract with the terms of the agreement directly written into code.
146
Define **cryptocurrency**.
A digital or virtual currency that uses cryptography for security.
147
What does the **pycryptodome** library provide?
Cryptographic services for Python, including encryption and decryption.