Chapter 6 Flashcards
What does a data type define?
Collection of data objects with a range of value and how they are stored in memory.
What does an object represent?
The instance of a programmer-defined type
What is another name for a programmer-defined type?
Abstract data type
Do all languages provide primitive data type?
Almost all of them
What is special about Integers?
It is an exact reflection of the hardware therefore mapping is trivial
How many different integer types are there?
May be as many as eight
What are the advantages of unsigned integers?
It cant go below 0. So you can store a lot more data into the field
Do Floating points model real numbers?
Yes but only as approximations
What are the 2 floating point types?
float and double
What is the standard for floating points?
IEEE Floating-Point Standard 754
How many bits does double and float use?
double = 64 bits
float = 32 bits
for both 1 bit = signed bit
in complex data types, what makes up each value?
a real part and an imaginary part (7 + 3j where 7 = real and 3 = imaginary
Whats the advantages and DisAdv of decimals
Adv : accuracy
DisAdv : waste memory and limited range
Why is an advantage of boolean values readability?
Simplicity and clear representation
How is the primitive data type character stored?
numeric codings with most common being ASCII
What are the different types of character encodings of primitive data types?
ASCII, UCS-2 (16 bit),32-bit Unicode(UCS-4)
How are lists represented and what do they hold?
ordered sequence of (often) heterogeneous values
Typically represented as a linked list
How does lists look like in F#?
[1;2;3]
What does F# list functions have in common with Scheme?
List.head [1;2;3] is equal to car (only returns the 1st element = 1)
List.tail [1;2;3] is equal to cdr in scheme (returns the rest of the list besides the head = [2;3]
Are Python lists mutable and what does it mean?
Yes. allows [3, 5.8 ,”grape”]
How do you delete list elements in Python?
del myList[1]
How does list comprehensions look like in Python?
list = [x ** 2 for x in range(12) if x % 3 == 0]
Where is Type theory studied in?
Math, Logic, CS, Philosophy