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
Q

is mutable object,

A

List

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

is immutable.

A

tuple

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

is example of mapping type.

A

dictionary

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

‘maps’ value of one object with another. In

A

mapping object

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

have key (word) and value (meaning).

A

Dictionary

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

is a Python implementation of set as defined in Mathematics.

A

Set

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

converting an object of one
type into another.

A

Casting

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

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.

A

int()

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

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.

A

float()

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

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.

A

str()

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

Typically, computer programs follow a straightforward sequence,
executing one instruction after another in the order they appear.

A

Control Flow

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

The program is able to decide which of the alternative group of
instructions to be executed, depending on value of a certain Boolean
expression.

A

Decision Making

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

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.

A

Looping or Iteration

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

symbol starts an indented block. The statements with
the same level of indentation are executed if the boolean expression
in if statement is True.

A

colon (:)

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

requires a boolean expression, followed by colon
symbol.

A

if keyword

40
Q

takes an expression and compares its value to
successive patterns given as one or more case blocks.

A

MatchCase Statement

41
Q

has the ability to iterate over the items of any
sequence, such as a list, tuple or a string.

A

for loop

42
Q

statement in Python programming language repeatedly
executes a target statement as long as a given Boolean expression is
true.

A

while loop

43
Q

It terminates the current loop and resumes execution at the next
statement, just like the traditional break statement in C.

A

break Statement

44
Q

can
be used in both while and for loops.

A

break statement

45
Q

statement in Python returns the control to the
beginning of the current loop.

A

continue

46
Q

statement is used when a statement is required
syntactically but you do not want any command or code to execute.

A

pass

47
Q

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.

A

function

48
Q

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.

A

Built-in functions

49
Q

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.

A

Functions defined in built-in modules -

50
Q

you can also create your own functions. You
can define custom functions to provide the required functionality.

A

User-defined functions

51
Q

Function blocks begin with the keyword _ followed by the __
and __

A

def, function name , parentheses ( ( ) ).

52
Q

should be placed within these
parentheses.

A

parameters or arguments

53
Q

exits a function, optionally passing back
an expression to the caller.

A

return [expression]

54
Q

The variables in the
parentheses are called

A

formal
arguments.

55
Q

When the function is called, value to
each of the formal arguments must be
provided. Those are called

A

actual
arguments.

56
Q

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.

A

Default Arguments

57
Q

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.

A

Keyword Arguments

58
Q

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.

A

return keyword

59
Q

An argument prefixed with a single asterisk *

A

arbitrary positional
arguments.

60
Q

An argument prefixed with two asterisks **

A

arbitrary keyword
arguments.

61
Q

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.

A

import keyword

62
Q

Returns true if string has at least one cased character and all
cased characters are in uppercase and false otherwise.

A

isupper()

63
Q

Returns true if string has at least 1 cased character and all
cased characters are in lowercase and false otherwise.

A

islower()

64
Q

Returns true if the string contains only digits and false
otherwise.

A

isdigit()

65
Q

Returns true if string has at least 1 character and all
characters are alphabetic and false otherwise.

A

isalpha()

66
Q

Returns true if string has at least 1 character and all
characters are alphanumeric and false otherwise.

A

isalnum()

67
Q

Takes all items in an iterable and joins them into one string

A

join()

68
Q
A
69
Q

Splits string according to delimiter (space if not provided) and
returns list of substrings.

A

split()

70
Q

Splits the string from the end and returns a list of substrings

A

rsplit()

71
Q

Performs both lstrip() and rstrip() on string

A

strip()

72
Q

Removes all trailing whitespace of string.

A

rstrip()

73
Q

Removes all leading whitespace in string.

A

lstrip()

74
Q

Converts all uppercase letters in string to lowercase. Similar
to lower(), but works on UNICODE characters alot

A

casefold()

75
Q

Inverts case for all letters in string.

A

swapcase()

76
Q

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.

A

Python’s built-in str class

77
Q

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.

A

Python Escape Characters

78
Q

also support String alignment which is done with <, >
and ^ symbols (for left, right and center alignment respectively) in
place holder. Default is left alignment.

A

Python f-strings

79
Q

also support formatting floats with precision
specifications

A

f-strings

80
Q

It is also possible to call a user defined function inside the f-string
expression.

A

Using f-string Formatting

81
Q

With the version 3.6, Python introduced a new string formatting
method,

A

f-strings or Literal String Interpolation.

82
Q

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 −

A

String formatting

83
Q

It returns a substring
from the original string. Its general usage is −

A

Python defines “:”

84
Q

needs two integer operands.

A

The “:” operator

85
Q

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.

A

digital image

86
Q

are the raw building blocks
of an image. There is no finer granularity than the pixel.

A

Pixels

87
Q

Most pixels are represented in two ways:

A

grayscale and color.

88
Q

An image is represented as a grid
of pixels.

A

Coordinate System

89
Q

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.

A

Digital Image processing

90
Q

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.

A

Python Pillow

91
Q

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.

A

ImageDraw module

92
Q

function to read
and display the image respectively.

A

open() and show() function

93
Q

method of the Image class is used to rotate the image by a
particular angle counterclockwise around its center. After rotating the
image,

A

rotate()

94
Q

is used to transpose the image (flip or rotate in 90
degree steps).

A

Image.transpose()

95
Q

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).

A

Image.resize()

96
Q

is used to paste an image on another
image.

A

PIL.Image.Image.paste()

97
Q

saves the image under the given filename. If no format is
specified, the format to use is determined from the filename
extension, if possible.

A

Image.save()