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

Q11.
putchar(c) function/macro always outputs character c to the
Discuss
Answer: (b).standard output
Q12.
What is the output of this C code if
following commands are used to run(considering myfile exists)?
gcc -otest test.c
./test < myfile
#include <stdio.h>
    int main()
    {
        char c = 'd';
        putchar(c);
    }
Discuss
Answer: (c).d on the screen
Q13.
What is the output of this C code if
following commands are used to run(considering myfile exists)?
gcc -otest test.c
./test > myfile
#include <stdio.h>
    int main(int argc, char **argv)
    {
        char c = 'd';
        putchar(c);
        printf(" %d\n", argc);
    }
Discuss
Answer: (b).d 1 in myfile
Q14.
What is the output of this C code if
following commands are used to run and if myfile does not exist?
gcc -o test test.c
./test > myfile
#include <stdio.h>
    int main(int argc, char **argv)
    {
        char c = 'd';
        putchar(c);
        printf(" %d\n", argc);
    }
Discuss
Answer: (b).d 1 in myfile
Discuss
Answer: (a).prog to read characters from infile
Q16.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        int i = 10, j = 2;
        printf("%d\n", printf("%d %d ", i, j));
    }
Discuss
Answer: (d).10 2 5
Q17.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        int i = 10, j = 3;
        printf("%d %d %d", i, j);
    }
Discuss
Answer: (c).10 3 some garbage value
Q18.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        int i = 10, j = 3, k = 3;
        printf("%d %d ", i, j, k);
    }
Discuss
Answer: (c).10 3
Q19.
What is the output of this C code?
#include <stdio.h>
    int main()
    {
        char *s = "myworld";
        int i = 9;
        printf("%*s", i, s);
    }
Discuss
Answer: (b).myworld(note: spaces to the left of myworld)
Q20.
What is the output of this C code?
#include <stdio.h>
    int main(int argc, char** argv)
    {
        char *s = "myworld";
        int i = 3;
        printf("%10.*s", i, s);
    }
Discuss
Answer: (d).myw(note:6 spaces after myworld)
Page 2 of 42

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!