Programming Languages & Paradigms Flashcards
7 cards from real B.S.W.E. Bachelor of Software Engineering practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Programming Languages & Paradigms flashcards as text
What is the correct distinction between concurrency and parallelism?
Answer: Concurrency is about managing multiple tasks; parallelism is about executing multiple tasks simultaneously
Concurrency structures a program to handle multiple tasks (possibly interleaved on one core), while parallelism actually runs multiple tasks at the exact same time across multiple processors.
What is 'lazy evaluation' in programming language semantics?
Answer: Evaluating an expression only when its result is actually needed
Lazy evaluation defers computing an expression's value until it is required, which can improve efficiency and enables constructs like infinite data structures.
Which of the following correctly describes a 'macro' in programming languages?
Answer: A code transformation rule applied by a preprocessor or compiler before execution
Macros are syntactic transformations applied at compile time or preprocessing, enabling code generation and syntactic extension before the code is executed.
What is 'type inference' in statically typed programming languages?
Answer: The compiler's ability to deduce variable types from context without explicit annotations
Type inference lets a compiler automatically determine the types of expressions from surrounding context, reducing verbosity while retaining the safety of static typing.
What is the actor model of concurrency?
Answer: A model where concurrent entities communicate exclusively through asynchronous message passing with no shared state
In the actor model, actors are isolated units with private state that interact only through asynchronous message passing, eliminating shared mutable state and its associated hazards.
What does 'metaprogramming' mean in the context of programming languages?
Answer: Writing programs that generate, analyze, or transform other programs as data
Metaprogramming involves writing code that operates on other code as data — generating, reading, or transforming it — enabling powerful abstractions like macros and code generators.
What does the Liskov Substitution Principle (LSP) state?
Answer: Objects of a superclass should be replaceable with objects of a subclass without altering program correctness
LSP states that if S is a subtype of T, objects of type T may be replaced with objects of type S without breaking the program's correctness, ensuring sound inheritance hierarchies.