General Programming Flashcards

1
Q

What is a nested class?

A

Any class whose declaration occurs within the body of another class or interface

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

What is a top-level class?

A

Any class that is not nested

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

What is a bytestream?

A

A sequence of bytes

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

What is a byte?

A

8 bits (each bit a 1 or 0)

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

What is a class declaration?

A
The first time the compiler is made aware of the existence of the class.
Declaration does not require definition.
class X;        // valid Java class declaration
Sometimes called a prototype
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a class definition?

A
Includes the parameters, extensions, implementations etc that define what a class is.
This is also the declaration unless the class has already been declared without a definition
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a class signature?

A

All the parts of the class definition required at runtime for overload resolution

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

What is the difference between call by need and call by name?

A

Call by need = lazy evaluation = memoized
Usually only used if argument(s) are pure (free from side effects).
Call by name
Arguments are not evaluated before the function is called; they are evaluated each time the argument is used in the function body.

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

What is functional composition?

A

When a function manipulates the return value of another function.

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

What is a first class function?

A

A function can be passed as an argument to another function.

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

What is delegation?

A

Delegation means that you use an object of another class as an instance variable, and forward messages to the instance.

eg
class Printer {
  RealPrinter p = new RealPrinter
  void print ( ) {
    p.print ( )
  }
Delegate = RealPrinter.print( )
Delegator = p, the instance of the object providing the  delegate.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
What is the difference between:
Member
Attribute
Variable
Field
A

Member : Normally used to define the variables and methods.

Attribute : Attributes are the instance variables of an Object.

Variable : Primitive variables and Objects reference variables as instance or local variables.

Field: Field marks an instance variable.

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

What is the difference between synchronous and asynchronous execution?

A

synchronous - wait for task 1 to finish before beginning execution of task 2.
Like being in a queue to be seated in a restaurant. One at a time.

asynchronous - can start task 2 before task 1 finishes execution. Task 2 is usually executed on a separate thread, but does not have to be.
Like being seated in a restaurant - ordering, serving, clearing away is happening to everyone all the time.

NB Simply put, these definitions are the opposite in CS from everywhere else these terms are used

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