Chapter 6 Flashcards
What does a data type define?
How an object is stored in memory.
Predefined operations on the object
What is the descriptor of a variable?
A collection of attributes of a variable
What are primitive data types?
Base line data types (not made up of other data types)
What data type is an exact reflection of the hardware?
Integer
What is a complex type?
(7 + 3j) 7 = real part, 3 = imaginary part
Adv + Con of decimals
Adv: accuracy
Cons: Waste memory + limited range
Why is an advantage of Booleans readability?
Reduced ambiguity ( true = yes, false = no )
What are characters stored as?
Numeric coding (ASCII)
Why is character string type evaluation a aid to writability?
Simplified operations. Directness + readability
Why is dynamic string length bad?
Cause it has additional cost ( memory overhead)
What is a User-defined ordinal type?
a enum. Only a finite number of possible values.
Why is enumerations good?
Aid to readability + reliability (only certain values are allowed)
What is the advantage + con of no index range checking in arrays?
Adv: performance
Con: Security (buffer overflow)
Why is static subscript binding good? ( Why is static arrays good)
Efficient execution
If subscript binding is static what type of binding must the storage binding be?
Also static ( length must be constant )
What is an advantage of a fixed stack-dynamic array?
Space efficiency
Why is space efficiency a advantage of fixed stack-dynamic arrays?
Memory is only allocated when called and released afterwards
Whats the biggest difference between stack dynamic and fixed stack dynamic?
Storage allocation ( fixed stack dynamic = constant length )
With stack dynamic arrays, is storage and subscript range statically bound or dynamically?
Dynamically because of variable length
When does subscript + storage binding become fixed with stack-dynamic arrays?
After initial binding
When does subscript + storage binding become fixed with fixed heap-dynamic arrays?
After allocation
int* p = new int[size]
Difference between fixed heap-dynamic arrays and heap-dynamic arrays?
Heap-dynamic can grow and shrink as items are added and removed
study differences between each languages array operations and if they increase or decrease read/write/reliability
What is a jagged matrix?
Rows with various lengths