CSE12 Review Flashcards
STDERR
is used to display two kinds of messages
- debug
- runtime error
Unsigned value in C or C++
positive
Convert 0xa to binary
1010
0xFF is stored in a signed char, is it positive or negative?
NEGATIVE
Assuming a 4-bit unsigned word, convert 1111 to hexadecimal
0xF
using NAMESPACE in C++ is similar to what in JAVA?
import
Polymorphic generic container (PMGC)
When using a polymorphic generic container, the container can manipulate objects only when knowing the types of those objects.
Traversal Orders
Pre-ORDER Visit Left Right
In-ORDER Left Visit Right
Post-ORDER Left Right Visit
Arrays
declaring: type name [size] = initialize values
storing data information in array (indexing)
passing array as parameter
zero indexing
errors: out of bound array indexing
continuous RTS memory allocation
char array/ string array (automatic)
Java with Generics
homogeneous container: compiler enforced design
Item removal was of known type (no casting to true type)
Item to remove was known , not polymorphic
Smaller memory use than c++: benefits for memory limited app
Gary HW Outline
HW3: Create STACK, not PMGC
HW4: CALL , not PMGC
HW5: LIST , PMGC
STACK, PMGC
MYREC, not PMGC
object structure is simple and representative. Constraint method: copy function, delete function, greater than write. Constructor is not constraint methods
HW6: UCSDstudent, not PMGC
HTABLE, PMGC
VAR, not PMGC
SYMTAB, PMGC
~~ “when object satisfies constructor* , it can be out into PMGC
HW7: Generics
HW9: DISK
HW8: TEMPLATE
Disadvantage of Object Oriented Design (OOD)
Overkill
Learning Curve: takes time to
debug is challenging: layers make debugging hard to find from implicit call
“magic”: implicit calls to methods and polymorphic generic method, …
C with void pointer and function pointer
type checking: void pointer
heap memory: memory leak checking
pointer: too many, null check for each
OO syntax: code was not real Object oriented
Complex; so many symbolic elements
XORing is used to extra bits
FALSE
XORing is used to flip bits
TRUE