Log In Register

Units


Storage Management - Questions and Answers

 

Practice these Storage Management under C Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Storage Management for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Storage Management of C Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge C Programming specifically Storage Management.
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Storage Management under C Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Storage Management topic of C Programming:

 

1.

Why do we write (int *) before malloc?
    int *ip = (int *)malloc(sizeof(int));

Answer: Option C

Explanation:

2.

On freeing a dynamic memory, if the pointer value is not modified, then the pointer points to.

Answer: Option B

Explanation:

3.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct p
  3.     {
  4.         struct p *next;
  5.         int x;
  6.     };
  7.     int main()
  8.     {
  9.         struct p *p1 = calloc(1, sizeof(struct p));
  10.         p1->x = 1;
  11.         p1->next = calloc(1, sizeof(struct p));
  12.         printf("%d\n", p1->next->x);
  13.         return 0;
  14.     }

Answer: Option A

Explanation:

4.

In function free(p), p is a

Answer: Option A

Explanation:

5.

Which one is used during memory deallocation in C?

Answer: Option B

Explanation:

6.

void * malloc(size_t n) returns

Answer: Option C

Explanation:

7.

realloc(ptr, size), where size is zero means

Answer: Option C

Explanation:

8.

calloc initialises memory with all bits set to zero.

Answer: Option D

Explanation:

9.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         char *p = calloc(100, 1);
  5.         p = "welcome";
  6.         printf("%s\n", p);
  7.     }

Answer: Option B

Explanation:

10.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct p
  3.     {
  4.         struct p *next;
  5.         int x;
  6.     };
  7.     int main()
  8.     {
  9.         struct p* p1 = malloc(sizeof(struct p));
  10.         p1->x = 1;
  11.         p1->next = malloc(sizeof(struct p));
  12.         printf("%d\n", p1->next->x);
  13.         return 0;
  14.     }

Answer: Option B

Explanation:

11.

Memory allocation using malloc() is done in?

Answer: Option B

Explanation:

12.

For the following program, Which of the following should be used for freeing the memory allocated?

  1.     #include <stdio.h>
  2.     struct p
  3.     {
  4.         struct p *next;
  5.         int x;
  6.     };
  7.     int main()
  8.     {
  9.         struct p *p1 = (struct p*)malloc(sizeof(struct p));
  10.         p1->x = 1;
  11.         p1->next = (struct p*)malloc(sizeof(struct p));
  12.         return 0;
  13.     }

Answer: Option B

Explanation:

13.

calloc() returns a storage that is initialized to.

Answer: Option D

Explanation:

14.

The function ____ obtains block of memory dynamically.

Answer: Option B

Explanation:

15.

Which of the following will return a result most quickly for searching a given key?

Answer: Option A

Explanation: