- What is command line argument?
- Are variables argc and argv are local to main?
- Does there exist any way to make the command line arguments available to other functions without passing them as arguments to function?
- Is there any way to expand any wildcard characters present in the commandl ine arguments? If yes state that?
- What is the maximum length of command line arguments including space between adjacent arguments?
- What is 'c, and 'v' in argc and argv stand for?
- What is the output of the following program?
#include < stdio.h >
int main(int argc,char *argv[])
{
int i;
argc=2;
argv[0]="";
argv[1]="I am a dog.Hope I am right";
printf("Number of Arguments passed=%d\n",argc);
for(i=0;i< argc;i++)
printf("argv[%d]=%s\n",i,argv[i]);
return;
} - Does the following program has any error or not?
#include < stdio.h >
int main(int argc,char *argv)
{
int x;
x=sum(argv[1],argv[2]);
printf("x=%d\n",x);
return;
}
int sum(int x,int y)
{
return x+y;
} - What type is argv?
A. char *
B. int
C. char **
D. It's not a variable
- What does the argument count variable store?
A. the number of arguments
B. the number of arguments plus one
C. the number of arguments minus one
D. The total size of the argument array
- In what order do the two command line variables appear in
the definition of main? A. Count then argument array
B. Argument array then count
C. They don't appear in the definition of main
D. There is only one argument.
- What is argv[0]?
A. The number of arguments to the program
B. The name of the program
C. The first argument to the program
D. This syntax is illegal
- What variables stores the number of arguments to a
program?
A. argc
B. argv
C count
D. arglen
Pages
The greatest mistake you can make in life is to be continually fearing you will make one
Thursday, 20 May 2010
Questions on Command Line Arguments
Labels:
C Questions
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment