Top

Command Line Arguments

11.

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

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

 

Answer: B

No answer description available for this question.

Enter details here

Answer: B

No answer description available for this question.

Enter details here

Answer: C

No answer description available for this question.

Enter details here

Answer: D

Any of the above signature can be used while using command line arguments in C++ programs.

Enter details here

15.

What is the output of this C code?

#include 
    int main()
    {
        int i = 97, *p = &i;
        foo(&p);
        printf("%d ", *p);
        return 0;
    }
    void foo(int **p)
    {
        int j = 2;
        *p = &j;
        printf("%d ", **p);
    }

 

Answer: A

No answer description available for this question.

Enter details here

16.

What will be the output of the program (sample.c) given below if it is executed from the command line (Turbo C in DOS)?
cmd> sample 1 2 3

/* sample.c */
#include

int main(int argc, char *argv[])
{
    int j;
    j = argv[1] + argv[2] + argv[3];
    printf("%d", j);
    return 0;
}

 

Answer: C

No answer description available for this question.

Enter details here

Answer: C

No answer description available for this question.

Enter details here

18.

The maximum combined length of the command-line arguments including the spaces between adjacent arguments is

Answer: D

No answer description available for this question.

Enter details here

19.

What will be the output of the following C code (run without any command line arguments)?

#include 
    int main(int argc, char *argv[])
    {
        while (argc--)
        printf("%s\n", argv[argc]);
        return 0;
    }

 

Answer: B

No answer description available for this question.

Enter details here

20.

What will be the output of the program (sample.c) given below if it is executed from the command line (turbo c under DOS)?
cmd> sample Good Morning

/* sample.c */
#include

int main(int argc, char *argv[])
{
    printf("%d %s", argc, argv[1]);
    return 0;
}

 

Answer: A

No answer description available for this question.

Enter details here

Loading…
Tags: Command Line Arguments Questions and Answers || Command Line Arguments MCQ Questions and Answers || Command Line Arguments GK Questions and Answers || Command Line Arguments GK MCQ Questions || Command Line Arguments Multiple Choice Questions and Answers || Command Line Arguments GK || GK on Command Line Arguments || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming