adplus-dvertising

Welcome to the Library Functions MCQs Page

Dive deep into the fascinating world of Library Functions with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Library Functions, a crucial aspect of C Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Library Functions, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Library Functions. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Library Functions. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Library Functions MCQs | Page 10 of 13

Explore more Topics under C Programming

Q91.
Which of the following statement is correct prototype of the malloc() function in c ?
Discuss
Answer: (d).void* malloc(size_t);
Q92.
Point out the correct statement which correctly free the memory pointed to by 's' and 'p' in the following program?
#include<stdio.h>
#include<stdlib.h>

int main()
{
    struct ex
    {
        int i;
        float j;
        char *s
    };
    struct ex *p;
    p = (struct ex *)malloc(sizeof(struct ex));
    p->s = (char*)malloc(20);
    return 0;
}
Discuss
Answer: (b).free(p->s); , free(p);
Q93.
Point out the correct statement which correctly allocates memory dynamically for 2D array following program?
#include<stdio.h>
#include<stdlib.h>

int main()
{
    int *p, i, j;
    /* Add statement here */
    for(i=0; i<3; i++)
    {
        for(j=0; j<4; j++)
        {
            p[i*4+j] = i;
            printf("%d", p[i*4+j]);
        }
    }
    return 0;
}
Discuss
Answer: (d).p = (int*) malloc(3*4*sizeof(int));
Q94.
What is the return type of malloc() or calloc()?
Discuss
Answer: (c).void *
Q95.
Which function is used to delete the allocated memory space?
Discuss
Answer: (b).free()
Q96.
Among 4 header files, which should be included to use the memory allocation functions like malloc(), calloc(), realloc() and free()?
Discuss
Answer: (b).#include<stdlib.h>
Discuss
Answer: (d).All of the above
Q98.
Which languages necessarily need heap allocation in the run time environment?
Discuss
Answer: (d).Those that allow dynamic data structures
Q99.
malloc() returns a float pointer if memory is allocated for storing float's and a double pointer if memory is allocated for storing double's.
Discuss
Answer: (b).False
Q100.
malloc() allocates memory from the heap and not from the stack.
Discuss
Answer: (a).True

Suggested Topics

Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!