MIDTERM_JARED Flashcards

1
Q

is one of the most popular programming languages. Although it
is a general-purpose language, it is used in various areas of applications
such as Machine Learning, Artificial

A

Python

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

is a very popular general-purpose interpreted, interactive,
object-oriented, and high-level programming language.

A

Python

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

It
was created by ___________ during ______

A

Guido van Rossum , 1985- 1990.

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

development began in the late__________ while he was working at the
________ & Informatica (CWI), a computer science research
institute in the Netherlands.

A

1980s, Centrum Wiskunde

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

One of the key factors contributing to Python’s popularity is its concise
set of keywords.

A

Python is Easy to learn

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

Python comes with a cool interactive tool called a “shell.” It’s like
having a chat with Python itself! When you open the Python shell, it
shows a friendly&raquo_space;> prompt.

A

Python is Interactive

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

This functionality is supported by venv module in standard Python
distribution.

A

Create new Virtual Environment

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

is a name used to identify a variable, function,
class, module or other object. An identifier starts with a letter A to Z
or a to z or an underscore (_) followed by zero or more letters,
underscores and digits (0 to 9).

A

Python Identifiers

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

start with an uppercase letter. All other
identifiers start with a lowercase letter.

A

Python Class names

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

private identifier.

A

starts with a single leading underscore

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

Python programming provides no braces to indicate blocks of code for
class and function definitions or flow control. Blocks of code are
denoted by line indentation, which is rigidly enforced. All statements
within the block must be indented

A

Python Lines and Indentation

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

is a programmer-readable explanation or annotation in the
Python source code. They are added with the purpose of making the
source code easier for humans to understand, and are ignored by
Python interpreter

A

comment

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

Data items belonging to different data types are stored in computer’s
memory. Computer’s memory locations are having a number or
address, internally represented in binary form. Data is also stored in
binary form as the computer works on the principle of binary
representation.

A

Python Variables

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

First letter is a lowercase, but first letter of each
subsequent word is in uppercase.

A

Camel case

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

First letter of each word is in uppercase.

A

Pascal case

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

Use single underscore (_) character to separate words.

A

Snake case

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

represents a kind of value and determines what operations
can be done on it

A

Data type

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

Any data item having a numeric value is a number.

A

Number Type

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

Four
standard number data types in Python.

A

integer, floating point,
Boolean and Complex.

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

is a collection data type.

A

Sequence

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

three sequence
types defined in Python.

A

String, List and Tuple.

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

is a sequence of one or more Unicode characters, enclosed in
single, double or triple quotation marks (also called inverted commas).

A

string

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

is an ordered collection of any type of data items. Data
items are separated by comma (,) symbol and enclosed in square
brackets ([]). A list is also a sequence, hence.

A

List

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

is an ordered collection of any type of data items.
Data items are separated by comma (,) symbol and enclosed in
parentheses or round brackets ().

A

Tuple

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
is mutable object,
List
26
is immutable.
tuple
27
is example of mapping type.
dictionary
28
'maps' value of one object with another. In
mapping object
29
have key (word) and value (meaning).
Dictionary
30
is a Python implementation of set as defined in Mathematics.
Set
31
converting an object of one type into another.
Casting
32
function converts an integer literal to an integer object, a float to integer, and a string to integer if the string itself has a valid integer literal representation.
int()
33
is a built-in function in Python. It returns a float object if the argument is a float literal, integer or a string with valid floating point representation.
float()
34
function works the opposite. It surrounds an integer or a float object with quotes (') to return a str object. The str() function returns the string.
str()
35
Typically, computer programs follow a straightforward sequence, executing one instruction after another in the order they appear.
Control Flow
36
The program is able to decide which of the alternative group of instructions to be executed, depending on value of a certain Boolean expression.
Decision Making
37
Most of the processes require a group of instructions to be repeatedly executed. In programming terminology, it is called a loop. Instead of the next step, if the flow is redirected towards any earlier step, it constitutes a loop.
Looping or Iteration
38
symbol starts an indented block. The statements with the same level of indentation are executed if the boolean expression in if statement is True.
colon (:)
39
requires a boolean expression, followed by colon symbol.
if keyword
40
takes an expression and compares its value to successive patterns given as one or more case blocks.
MatchCase Statement
41
has the ability to iterate over the items of any sequence, such as a list, tuple or a string.
for loop
42
statement in Python programming language repeatedly executes a target statement as long as a given Boolean expression is true.
while loop
43
It terminates the current loop and resumes execution at the next statement, just like the traditional break statement in C.
break Statement
44
can be used in both while and for loops.
break statement
45
statement in Python returns the control to the beginning of the current loop.
continue
46
statement is used when a statement is required syntactically but you do not want any command or code to execute.
pass
47
is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing.
function
48
examples are print(), int(), len(), sum(), etc. These functions are always available, as they are loaded into computer's memory as soon as you start Python interpreter.
Built-in functions
49
The standard library also bundles a number of modules. Each module defines a group of functions. These functions are not readily available. You need to import them into the memory from their respective modules.
Functions defined in built-in modules -
50
you can also create your own functions. You can define custom functions to provide the required functionality.
User-defined functions
51
Function blocks begin with the keyword _ followed by the __ and __
def, function name , parentheses ( ( ) ).
52
should be placed within these parentheses.
parameters or arguments
53
exits a function, optionally passing back an expression to the caller.
return [expression]
54
The variables in the parentheses are called
formal arguments.
55
When the function is called, value to each of the formal arguments must be provided. Those are called
actual arguments.
56
You can define a function with default value assigned to one or more formal arguments. Python uses the default value for such an argument if no value is passed to it. If any value is passed, the default is overridden.
Default Arguments
57
are also called named arguments. Variables in the function definition are used as keywords. When the function is called, you can explicitly mention the name and its value.
Keyword Arguments
58
as the last statement in function definition indicates end of function block, and the program flow goes back to the calling function. Although reduced indent after the last statement in the block also implies return but using explicit return is a good practice.
return keyword
59
An argument prefixed with a single asterisk *
arbitrary positional arguments.
60
An argument prefixed with two asterisks **
arbitrary keyword arguments.
61
has been provided to load a Python object from one module. The object may be a function, class, a variable etc. If a module contains multiple definitions, all of them will be loaded in the namespace.
import keyword
62
Returns true if string has at least one cased character and all cased characters are in uppercase and false otherwise.
isupper()
63
Returns true if string has at least 1 cased character and all cased characters are in lowercase and false otherwise.
islower()
64
Returns true if the string contains only digits and false otherwise.
isdigit()
65
Returns true if string has at least 1 character and all characters are alphabetic and false otherwise.
isalpha()
66
Returns true if string has at least 1 character and all characters are alphanumeric and false otherwise.
isalnum()
67
Takes all items in an iterable and joins them into one string
join()
68
69
Splits string according to delimiter (space if not provided) and returns list of substrings.
split()
70
Splits the string from the end and returns a list of substrings
rsplit()
71
Performs both lstrip() and rstrip() on string
strip()
72
Removes all trailing whitespace of string.
rstrip()
73
Removes all leading whitespace in string.
lstrip()
74
Converts all uppercase letters in string to lowercase. Similar to lower(), but works on UNICODE characters alot
casefold()
75
Inverts case for all letters in string.
swapcase()
76
They help in manipulating strings. Since string is an immutable object, these methods return a copy of the original string, performing the respective processing on it.
Python's built-in str class
77
a string becomes a raw string if it is prefixed with "r" or "R" before the quotation symbols. Hence 'Hello' is a normal string whereas r'Hello' is a raw string.
Python Escape Characters
78
also support String alignment which is done with <, > and ^ symbols (for left, right and center alignment respectively) in place holder. Default is left alignment.
Python f-strings
79
also support formatting floats with precision specifications
f-strings
80
It is also possible to call a user defined function inside the f-string expression.
Using f-string Formatting
81
With the version 3.6, Python introduced a new string formatting method,
f-strings or Literal String Interpolation.
82
is the process of building a string representation dynamically by inserting the value of numeric expressions in an already existing string. Python's string concatenation operator doesn't accept a non-string operand. Hence, Python offers following string formatting techniques −
String formatting
83
It returns a substring from the original string. Its general usage is −
Python defines ":"
84
needs two integer operands.
The ":" operator
85
is composed of a number pixels arranged in a grid. Each of these pixels is a color that can be represented as a red, green, and blue (RGB) value. These values range from 0 to 255 for each of the red, green, and blue components. So if a pixel had a red value of 255, and a green value of 0, and a blue value of 255, it would appear as one bright purple dot (mix of red and blue) in the picture.
digital image
86
are the raw building blocks of an image. There is no finer granularity than the pixel.
Pixels
87
Most pixels are represented in two ways:
grayscale and color.
88
An image is represented as a grid of pixels.
Coordinate System
89
means processing the image digitally with the help of a computer. Using image processing we can perform operations like enhancing the image, blurring the image, extracting text from images, and many more operations.
Digital Image processing
90
is built on the top of PIL (Python Image Library) and is considered as the fork for the same as PIL has been discontinued from 2011. Pillow supports many image file formats including BMP, PNG, JPEG, and TIFF.
Python Pillow
91
module that provides simple 2D graphics for Image objects. You can use this module to create new images, annotate or retouch existing images, and generate graphics on the fly for web use.
ImageDraw module
92
function to read and display the image respectively.
open() and show() function
93
method of the Image class is used to rotate the image by a particular angle counterclockwise around its center. After rotating the image,
rotate()
94
is used to transpose the image (flip or rotate in 90 degree steps).
Image.transpose()
95
returns a resized copy of the image. Interpolation happens during the resize process, due to which the quality of image changes whether it is being upscaled (resized to a higher dimension than original) or downscaled (resized to a lower Image then original).
Image.resize()
96
is used to paste an image on another image.
PIL.Image.Image.paste()
97
saves the image under the given filename. If no format is specified, the format to use is determined from the filename extension, if possible.
Image.save()