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

Explore more Topics under C Programming

Q281.
What will be the output of the program in Turbo C?

#include<stdio.h>

int main(int argc, char *argv, char *env[])
{
    int i;
    for(i=1; i<argc; i++)
        printf("%s\n", env[i]);
    return 0;
}
Discuss
Answer: (a).List of all environment variables
Q282.
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample Jan Feb Mar

/* sample.c */
#include<stdio.h>
#include<dos.h>


int main(int arc, char *arv[])
{
    int i;
    for(i=1; i<_argc; i++)
        printf("%s ", _argv[i]);
    return 0;
}
Discuss
Answer: (c).Jan Feb Mar
Q283.
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample monday tuesday wednesday thursday

/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])
{
    while(--argc>0)
        printf("%s", *++argv);
    return 0;
}
Discuss
Answer: (b).monday tuesday wednesday thursday
Q284.
If the following program (myproc.c) is present in the directory "C:\TC" then what will be output of the program if run it from DOS shell?

/* myproc.c */
#include<stdio.h>

int main(int argc, char *argv[])
{
    printf("%s", argv[0]);
    return 0;
}
Discuss
Answer: (b).C:\TC\MYPROC.EXE
Q285.
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog one two three

/* myprog.c */
#include<stdio.h>


int main(int argc, char *argv[])
{
    int i;
    for(i=1; i<argc; i++)
        printf("%c", argv[i][0]);
    return 0;
}
Discuss
Answer: (b).ott
Q286.
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample 1 2 3
cmd> sample 2 2 3
cmd> sample 3 2 3

/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])
{
    printf("%s\n", argv[0]);
    return 0;
}
Discuss
Answer: (c).sample
Q287.
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog 1 2 3

/* myprog.c */
#include<stdio.h>
#include<stdlib.h>

int main(int argc, char **argv)
{
    int i, j=0;
    for(i=0; i<argc; i++)
        j = j+atoi(argv[i]);
    printf("%d\n", j);
    return 0;
}
Discuss
Answer: (b).6
Q288.
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample friday tuesday sunday

/* sample.c */
#include<stdio.h>

int main(int sizeofargv, char *argv[])
{
    while(sizeofargv)
        printf("%s", argv[--sizeofargv]);
    return 0;
}
Discuss
Answer: (c).sunday tuesday friday sample
Q289.
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample friday tuesday sunday

/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])
{
    printf("%c", *++argv[2] );
    return 0;
}

a.

s

b.

f

c.

u

d.

r

Discuss
Answer: (c).u
Q290.
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog 10 20 30

/* myprog.c */
#include<stdio.h>

int main(int argc, char **argv)
{
    int i;
    for(i=0; i<argc; i++)
        printf("%s\n", argv[i]);
    return 0;
}
Discuss
Answer: (c).myprog 10 20 30

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!