Final Exam Flashcards
What is a control expression with regard to selection statements?
The expression that determines which statements get selected
What is a for loop behind the scenes? (low level / assembly level)
A while loop
Does the amount of activation records matter?
Yes. Less activation records means less work for the OS.
What does every statement in C++ result in?
A return value
What does reliability involve in a programming language?
- Type checking
- Exception handling
- Testing components
- Compatibility
What is an atom?
The smallest element or unit of something (Function, data, etc)
What does CAR do?
Contents of address register. Provides first element in a list.
What does CDR do?
Content decrement register, provides all elements in list except the first
What does the ‘ mean in Scheme/LISP?
That it’s a literal, and not to evaluate it as part of an expression.
What is a dynamic link?
When a pointer points to the beginning position of the calling activation record to enable you to access variables in the caller record.
What is variable lifetime?
The time when a variable is bound to a memory location
What two ways can a clause be read in Prolog?
Declaratively and Procedurally
How do you interpret mortal(X) :- human(X). declaratively?
For a given X, X is mortal if X is human.
How do you interpret mortal(X) :- human(X). procedurally?
To prove the main goal that X is mortal, prove the subgoal that X is human.
What is an abstract data type?
A user-defined data type that satisfies the two conditions: Information Hiding, and Data/Procedural Abstraction
What are the advantages of information hiding?
- Reliablity - User code separated from representation, allowing representation to be changed
- Reduces range of code/variables of which programmer must be aware
- Name conflicts are less likely
What are advantages of procedural/data abstraction?
- Provides a method of program organization
- Aids modifiability (keeps everything together)
- Separate compilation
How does inheritance augment ADTs?
It allows new classes defined in terms of existing ones (inherit common parts)
How does inheritance address the concerns that ADTs are difficult to reuse, and that ADTs are independent and at the same level?
You are able to reuse ADTs after minor changes and define classes in a hierarchy.
What is the difference between exception handling and event handling?
An exception is an UNUSUAL event, erroneous or not, detectable by either hardware or software that may require special processing. The special processing that may be required is exception handling.
Event handling is processing ALL events, which are just notifications that something specific has occurred.
What is the first programming language that allowed concurrency?
PL1
What are threads?
Concurrent processes
What are the categories of concurrency?
Physical concurrency - Multiple independent processors (multiple threads of control)
Logical concurrency - The appearance of physical concurrency is presented by timeslicing, using virtual threads
What are the two general categories of tasks?
Heavyweight tasks - Execute in their own address space
Lightweight tasks - Run in the same address space (which is more efficient due to less scheduling / OS overhead)
What is a disjoint task?
A task that does not communicate with or affect the execution of any other task in the program in any way