What is the first argument in command line arguments?
Answer: A
No answer description available for this question.
Enter details here
Comment on the following pointer declaration?
int *ptr, p;
Answer: A
No answer description available for this question.
Enter details here
What does argc and argv indicate in command-line arguments?
Answer: B
No answer description available for this question.
Enter details here
What does the first parameter of the main function represent?
Answer: A
The first argument of the main() function represents the number of command line arguments that are passed.
Enter details here
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
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
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
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
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
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