
Dynamic Memory Management MCQ Quiz
Authored by Nancy P
Computers
University
Used 4+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which call correctly allocates space for 50 integers?
int *p = malloc(50);
int *p = malloc(50 * sizeof(int));
int *p = calloc(sizeof(int), 50);
Both B and C
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Compared to malloc, calloc additionally:
Aligns memory
Initializes memory to zero
Allocates on the stack
Guarantees contiguous physical pages
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In a typical C program, how do the heap and stack grow in memory?
Both grow upwards
Both grow downwards
Stack grows downward, heap grows upward
Stack grows upward, heap grows downward
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a key difference between stack and heap memory allocation?
Stack is slower but dynamic; heap is faster and fixed
Stack is manual; heap is automatic
Stack is automatically managed; heap requires manual management
Heap variables are cleared on function exit
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which statement creates a pointer to a structure and allocates memory dynamically?
struct item *p = malloc(sizeof(struct item));
struct item p = malloc(sizeof(item));
item *p = new item;
struct item p; *p = malloc(sizeof(p));
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which is valid?
free(&x); where int x;
free(p); where p points to malloced memory
free(p+1); where p points to malloced memory
free((void*)0x1234);
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
realloc(p, 0) does:
Always equivalent to free(p) and returns NULL
Keeps memory unchanged
Undefined behavior
Returns pointer to a zero-sized usable block
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
ARKOM 2_INS
Quiz
•
University
13 questions
Week 2 Before Class
Quiz
•
University
15 questions
Unit 1 RDBMS MCQS
Quiz
•
University
11 questions
Digital Mindset
Quiz
•
University
13 questions
Chap 1: What is a program made of?
Quiz
•
University
10 questions
Arquitetura IPv6
Quiz
•
1st Grade - University
10 questions
Perkakasan Multimedia
Quiz
•
University
10 questions
Computing Paradigms
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade