Final Exam Flashcards

1
Q

What is a control expression with regard to selection statements?

A

The expression that determines which statements get selected

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

What is a for loop behind the scenes? (low level / assembly level)

A

A while loop

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

Does the amount of activation records matter?

A

Yes. Less activation records means less work for the OS.

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

What does every statement in C++ result in?

A

A return value

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

What does reliability involve in a programming language?

A
  • Type checking
  • Exception handling
  • Testing components
  • Compatibility
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an atom?

A

The smallest element or unit of something (Function, data, etc)

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

What does CAR do?

A

Contents of address register. Provides first element in a list.

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

What does CDR do?

A

Content decrement register, provides all elements in list except the first

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

What does the ‘ mean in Scheme/LISP?

A

That it’s a literal, and not to evaluate it as part of an expression.

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

What is a dynamic link?

A

When a pointer points to the beginning position of the calling activation record to enable you to access variables in the caller record.

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

What is variable lifetime?

A

The time when a variable is bound to a memory location

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

What two ways can a clause be read in Prolog?

A

Declaratively and Procedurally

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

How do you interpret mortal(X) :- human(X). declaratively?

A

For a given X, X is mortal if X is human.

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

How do you interpret mortal(X) :- human(X). procedurally?

A

To prove the main goal that X is mortal, prove the subgoal that X is human.

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

What is an abstract data type?

A

A user-defined data type that satisfies the two conditions: Information Hiding, and Data/Procedural Abstraction

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

What are the advantages of information hiding?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are advantages of procedural/data abstraction?

A
  • Provides a method of program organization
  • Aids modifiability (keeps everything together)
  • Separate compilation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How does inheritance augment ADTs?

A

It allows new classes defined in terms of existing ones (inherit common parts)

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

How does inheritance address the concerns that ADTs are difficult to reuse, and that ADTs are independent and at the same level?

A

You are able to reuse ADTs after minor changes and define classes in a hierarchy.

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

What is the difference between exception handling and event handling?

A

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.

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

What is the first programming language that allowed concurrency?

A

PL1

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

What are threads?

A

Concurrent processes

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

What are the categories of concurrency?

A

Physical concurrency - Multiple independent processors (multiple threads of control)
Logical concurrency - The appearance of physical concurrency is presented by timeslicing, using virtual threads

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

What are the two general categories of tasks?

A

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)

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

What is a disjoint task?

A

A task that does not communicate with or affect the execution of any other task in the program in any way

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

What is task synchronization?

A

A mechanism that controls the order in which tasks execute

27
Q

What are the two types of synchronization?

A
  • Cooperation Synchronization

- Competition Synchronization

28
Q

How is task communication for synchronization provided?

A
  • Shared nonlocal variables
  • Parameters
  • Message passing
29
Q

What is the scheduler?

A

A program that maintains task execution control and maps task execution onto available processors

30
Q

What are some different ways a task could be blocked?

A
  • Waiting for input from user
  • Waiting for request from hardware to finish
  • Waiting for output from another task
  • Waiting for resources to become available
31
Q

What are the design issues for concurrency?

A
  • Competition & Cooperation scheduling
  • Controlling Task scheduling
  • How can an application influence task scheduling
  • How and when tasks start and end execution
  • How and when are tasks created MOST IMPORTANT
32
Q

What are the methods of providing synchronization?

A
  • Semaphores
  • Monitors
  • Message Passing
33
Q

What is a monitor?

A

A scratchpad area that is shared. Activation records get created & use pointers to access requisite data in monitor.

34
Q

What is the objective of statement-level concurrency?

A

To provide a mechanism that the programmer can use to inform the compiler of ways it can map the program onto a multiprocessor architecture.

35
Q

What is a benefit of statement-level concurrency?

A

To minimize communication among processors and the memories of the other processors

36
Q

Why are functional languages not truly functional?

A

Because they often include some imperative or procedural constructs to assist in learning or using the paradigm / language.

37
Q

What is the difference between a function and a subprogram?

A

A subprogram is a portion of code in a program that:

  • Has a single entry point
  • Returns control to the caller when it terminates
  • Usually describes a computation
  • Includes functions and procedures

A function is a type of subprogram that:

  • Is modeled on a mathematical function.
  • Is called by appearance of its name in an expression along with parameters
  • The value produced by its execution is returned to the calling code, replacing the call itself
38
Q

What is an activation record instance?

A

A concrete example of an activation record (the collection of data for a particular subprogram activation)

39
Q

What does the most simple activation record for a subprogram contain?

A
  • Local variables
  • Parameters
  • The return address
40
Q

What is a deadlock?

A

When all tasks in a concurrent environment lose their liveness (ability to eventually complete execution)

41
Q

What is an abstraction?

A

A view or representation of an entity that includes only the most significant attributes

42
Q

What are the design issues for ADTs?

A
  • Can abstract types be parameterized?
  • What access controls are provided?
  • Is the specification of the type separate from its implementation?
43
Q

On what is the design of imperative languages based directly?

A

The von Neumann architecture, for which efficiency is the primary concern, rather than suitability of language for software development.

44
Q

What is the design of functional languages based on?

A

Mathematical functions

45
Q

What is a lambda expression?

A
  • One that specifies a parameter and mapping of a function in the following form: lamba(x) xxx
  • Nameless functions
  • Applied to parameters by placing parameters after the expression
46
Q

What is a functional form?

A

A higher order function that either takes functions as parameters, yields a function as its result, or both

47
Q

What is referential transparency?

A

The idea that in a functional programming language, the evaluation of a function always produces the same result given the same parameters

48
Q

What was the first functional programming language?

A

LISP (LISt Processor)

49
Q

What is scheme?

A

A modernized version of LISP designed to be cleaner, more modern, and simpler. It uses only static scoping.

50
Q

What function enables you to execute code generated within the interpreter?

A

eval

51
Q

What command concatenates two items together into a pair in Scheme/LISP?

A

cons

52
Q

What is a predicate function?

A

A function that returns either true or false

53
Q

What is the difference between EQV and EQ?

A

EQV does a value comparison (symbolic as well as numeric) vs. EQ which is a pointer comparison.

54
Q

What is tail recursion?

A

When a function’s recursive call is the last operation in its body.

55
Q

In the lazy evaluation paradigm, what the difference between a strict and nonstrict language?

A

Strict languages require all parameters to be fully evaluated. Nonstrict languages do not. Nonstrict languages are more efficient and allow concepts such as infinite lists.

56
Q

What are some advantages and disadvantages of imperative vs. functional languages?

A
Imperative Languages:
- Efficient execution
- Complex semantics
- Complex syntax
- Concurrency is programmer designed
Functional Languages:
- Simple semantics
- Simple syntax
- Less efficient execution
- Programs can automatically be made concurrent
57
Q

What are the major languages features of object oriented programming?

A
  • Abstract data types
  • Inheritance
  • Polymorphism
58
Q

What is the most common term for ADTs in programming languages?

A

Classes

59
Q

What is an instance of a class called?

A

An object

60
Q

In OOP, what are messages?

A

Calls to methods

61
Q

What is a message protocol / message interface?

A

The entire collection of methods of an object

62
Q

What are the parts of a message in OOP?

A
  • Method name

- Destination object

63
Q

What is an abstract method?

A

A method that does not include a definition

64
Q

What is an abstract class?

A

One that includes at least one virtual method. Cannot be instantiated.