Py4E DB Flashcards

1
Q

Name 4 different charactersets, what in short are their differences, and name which one is most commonly used

A

ASCII (128 chars), UTF32, UTF16, UTF8-most commonly used. UTF32 uses 4 bytes, UTF16 2 bytes, UTF8 only 1 byte - reason why it’s used

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

which char.set is used internally by Python 3?

is there anything not being stored in that char.set?

A

Unicode

binary charset, own defined: ]] y = b’aaa’

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

With what function can you find the ASCII-number for a character?

A

]] ord( ‘a’ )

]] print( ord( ‘a’ ) )

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

What function is used to convert characters from outside sources?
And what does it do?

A

]] mystring = outside_db.recfv(512)
]] mystring.decode()
- it will move the data from byte to unicode

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

how to make a string into bytes?

A

]] < string >.encode()

from string of characters into bytes

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

in which direction are the 2 functions used?

A

decode() - data received

encode() - data sent

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

what is a class?

A

A family of a specific kind of objects sharing the same attributes

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

how can you list all functions available to a class?

A

]] L = list(), ]] D = dict(), ]] T = tuple()

]] dict(L), ]] dict(D), ]] dict(T)

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

Obj.prog.: what is a constructor?

A

An object at the time when initially constructed

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

What are the definitions for: Class, Method or Message, Field or Attribute, Object or Instance

A

Class - a template,
Method or Message - defined Class’ capability,
Field or Attribute - bit of data in a Class,
Object or Instance - an instance of a Class

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