Runtime Environments MCQs January 8, 2026December 14, 2024 by u930973931_answers 30 min Score: 0 Attempted: 0/30 Subscribe 1. What is a runtime environment in the context of programming languages? (A) The memory allocated for global variables (B) The compiler’s internal data structures (C) The environment in which a program executes, including memory, stack, heap, and I/O handling (D) A code editor 2. Which component is primarily responsible for managing function calls during execution? (A) Heap (B) Static memory (C) Stack (D) Register file 3. What is managed in the heap section of the runtime environment? (A) Dynamic memory allocated at runtime (B) Function call return addresses (C) Local variables (D) Compiler symbols 4. Which of the following is part of the runtime environment? (A) Stack, heap, and runtime libraries (B) Linker (C) Compiler (D) Source code editor 5. What is the purpose of a runtime stack? (A) To store global constants (B) To allocate dynamic memory (C) To manage procedure calls and local variables (D) To load the compiler 6. What is a runtime error? (A) An error detected during compilation (B) An error that occurs while the program is executing (C) An error in writing source code (D) An error in linking libraries 7. Which of the following is a common runtime check? (A) Division by zero detection (B) Type checking (C) Syntax checking (D) Lexical analysis 8. What is the role of a runtime library? (A) To compile source code (B) To optimize code at compile time (C) To manage disk storage (D) To provide essential functions and services during program execution 9. Which memory area grows upward during program execution? (A) Stack (B) Heap (C) Static memory (D) Code segment 10. Which memory area grows downward during program execution? (A) Stack (B) Heap (C) Data segment (D) Code segment 11. What is the role of a runtime type check? (A) Manage heap fragmentation (B) Optimize memory allocation (C) Allocate registers (D) Detect errors that cannot be determined at compile time 12. Which of the following is stored in static memory? (A) Global variables and constants (B) Local variables (C) Temporary computation results (D) Function call return addresses 13. What is the activation record’s relationship with the runtime environment? (A) It is irrelevant (B) It is stored in static memory only (C) Each activation record resides on the runtime stack for a function call (D) It is stored on the heap exclusively 14. Which mechanism handles dynamic memory allocation and deallocation during program execution? (A) Runtime environment (B) Compiler (C) Linker (D) Preprocessor 15. Which of the following can cause a runtime environment to fail? (A) Syntax errors (B) Missing semicolons (C) Typographical errors (D) Stack overflow 16. What is the purpose of a garbage collector in a runtime environment? (A) To remove syntax errors (B) To reclaim memory that is no longer in use (C) To store global variables (D) To optimize CPU instructions 17. What is the role of exception handling in a runtime environment? (A) To optimize compilation (B) To manage registers (C) To allocate heap memory (D) To catch and respond to errors during program execution 18. Which section of memory stores executable code in the runtime environment? (A) Stack (B) Text (code) segment (C) Heap (D) Data segment 19. What does a runtime check for array bounds prevent? (A) Accessing memory outside array limits (B) Heap overflow (C) Memory leaks (D) Stack allocation 20. Which part of the runtime environment is responsible for managing threads? (A) Stack (B) Heap (C) Static memory (D) Runtime system or OS kernel 21. What is the primary purpose of dynamic linking in a runtime environment? (A) To compile code (B) To check syntax (C) To resolve references to external functions and libraries at execution time (D) To optimize memory usage at compile time 22. Which type of memory allocation is best for variables with unknown lifetime? (A) Static memory (B) Stack memory (C) Code segment (D) Heap memory 23. What is a runtime stack frame also known as? (A) Activation record (B) Heap object (C) Static block (D) Code segment 24. Which runtime environment component is responsible for handling function calls and returns? (A) Heap allocator (B) Stack manager (C) Compiler (D) Linker 25. Which of the following is a runtime system service? (A) Lexical analysis (B) Dynamic memory management (C) Syntax parsing (D) Code generation 26. Which of the following is true about just-in-time (JIT) compilation in the runtime environment? (A) Converts code to machine code at compile time (B) Converts code to machine code during program execution (C) Replaces the stack memory (D) Eliminates the need for activation records 27. What is the primary function of a runtime monitor? (A) Compile source code (B) Track program execution and detect errors (C) Allocate static memory (D) Optimize code before execution 28. Which of the following can occur if a program exceeds the stack size during execution? (A) Syntax error (B) Garbage collection (C) Heap corruption (D) Stack overflow 29. What is the main advantage of having a runtime environment? (A) Enables compilation of code (B) Reduces code size (C) Replaces the compiler entirely (D) Provides services such as memory management, I/O handling, and error detection at execution 30. Which of the following is true about runtime memory organization? (A) Stack grows downward, heap grows upward (B) Stack and heap grow in the same direction (C) Stack is only for global variables (D) Heap is managed by compiler only