Q.1

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\n", argv[argc]);
    return}
  • Yes
  • No
Q.2

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
Q.3

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

  • True
  • False
Q.4

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
Q.5

Even if integer/float arguments are supplied at command prompt they are treated as strings.

  • True
  • False
Q.6

The first argument to be supplied at command-line must always be count of total arguments.

  • True
  • False
Q.7

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
Q.8

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
Q.9

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=i<argc; i++)
        printf("%s\n", argv[i]);
    return
}
  • *.c
  • "*.c"
  • sample *.c
  • List of all files and folders in the current directory
Q.10

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\n", argv[0]);
    return}
  • sample 3 2 3
  • sample 1 2 3
  • sample
  • Error
Q.11

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\n", argv[argc-1]);
    return
}
  • 0
  • sample
  • samp
  • No output
Q.12

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=    for(i=i<argc; i++)
        j = j+atoi(argv[i]);
    printf("%d\n", j);
    return}
  • 123
  • 6
  • Error
  • "123"
Q.13

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=i<=i++)
        printf("%u\n", &argv[i]);
    return}

If the first value printed by the above program iswhat will be the rest of output?

  • 65525 65531
  • 65519 65521
  • 65517 65517
  • 65521 65525
Q.14

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=i<argc; i++)
        printf("%s\n", env[i]);
    return}
  • 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()
Q.15

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\n", **++argv);
    return}
  • myprog one two three
  • myprog one
  • o
  • two
Q.16

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
Q.17

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
Q.18

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}
  • s
  • f
  • sample
  • friday
Q.19

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}
  • sample friday tuesday sunday
  • sample friday tuesday
  • sunday tuesday friday sample
  • sunday tuesday friday
Q.20

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=i<_argc; i++)
        printf("%s ", _argv[i]);
    return}
  • No output
  • sample Jan Feb Mar
  • Jan Feb Mar
  • Error
0 h : 0 m : 1 s