ItLec prelims pt2 Flashcards

1
Q

a sequence of characters

A

string

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

computers do not deal with characters they deal with___________

A

numbers (binary)

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

Conversion of character to number is called ______ and the reverse is called ___________

A

encoding
decoding

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

___________ and _________ are some of the popular encodings used.

A

ASCII and Unicode

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

In python a string is a sequence of _________ characters

A

unicode

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

was introduced to include every character in all languages and bring uniformity in encoding

A

Unicode

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

You can access individual characters using

A

indexing

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

Trying to access a char out of index range will raise an

A

indexerror

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

An index must be an integer any other type will result in

A

TypeError

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

Strings are Immutable
T or F

A

T

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

To delete tge string entirely is possible using the

A

del keyword

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

returns an enumerate object, it contains the index and value of all the items

A

enumerate()

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

starts with a backslash and is interpreted differently

A

escape sequence

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

To ignore the escape sequence inside a string place a

A

r or R infront of the string

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

is available with the string object is very versatile and powerful for FORMATTING strings

A

format()

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

format strings contain ___________ as place holders

A

curly braces{}

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

Format are separated from the field name using

A

Colon

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

is a module to manipulate and manage date and time information

A

datetime

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

the handling for date time is

A

datetime.datetime

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

you need to import datetime before ytou use it
T or F

A

T

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

To format datetime objects use

A

strftime()

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

to perfrom arithmetic operations in datetime use

A

timedelta

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

to work with timezones in datetime objects use

A

pytz library

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

are named locations on disk to store related information

A

Files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
store the data in the form of characters.
Text files
26
store entire data in the form of bytes.
Binary files
27
are generally available in .jpg, .gif or .png formats.
Image files
28
CRUD meaning
Creat read update delete
29
we use _________ function to open a file
open()
30
represents a temporary block of memory
buffer
31
What does w open mode does?
Write data into file
32
What does "r" does
Read data from the file
33
What does a does?
append data to the file?
34
What does w+ do?
to write and read data of a file
35
What does r+ do?
To read and write data into file
36
What does a+ do?
To append and read data of file.
37
What does x do?
open file in exclusing creation mode.
38
To close a file use __________
close()
39
closing is mandatory T or F
True
40
When a file is not closed a problem will lead to
insufficient memory.
41
to create a fille use
open() method
42
to create a new file which parameters do you need?
x a W
43
TO read data from text file use
read()
44
the____________ method returns a list of remaining lines of the entire file
readlines()
45
To delete you much import
the os module and run the os.remove() function
46
to know the current directory
os.getcwd()
47
to make a sub directory
os.mkdir('mysub')
48
to change directory
os.chdir()
49
to rmeove directory
os.rmdir()
50
to rename directory
os.rename()
51
what is the error if not found using os.chdir()
FileNotFoundError
52
What happens when you delete a directory that has something inside of it
OSERROR
53
What does csv mean?
Comma separated Value
54
Do you need to import a csv file to use it? T or F
T
55
how to read in csv
csv.reader()
56
How to write in csv
csv.writer()
57
how to write a row of data in csv
writerow()
58
disrupts the flow of instructions
exception
59
this is optional and is used for code that needs to be executed regardless of whether an exception occurred or not
Finally
60
you can raise exceptions using the
raise statement
61