wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Memory allocation

Total questions: 8

Worksheet time: 4mins

Name
Class
Date
1.

Which header file is mandatory for DYNAMIC MEMORY ALLOCATION

a)

stdio.h

b)

math.h

c)

stdlib.h

d)

dos.h

2.

What is correct about calloc() function?

a)

Allocates the space for elements of an ARRAY

b)

initialize the elements to 0

c)

If the space is insufficient then return NULL pointer

d)

ALL of these

3.

calloc and malloc function is used for

a)

dynamic memory allocation

b)

static memory allocation

c)

Both static memory allocation and dynamic memory allocation

d)

ALL

4.

void * malloc(size_t n) returns

a)

Pointer to n bytes of uninitialized storage

b)

NULL if the request can be satisfied

c)

Nothing

d)

All

5.

Which of the following is static memory allocation

a)

Array

b)

stack

c)

linked list

d)

ALL

6.

In function free(p), p is a

a)

int

b)

Pointer returned by malloc()

c)

Pointer returned by calloc()

d)

Pointer returned by malloc() & calloc()

7.

Memory allocation using malloc() is done in?

a)

Static area

b)

Heap area

c)

Stack area

d)

Both Stack & Heap area

8.

Which one is used during memory deallocation in C?

a)

free(p);

b)

terminate(p);

c)

delete(p);

d)

remove(p);