NEW
Font size
WorksheetsPPL (QUIZ 6) Memory Management Quiz
Total questions: 20
Worksheet time: 10mins
What type of memory is allocated at compile time?
Stack
Heap
Static
Dynamic
Which memory allocation happens during function calls and is automatically freed after the function ends?
Heap
Static
Stack
Data Segment
In C++, which keyword is used to allocate memory on the heap?
malloc
alloc
new
make
What will likely happen if stack memory exceeds its limit?
OutOfMemoryError
Memory Leak
Garbage Collection
Stack Overflow
Which of the following is an example of static memory allocation?
Memory allocated using malloc
Local variables in a function
Global variables
Objects created using new
In Java, which mechanism handles heap memory automatically?
Pointer management
malloc()
Garbage Collection
Manual Deletion
What is the main risk of heap memory allocation if not managed properly?
Stack Overflow
Memory Leak
Compile Error
Buffer Underflow
Which of the following is true about stack memory?
Slower than heap
Has larger size than heap
Is shared among threads
Is thread-safe
Which technique is NOT used in garbage collection?
Reference Counting
Mark-and-Sweep
Paging
Generational GC
What function in Python forces garbage collection?
delete()
clean()
gc()
gc.collect()
Which of the following is a symptom of a memory leak?
Faster program speed
Decreased RAM usage
Increased RAM usage over time
Compile-time error
What type of memory does this code allocate to? `int *ptr = new int[10];`
Stack
Static
Heap
Data Segment
Smart pointers in C++ help prevent:
Stack overflows
Memory leaks
Compile errors
Garbage collection
Which of the following is automatically freed when the program ends?
Heap
Static
Stack
Data Segment
What is the main issue in heap memory?
Speed
Memory shortage
Memory fragmentation
Syntax error
Where is a function's local variable typically stored?
Static memory
Heap
Stack
Cache
In which language is garbage collection not automatic by default?
Java
Python
C++
Kotlin
Which part of memory stores global variables?
Heap
Static segment
Stack
Cache
What does `free(ptr);` do in C?
Allocates memory
Deletes global variable
Frees memory from heap
Reinitializes pointer
What memory area persists for the entire duration of the program?
Stack
Heap
Static
Cache
