C-Command Line Arguments Questions and Answers

Practice Mode
Showing 10 of 129 questions
Q121
Find the output void main ( ) { char s[10]; int x=256; sprintf(s, "%d",x); printf("%s",s); }
  • A 0
  • B 256
  • C Garbage
  • D NULL
Answer: Option B
Q122
How would you insert pre-written code into a file
  • A #include <file>
  • B #input<file>
  • C #insert file
  • D #pre
Answer: Option A
Q123
Program name in command line argument is
  • A First argument
  • B Last argument
  • C Not part of command line
  • D None of these
Answer: Option A
Q124
Argument counter in commandline argument is of type
  • A int
  • B char
  • C float
  • D void
Answer: Option A
Q125
In command line argument coammands are treated as
  • A internal commands
  • B external commands
  • C Both internal and external
  • D None of the above
Answer: Option B
Q126
What is the output if execute the command with following parameter/ C:\ compress letter.txt<u> Compress</u> main (int x,chart *p[ ] ) { printf(&quot;%d&quot;, x); }
  • A 1
  • B 3
  • C 2
  • D 0
Answer: Option C
Q127
Find the output if command is given command 10 20 30 40 main (int x, char *y [ ] ) { int sum=0; int r,i; for (i=0;i&lt;x;i++) { r=atoi(y[i]); sum=sum+r; } printf(&quot;%d&quot;,sum); }
  • A 10
  • B 100
  • C 1000
  • D None of above
Answer: Option B
Q128
Find the output main (int x, char*y[ ] , char *z[ ] ) { int i =0; while (z[i]) { printf(&quot;%s&quot;, z[i]; i++; } }
  • A print list of environment variables
  • B Print list of command line arguments
  • C Count number of command lines
  • D None of the above
Answer: Option A
Q129
Which of the following is true in argument vector
  • A it is an array of pointers
  • B it is an array of strings
  • C It is an array of integers
  • D None of the above
Answer: Option B
Questions and Answers for Competitive Exams Various Entrance Test