adplus-dvertising

Welcome to the Input and Output in C MCQs Page

Dive deep into the fascinating world of Input and Output in C with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Input and Output in C, a crucial aspect of C Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Input and Output in C, 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 Input and Output in C. 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 Input and Output in C. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Input and Output in C MCQs | Page 10 of 42

Q91.
What is the output of this C code?
#include <stdio.h>
    #include <string.h>
    int main()
    {
        char line[3];
        fgets(line, 3, stdin);
        printf("%d\n", strlen(line));
        return 0;
    }
Discuss
Answer: (b).1
Q92.
What is the output of this C code?
#include <stdio.h>
    #include <string.h>
    int main()
    {
        char line[3];
        FILE *fp;
        fp = fopen("newfile.txt", "r");
        while (fgets(line, 3, fp))
        fputs(line, stdout);
        return 0;
    }
Discuss
Answer: (c).Segmentation fault
Q93.
What is the output of this C code if 2 character is typed by the user?
#include <stdio.h>
    #include <string.h>
    int main()
    {
        char line[3];
        fgets(line, 3, stdin);
        printf("%d\n", line[2]);
        return 0;
    }
Discuss
Answer: (c).0
Q94.
fputs adds newline character
Discuss
Answer: (b).False
Q95.
puts function adds newline character
Discuss
Answer: (a).True
Q96.
gets function checks overflow run
Discuss
Answer: (b).False
Discuss
Answer: (d).Adds ‘n’ to the line written
Q98.
What is the size of array “line” used in fgets(line, maxline, *fp) function?
Discuss
Answer: (b).maxline
Discuss
Answer: (d).When an error occurs
Q100.
Identify X library function for line input and output?
#include <stdio.h>
    int X(char *s, FILE *iop)
    {
        int c;
        while (c = *s++)
        putc(c, iop);
        return ferror(iop) ? EOF : 0;
    }
Discuss
Answer: (d).fputs

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!