Top

Command Line Arguments

Answer: A

No answer description available for this question.

Enter details here

Answer: A

No answer description available for this question.

Enter details here

Answer: B

No answer description available for this question.

Enter details here

Answer: A

The first argument of the main() function represents the number of command line arguments that are passed.

Enter details here

35.

What will be the output of the following C code (if run with no options or arguments)?

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

 

Answer: B

No answer description available for this question.

Enter details here

36.

Does there exist any way to make the command-line arguments available to other functions without passing them as arguments to the function?

Answer: A

No answer description available for this question.

Enter details here

37.

Which character is used to separate different arguments?

Answer: C

Command line arguments are separated by space. So if you write
./output This is a single parameter
then they will interpreted as 5 command line arguments as shown : [“./output”, “This”, “is”, “single”, “parameter”].

Enter details here

38.

What is the output of this C code?

#include 
    int *f();
    int main()
    {
        int *p = f();
        printf("%d\n", *p);
    }
    int *f()
    {
        int j = 10;
        return &j;
    }

 

Answer: A

No answer description available for this question.

Enter details here

39.

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
#include

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

 

Answer: B

No answer description available for this question.

Enter details here

40.

What is the output of this C code?

#include 
    int main()
    {
        char *p = NULL;
        char *q = 0;
        if (p)
            printf(" p ");
        else
            printf("nullp");
        if (q)
            printf("q\n");
        else
            printf(" nullq\n");
    }

 

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