Comprehensive Guide to Data Types, Control Structures, and Memory Management in Programming Languages

0.0(0)
studied byStudied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/69

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 8:11 PM on 12/7/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

70 Terms

1
New cards

What is a data type?

A set of values and the operations allowed on those values.

2
New cards

What is type checking?

The process of ensuring type consistency throughout a program.

3
New cards

What is type inference?

Automatically determining the types of expressions based on context.

4
New cards

What are type constructors?

Mechanisms for creating new types from existing ones (arrays, records, pointers, unions, etc.).

5
New cards

What is a strongly typed language?

A language where all type errors must be detected before runtime.

6
New cards

What is a weakly typed language?

A language that permits operations that may result in type errors at runtime.

7
New cards

What are simple types?

Types with no internal structure beyond basic values (int, char, boolean, enums).

8
New cards

What is an enumerated type?

A type with explicitly listed named values.

9
New cards

What is a subrange type?

A type defined as a contiguous subset of another simple type.

10
New cards

What is structural type equivalence?

Two types are equivalent if they have the same structure.

11
New cards

What is name type equivalence?

Two types are equivalent only if they use the same type name.

12
New cards

What is a Cartesian product type?

A type formed from ordered pairs (implemented as structs or records).

13
New cards

What is a union type?

A type allowing values from multiple alternative types.

14
New cards

What is a discriminated union?

A union with a tag identifying which value type is stored.

15
New cards

What is an undiscriminated union?

A union without tags, unsafe because the type isn't known.

16
New cards

What is a pointer type?

A type whose values are memory addresses referring to another type.

17
New cards

What is a reference type?

Like a pointer but not manipulated directly (e.g., Java objects).

18
New cards

What is a recursive type?

A type defined in terms of itself (linked lists, trees).

19
New cards

What is parametric polymorphism?

Functions or types that work for any type parameter (generics).

20
New cards

What is overloading?

Same operator/function name used for different types.

21
New cards

What is implicit type conversion?

Automatic conversion inserted by the translator.

22
New cards

What is explicit type conversion?

A cast written explicitly by the programmer.

23
New cards

What is an expression?

Code that returns a value and ideally has no side effects.

24
New cards

What is a statement?

Code executed for side effects, returning no value.

25
New cards

What is short-circuit evaluation?

Evaluation of Boolean expressions stops once the result is known.

26
New cards

What is prefix notation?

Operator before operands.

27
New cards

What is postfix notation?

Operator after operands.

28
New cards

What is infix notation?

Operator between operands.

29
New cards

What is the sequence operator?

Allows multiple expressions to execute in order within another expression.

30
New cards

What is a guarded if?

An if with Boolean guards; only one true guard executes.

31
New cards

What is the dangling-else problem?

Ambiguity about which if a given else matches.

32
New cards

What rule fixes the dangling-else problem?

The closest-if rule: an else matches the nearest unmatched if.

33
New cards

What is a case/switch statement?

A multi-way branch based on a selector value.

34
New cards

What is a while loop?

Repeats while a condition is true.

35
New cards

What is a do-while loop?

Executes the loop body at least once before checking the condition.

36
New cards

What is a for loop?

Loop containing initialization, condition, and update expressions.

37
New cards

What is continue?

Skips the remaining loop body and starts the next iteration.

38
New cards

What is break?

Terminates the closest loop immediately.

39
New cards

What is the loop-and-a-half problem?

A loop that naturally needs an early exit in the middle; break solves it.

40
New cards

What is an exception?

An event indicating an error or unusual situation during execution.

41
New cards

What is raising an exception?

Triggering an exception event to interrupt normal control flow.

42
New cards

What is an exception handler?

Code that catches and processes an exception.

43
New cards

What is propagation of exceptions?

Searching up the call stack for a matching handler.

44
New cards

What is stack unwinding?

Exiting activation records while searching for a handler.

45
New cards

What is the termination model?

After handling an exception, execution continues after the handling block.

46
New cards

What is the resumption model?

Execution restarts from where the exception occurred.

47
New cards

What is a procedure?

A collection of computations executed when called.

48
New cards

What is a function?

A procedure that returns a value.

49
New cards

What is a procedure specification?

Includes name, parameters, and return type.

50
New cards

What is a procedure body?

The block of statements the procedure executes.

51
New cards

What are formal parameters?

The parameters listed in the procedure definition.

52
New cards

What are actual parameters?

The arguments supplied in the procedure call.

53
New cards

What is pass-by-value?

Argument values are copied; changes do not affect the caller.

54
New cards

What is pass-by-reference?

The caller's variable is passed; changes inside affect the caller.

55
New cards

What is pass-by-value-result?

Copy in at call, copy out on return.

56
New cards

What is pass-by-name?

Argument expressions are re-evaluated each time the parameter is used.

57
New cards

What is a closure?

The combination of a function's code and its defining environment.

58
New cards

What is an activation record?

Memory allocated for one execution of a procedure (locals, return address, parameters).

59
New cards

What is a control link?

Points to the caller's activation record.

60
New cards

What is an access link?

Points to the lexical (defining) environment for nested procedures.

61
New cards

What is access chaining?

Following multiple access links to reach a nonlocal variable.

62
New cards

What is a static environment?

All memory allocated at load time; no recursion.

63
New cards

What is a stack-based environment?

Activation records pushed and popped as procedures execute and return.

64
New cards

Why is a stack insufficient for first-class functions?

Closures may refer to variables whose activation records have already been popped.

65
New cards

What is dynamic memory allocation?

Allocation of storage at runtime using a heap.

66
New cards

What is garbage collection?

Automatic reclamation of unused memory.

67
New cards

What is reference counting?

Each object tracks how many references point to it; freed when count hits zero.

68
New cards

What is the major drawback of reference counting?

Cannot reclaim cycles.

69
New cards

What is mark-and-sweep?

Marks reachable objects, then sweeps unmarked ones into the free list.

70
New cards

What is generational garbage collection?

Divides objects by age; young objects collected more frequently.