What is the von Neumann architecture?
A stored-program architecture where computers execute sequential instructions stored in memory.
Are Python 2 and Python 3 interchangeable?
No, Python 2 and Python 3 are not interchangeable due to syntax and feature differences.
Why does C have less abstraction than modern languages?
It was designed when computational resources were scarce, requiring low-level memory management.
What are the three types of memory management?
What are the three memory allocation mechanisms?
Manual, Garbage Collection, Automatic Reference Counting
Static allocation, stack allocation, and heap allocation
What is the concept of scope in programming?
The textual region of a program where a variable's binding is valid.
What is abstraction in programming?
A feature of high-level languages allowing programmers to focus on "what" a program does rather than "how" it does it.
What is the key difference between a list and a tuple in Python?
Lists are mutable, while tuples are immutable.
What is a function prototype in C?
A declaration of a function's return type and parameters without the function body, used for single-pass compilation.
Why can’t languages using only static allocation support recursion?
Static allocation predefines memory at compile time, preventing dynamic function call stacks.
What happens when a local variable shadows a global variable?
The local variable hides the global variable within its scope.
What are the computational paradigms discussed in class?
Imperative, functional, object-oriented, and logic-based paradigms
How does Python handle deep and shallow copies?
Using copy.copy() for shallow copies and copy.deepcopy() for deep copies.
What are the two pointer operators in C?
The address-of operator (&) and dereference operator (*)
What is a lexical address in static scoping?
A reference composed of a level number and an offset to locate variables in nested blocks
What is a scope hole?
A region in code where a variable's declaration is inaccessible due to shadowing or other scoping rules.
How does a compiler differ from an interpreter?
A compiler translates the entire program to machine code before execution, while an interpreter translates and executes code line-by-line.
What is Python’s typing and binding paradigm?
Python uses dynamic typing and late binding, where types are determined at runtime.
How is the end of a string in C identified?
By a null terminator (\0)
What is the difference between stack and heap allocation?
Stack allocation is managed automatically and more efficient for local variables, while heap allocation provides dynamic memory for variable-sized data.
How does static binding differ from dynamic binding?
Static binding occurs at compile time, while dynamic binding happens during runtime.
What is a Just-In-Time (JIT) compiler?
A hybrid translation system that compiles code at runtime for optimized performance.
What is the syntax for inheritance in Python?
class Subclass(SuperClass1, SuperClass2, ...):
What is a dangling reference?
A pointer that refers to a memory location that has been deallocated.
What is garbage in memory management?
Unused memory that has been allocated but is no longer referenced.
Why is scoping important in programming?
It prevents naming conflicts and helps organize code by controlling variable visibility.