💻
Programming Hard

Advanced Programming Concepts

Concurrency, compilers, functional programming and advanced CS concepts!

20 Questions
35s Per Question
0+ Plays
← All Programming Quizzes 📚 Study Guide for this category →
💡 Create account to save scores & earn XP
📋 View All 20 Questions & Answers

1. What is a "semaphore" in concurrent programming?

  • A. A type of variable
  • B. A synchronization primitive controlling access to shared resources using a counter ✓
  • C. A type of deadlock
  • D. A thread scheduler

💡 A semaphore is a signaling mechanism with a counter controlling how many threads can access a resource simultaneously.

2. What is "currying" in functional programming?

  • A. A type of recursion
  • B. Adding spice to code
  • C. Transforming a function with multiple arguments into a sequence of single-argument functions ✓
  • D. A type of memoization

💡 Currying transforms f(a,b,c) into f(a)(b)(c) — each call returns a new function taking the next argument.

3. What is "software entropy"?

  • A. A measure of code performance
  • B. The tendency of software to become increasingly complex and harder to maintain over time ✓
  • C. A type of memory leak
  • D. A security vulnerability

💡 Software entropy describes how code becomes increasingly disordered and difficult to maintain over time without deliberate refactoring.

4. What is a "race condition" in concurrent programming?

  • A. A performance optimization
  • B. A type of sorting algorithm
  • C. When two threads access shared data simultaneously and the result depends on timing ✓
  • D. A deadlock situation

💡 A race condition occurs when two or more threads access shared data concurrently and the outcome depends on the order of execution.

5. What is "register allocation" in compiler design?

  • A. A type of memory allocation
  • B. Assigning program variables to CPU registers to minimize memory access ✓
  • C. A type of garbage collection
  • D. Allocating RAM to a program

💡 Register allocation assigns frequently-used variables to CPU registers (fast) rather than main memory (slow) during compilation.

6. What is "garbage collection" in programming?

  • A. Deleting old files
  • B. Manual memory management
  • C. Automatic memory management that reclaims memory no longer in use ✓
  • D. A type of optimization

💡 Garbage collection automatically frees memory occupied by objects that are no longer referenced by the program.

7. What is "tail recursion"?

  • A. A recursion that never ends
  • B. A recursive call that is the very last operation in a function enabling optimization ✓
  • C. A type of loop
  • D. A recursive call with multiple base cases

💡 Tail recursion places the recursive call as the last operation, allowing compilers to reuse the stack frame and prevent overflow.

8. What is "functional programming"?

  • A. Programming with functions only
  • B. A paradigm treating computation as evaluation of mathematical functions, avoiding mutable state ✓
  • C. A type of OOP
  • D. Procedural programming

💡 Functional programming treats functions as first-class citizens and avoids mutable state and side effects.

9. What is "just-in-time (JIT) compilation"?

  • A. Compiling code before execution
  • B. Interpreting code line by line
  • C. Compiling code at runtime just before execution for better performance than interpretation ✓
  • D. A type of garbage collection

💡 JIT compilation compiles frequently-executed code paths to native machine code at runtime, combining benefits of compilation and interpretation.

10. What is "lazy evaluation"?

  • A. Slow code execution
  • B. Evaluating expressions only when their values are actually needed ✓
  • C. A type of caching
  • D. Skipping function calls

💡 Lazy evaluation delays computation until the result is needed, improving performance by avoiding unnecessary calculations.

11. What is the difference between a process and a thread?

  • A. No difference
  • B. A thread is heavier than a process
  • C. A process has its own memory space; threads share memory within a process ✓
  • D. Processes share memory; threads do not

💡 A process is an independent program with its own memory. Threads are lightweight units within a process sharing the same memory.

12. What is "ABI" in computer science?

  • A. Application Binary Interface — defines how binary code interacts at machine level ✓
  • B. A type of API
  • C. A programming language
  • D. A database protocol

💡 ABI (Application Binary Interface) defines low-level conventions for binary code interaction: calling conventions, data layouts, system calls.

13. What is "lexical scoping" in programming languages?

  • A. Scope determined at runtime
  • B. Variables accessible only in their defined block
  • C. Scope determined by where a function is defined in the source code ✓
  • D. A type of closure

💡 Lexical (static) scoping means a variable's scope is determined by its position in the source code, not where it is called.

14. What is "monadic" programming?

  • A. A type of OOP
  • B. Programming with a single function
  • C. A design pattern from functional programming for handling side effects and chaining operations ✓
  • D. A type of recursion

💡 Monads are a design pattern in functional programming for composing operations that involve side effects (IO, state, exceptions) in a clean way.

15. What is "type inference" in programming languages?

  • A. Manual type declaration
  • B. The compiler automatically deducing the type of an expression ✓
  • C. A runtime error
  • D. A type of casting

💡 Type inference allows a compiler to automatically determine the type of a variable without explicit annotation (e.g., var in Kotlin).

16. What is "polymorphic dispatch" in OOP?

  • A. Calling a static method
  • B. The runtime selection of which method implementation to call based on the object's actual type ✓
  • C. Calling multiple methods at once
  • D. A type of method overloading

💡 Polymorphic dispatch selects the appropriate method implementation at runtime based on the actual (dynamic) type of the object.

17. What is "continuation-passing style" (CPS)?

  • A. A type of recursion
  • B. A programming style where control is passed as explicit continuations (callbacks) ✓
  • C. A type of lazy evaluation
  • D. A functional design pattern

💡 CPS passes the rest of the computation as a function (continuation). Asynchronous callback-based code follows CPS principles.

18. What is a "pure function" in functional programming?

  • A. A function with no parameters
  • B. A function that always returns the same output for the same input with no side effects ✓
  • C. A function that uses global variables
  • D. A recursive function

💡 A pure function always produces the same output given the same input and has no observable side effects.

19. What does "immutability" mean in programming?

  • A. Variables that change frequently
  • B. Objects whose state cannot be changed after creation ✓
  • C. A type of constant
  • D. A read-only database

💡 Immutable objects cannot be modified after creation. A new object must be created to represent any change.

20. What is a "deadlock" in concurrent programming?

  • A. A performance bottleneck
  • B. A situation where two or more threads are blocked forever waiting for each other ✓
  • C. A type of race condition
  • D. An infinite loop

💡 Deadlock occurs when two or more threads each hold a resource the other needs, causing all to wait forever.

More Programming Quizzes

View all Programming quizzes →