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 23 of 42

Explore more Topics under C Programming

Q221.
Determine Output:
void main()
{
      int i=10;
      i=!i>14;
      printf("i=%d", i);
}
Discuss
Answer: (c).0
Q222.
Determine Output:
void main()
{
      int c = - -2;
      printf("c=%d", c);
}
Discuss
Answer: (c).2
Q223.
Determine Output:
#define int char
void main()
{
      int i = 65;
      printf("sizeof(i)=%d", sizeof(i));
}
Discuss
Answer: (b).sizeof(i)=1
Q224.
In a file contains the line "I am a boy\r\n" then on reading this line into the array str using fgets(). What will str contain?
Discuss
Answer: (c)."I am a boy\n\0"
Q225.
What is the purpose of "rb" in fopen() function used below in the code?
FILE *fp;
fp = fopen("source.txt", "rb");
Discuss
Answer: (a).open "source.txt" in binary mode for reading
Q226.
What does fp point to in the program ?
#include<stdio.h>

int main()
{
    FILE *fp;
    fp=fopen("trial", "r");
    return 0;
}
Discuss
Answer: (b).A structure which contains a char pointer which points to the first character of a file
Q227.
Which of the following operations can be performed on the file "NOTES.TXT" using the below code?
FILE *fp;
fp = fopen("NOTES.TXT", "r+");
Discuss
Answer: (d).Read and Write
Q228.
To print out a and b given below, which of the following printf() statement will you use?
#include<stdio.h>

float a=3.14;
double b=3.14;
Discuss
Answer: (a).printf("%f %lf", a, b);
Q229.
Which files will get closed through the fclose() in the following program?
#include<stdio.h>

int main()
{
    FILE *fs, *ft, *fp;
    fp = fopen("A.C", "r");
    fs = fopen("B.C", "r");
    ft = fopen("C.C", "r");
    fclose(fp, fs, ft);
    return 0;
}
Discuss
Answer: (d).Error in fclose()
Q230.
On executing the below program what will be the contents of 'target.txt' file if the source file contains a line "To err is human"?
#include<stdio.h>

int main()
{
    int i, fss;
    char ch, source[20] = "source.txt", target[20]="target.txt", t;
    FILE *fs, *ft;
    fs = fopen(source, "r");
    ft = fopen(target, "w");
    while(1)
    {
        ch=getc(fs);
        if(ch==EOF)
            break;
        else
        {
            fseek(fs, 4L, SEEK_CUR);
            fputc(ch, ft);
        }
    }
    return 0;
}
Discuss
Answer: (b).Trh

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!