






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







โ What is type checking? Answer: The process of ensuring type consistency throughout a program. โ What is type inference? Answer: Automatically determining the types of expressions based on context. โ What are type constructors? Answer: Mechanisms for creating new types from existing ones (arrays, records, pointers, unions, etc.). โ What is a strongly typed language? Answer: A language where all type errors must be detected before runtime. โ What is a weakly typed language?
Answer: A language that permits operations that may result in type errors at runtime. โ What are simple types? Answer: Types with no internal structure beyond basic values (int, char, boolean, enums). โ What is an enumerated type? Answer: A type with explicitly listed named values. โ What is a subrange type? Answer: A type defined as a contiguous subset of another simple type. โ What is structural type equivalence? Answer: Two types are equivalent if they have the same structure. โ What is name type equivalence? Answer: Two types are equivalent only if they use the same type name. โ What is a Cartesian product type?
โ What is parametric polymorphism? Answer: Functions or types that work for any type parameter (generics). โ What is overloading? Answer: Same operator/function name used for different types. โ What is implicit type conversion? Answer: Automatic conversion inserted by the translator. โ What is explicit type conversion? Answer: A cast written explicitly by the programmer. โ What is an expression? Answer: Code that returns a value and ideally has no side effects. โ What is a statement? Answer: Code executed for side effects, returning no value. โ What is short-circuit evaluation?
Answer: Evaluation of Boolean expressions stops once the result is known. โ What is prefix notation? Answer: Operator before operands. โ What is postfix notation? Answer: Operator after operands. โ What is infix notation? Answer: Operator between operands. โ What is the sequence operator? Answer: Allows multiple expressions to execute in order within another expression. โ What is a guarded if? Answer: An if with Boolean guards; only one true guard executes. โ What is the dangling-else problem? Answer: Ambiguity about which if a given else matches.
Answer: Terminates the closest loop immediately. โ What is the loop-and-a-half problem? Answer: A loop that naturally needs an early exit in the middle; break solves it. โ What is an exception? Answer: An event indicating an error or unusual situation during execution. โ What is raising an exception? Answer: Triggering an exception event to interrupt normal control flow. โ What is an exception handler? Answer: Code that catches and processes an exception. โ What is propagation of exceptions? Answer: Searching up the call stack for a matching handler. โ What is stack unwinding? Answer: Exiting activation records while searching for a handler.
โ What is the termination model? Answer: After handling an exception, execution continues after the handling block. โ What is the resumption model? Answer: Execution restarts from where the exception occurred. โ What is a procedure? Answer: A collection of computations executed when called. โ What is a function? Answer: A procedure that returns a value. โ What is a procedure specification? Answer: Includes name, parameters, and return type. โ What is a procedure body? Answer: The block of statements the procedure executes. โ What are formal parameters? Answer: The parameters listed in the procedure definition.
โ What is an activation record? Answer: Memory allocated for one execution of a procedure (locals, return address, parameters). โ What is a control link? Answer: Points to the caller's activation record. โ What is an access link? Answer: Points to the lexical (defining) environment for nested procedures. โ What is access chaining? Answer: Following multiple access links to reach a nonlocal variable. โ What is a static environment? Answer: All memory allocated at load time; no recursion. โ What is a stack-based environment? Answer: Activation records pushed and popped as procedures execute and return. โ Why is a stack insufficient for first-class functions?
Answer: Closures may refer to variables whose activation records have already been popped. โ What is dynamic memory allocation? Answer: Allocation of storage at runtime using a heap. โ What is garbage collection? Answer: Automatic reclamation of unused memory. โ What is reference counting? Answer: Each object tracks how many references point to it; freed when count hits zero. โ What is the major drawback of reference counting? Answer: Cannot reclaim cycles. โ What is mark-and-sweep? Answer: Marks reachable objects, then sweeps unmarked ones into the free list. โ What is generational garbage collection? Answer: Divides objects by age; young objects collected more frequently.