Top

Command Line Arguments

61.

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

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

 

Answer: A

No answer description available for this question.

Enter details here

62.

What is the output of this C code?

#include 
    void foo(int*);
    int main()
    {
        int i = 10, *p = &i;
        foo(p++);
    }
    void foo(int *p)
    {
        printf("%d\n", *p);
    }

 

Answer: A

No answer description available for this question.

Enter details here

63.

Which is an indirection operator among the following?

Answer: B

No answer description available for this question.

Enter details here

64.

Which of the following does not initialize ptr to null (assuming variable declaration of a as int a=0;

Answer: A

No answer description available for this question.

Enter details here

65.

What is the output of this C code?

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

 

Answer:

Enter details here

66.

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

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

 

Answer: A

No answer description available for this question.

Enter details here

67.

Every time we supply new set of values to the program at command prompt, we need to recompile the program.

Answer: B

No answer description available for this question.

Enter details here

68.

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

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

 

Answer: C

No answer description available for this question.

Enter details here

69.

What will be the output of this program (prg_1.c)?

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

 

Answer: B

No answer description available for this question.

Enter details here

70.

What is the output of this C code?

#include 
    int main()
    {
        int i = 10;
        void *p = &i;
        printf("%f\n", *(float*)p);
        return 0;
    }

 

Answer: D

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