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 12 of 13

Explore more Topics under C Programming

Q111.
Consider the following program. Where are i, j and k are stored in memory?
#include <stdio.h>
#include  <stdlib.h>
int i;
int main()
{
     int j;
    int *k = (int *) malloc (sizeof(int));
}
Discuss
Answer: (c).i is stored in BSS part of data segment, j is stored in stack segment. *k is stored on heap.
Q112.
Point out the error in the following program.
#include <stdio.h>
#include  <stdlib.h>
int main()
{
    char *ptr;
    *ptr = (char)malloc(30);
    strcpy(ptr, "RAM");
    printf("%s", ptr);
    free(ptr);
    return 0;
}
Discuss
Answer: (b).Error: in *ptr = (char)malloc(30);
Q113.
Where does the uninitialized data gets stored in memory?
Discuss
Answer: (c).BSS- Block started by symbol
Q114.
malloc() returns a NULL if it fails to allocate the requested memory.
Discuss
Answer: (a).True
Q115.
If malloc() successfully allocates memory it returns the number of bytes it has allocated.
Discuss
Answer: (b).False
Q116.
Can We increase the size of dynamically allocated array?
Discuss
Answer: (a).Yes
Q117.
Can we increase the size of statically allocated array?
Discuss
Answer: (b).No
Q118.
When we dynamically allocate memory is there any way to free memory during run time?
Discuss
Answer: (a).Yes
Q119.
What is the output of this program?
#include <stdio.h>
#include  <stdlib.h>
int main()
{
 struct test
 {
   int i;
   float f;
   char c;
 };
 struct test *ptr;
 ptr = (struct test *)malloc(sizeof(struct test));
 ptr ->f = 5.5f;
 printf("%f", ptr->f);
 return 0;
}
Discuss
Answer: (c).5.5
Q120.
Local variables are stored in an area called ___________
Discuss
Answer: (d).Stack

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!