The maximum combined length of the command-line arguments including the spaces between adjacent arguments is

128 characters
256 characters
67 characters
It may vary from one operating system to another
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<stdio.h>

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

myprog one two three
myprog one
o
two
Which of the following is TRUE about argv?

It is an array of character pointers
It is a pointer to an array of character pointers
It is an array of strings
None of above
Every time we supply new set of values to the program at command prompt, we need to recompile the program.

True
False
In Turbo C/C++ under DOS if we want that any wild card characters in the command-line arguments should be appropriately expanded, are we required to make any special provision?

Yes
No
According to ANSI specifications which is the correct way of declaring main when it receives command-line arguments?

int main(int argc, char *argv[])
int main(argc, argv)
int argc; char *argv;
int main()
{
    int argc; char *argv;
}
None of above
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<stdio.h>
#include<stdlib.h>

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

myprog
one
two
three
Which of the following statements are FALSE about the below code?
int main(int ac, char *av[])
{
}

ac contains count of arguments supplied at command-line
av[] contains addresses of arguments supplied at a command line
In place of ac and av, argc and argv should be used.
The variables ac and av are always local to main()
Even if integer/float arguments are supplied at command prompt they are treated as strings.

True
False
If the different command line arguments are supplied at different times would the output of the following program change?
#include<stdio.h>

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

Yes
No
What do the 'c' and 'v' in argv stands for?

'c' means argument control 'v' means argument vector
'c' means argument count 'v' means argument vertex
'c' means argument count 'v' means argument vector
'c' means argument configuration 'v' means argument visibility
What will be the output of the program (sample.c) given below if it is executed from the command line (Turbo C in DOS)?
cmd> sample 1 2 3
/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])
{
    int j;
    j = argv[1] + argv[2] + argv[3];
    printf("%d", j);
    return 0;
}

6
sample 6
Error
Garbage value
The first argument to be supplied at command-line must always be count of total arguments.

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

Yes
No
What will be the output of the program (sample.c) given below if it is executed from the command line (turbo c under DOS)?
cmd> sample Good Morning
/* sample.c */
#include<stdio.h>

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

3 Good
2 Good
Good Morning
3 Morning
What will be the output of the program
#include<stdio.h>
void fun(int);

int main(int argc)
{
    printf("%d", argc);
    fun(argc);
    return 0;
}
void fun(int i)
{
    if(i!=4)
        main(++i);
}

1 2 3
1 2 3 4
2 3 4
1
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample "*.c"
/* sample.c */
#include<stdio.h>

int main(int argc, int *argv)
{
    int i;
    for(i=1; i<argc; i++)
        printf("%s", argv[i]);
    return 0;
}

*.c
"*.c"
sample *.c
List of all files and folders in the current directory
What will be the output of the program if it is executed like below?
cmd> sample
/* sample.c */
#include<stdio.h>

int main(int argc, char **argv)
{
    printf("%s", argv[argc-1]);
    return 0;
}

0
sample
samp
No output
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<stdio.h>

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

s
f
sample
friday
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog friday tuesday sunday
/* myprog.c */
#include<stdio.h>

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

r
f
m
y
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample one two three
/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])
{
    int i=0;
    i+=strlen(argv[1]);
    while(i>0)
    {
        printf("%c", argv[1][--i]);
    }
    return 0;
}

three two one
owt
eno
eerht
What will be the output of the program in Turbo C?
#include<stdio.h>

int main(int argc, char *argv, char *env[])
{
    int i;
    for(i=1; i<argc; i++)
        printf("%s", env[i]);
    return 0;
}

List of all environment variables
List of all command-line arguments
count of command-line arguments
Error: cannot have more than two arguments in main()
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample Jan Feb Mar
/* sample.c */
#include<stdio.h>
#include<dos.h>

int main(int arc, char *arv[])
{
    int i;
    for(i=1; i<_argc; i++)
        printf("%s ", _argv[i]);
    return 0;
}

No output
sample Jan Feb Mar
Jan Feb Mar
Error
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample monday tuesday wednesday thursday
/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])
{
    while(--argc>0)
        printf("%s", *++argv);
    return 0;
}

sample monday tuesday wednesday thursday
monday tuesday wednesday thursday
monday tuesday thursday
tuesday
If the following program (myproc.c) is present in the directory "C:TC" then what will be output of the program if run it from DOS shell?
/* myproc.c */
#include<stdio.h>

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

SAMPLE.C
C:TCMYPROC.EXE
C:TC
Error
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<stdio.h>

int main(int argc, char *argv[])
{
    int i;
    for(i=1; i<argc; i++)
        printf("%c", argv[i][0]);
    return 0;
}

oot
ott
nwh
eoe
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample 1 2 3
cmd> sample 2 2 3
cmd> sample 3 2 3
/* sample.c */
#include<stdio.h>

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

sample 3 2 3
sample 1 2 3
sample
Error
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog 1 2 3
/* myprog.c */
#include<stdio.h>
#include<stdlib.h>

int main(int argc, char **argv)
{
    int i, j=0;
    for(i=0; i<argc; i++)
        j = j+atoi(argv[i]);
    printf("%d", j);
    return 0;
}

123
6
Error
"123"
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<stdio.h>

int main(int sizeofargv, char *argv[])
{
    while(sizeofargv)
        printf("%s", argv[--sizeofargv]);
    return 0;
}

sample friday tuesday sunday
sample friday tuesday
sunday tuesday friday sample
sunday tuesday friday
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<stdio.h>

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

s
f
u
r
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog 10 20 30
/* myprog.c */
#include<stdio.h>

int main(int argc, char **argv)
{
    int i;
    for(i=0; i<argc; i++)
        printf("%s", argv[i]);
    return 0;
}

10 20 30
myprog 10 20
myprog 10 20 30
10 20
What will be the output of the program ?
#include<stdio.h>

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

0
5
Garbage value
Error
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<stdio.h>
#include<stdlib.h>

int main(int argc, char **argv)
{
    int i;
    for(i=1; i<=3; i++)
        printf("%u", &argv[i]);
    return 0;
}

If the first value printed by the above program is 65517, what will be the rest of output?


65525 65531
65519 65521
65517 65517
65521 65525