Top

Command Line Arguments

Answer: B

No answer description available for this question.

Enter details here

22.

What will be the output of the following C statement? (assuming the input is “cool brother in city”)

printf(“%s\n”, argv[argc]);

 

Answer: A

No answer description available for this question.

Enter details here

23.

What is the output of this C code?

#include 
    void main()
    {
        int x = 0;
        int *ptr = &5;
        printf("%p\n", ptr);
    }

 

Answer: D

No answer description available for this question.

Enter details here

Answer: A

No answer description available for this question.

Enter details here

25.

In Turbo C/C++ under DOS if we want that any wild card characters in the command-line arguments should be appropriately expanded, are we required to make any special provision?

Answer: A

No answer description available for this question.

Enter details here

26.

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

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

 

Answer: C

No answer description available for this question.

Enter details here

27.

What will be the output of this program?

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

 

Answer: D

No answer description available for this question.

Enter details here

28.

What is the output of this C code?

#include 
    int main()
    {
        int i = 11;
        int *p = &i;
        foo(&p);
        printf("%d ", *p);
    }
    void foo(int *const *p)
    {
        int j = 10;
        *p = &j;
        printf("%d ", **p);
    }

 

Answer: A

No answer description available for this question.

Enter details here

29.

What is the output of this C code?

#include 
    int x = 0;
    void main()
    {
        int *const ptr = &x;
        printf("%p\n", ptr);
        ptr++;
        printf("%p\n ", ptr);
    }

 

Answer: B

No answer description available for this question.

Enter details here

30.

If the different command line arguments are supplied at different times would the output of the following program change?

#include

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

 

Answer: B

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