Question 1

Time: 00:00:00
Which of the following syntax is correct for command-line arguments?

int main(int var, char *argv[])

int main(int var, char *argv[])

int main(char *arv[], int arg)

int main(char *arv[], int arg)

int main(char c,int v)

int main(char c,int v)

int main(int v,char c)

int main(int v,char c)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
What does argv and argc indicate in int main(int argc, char *argv[]) ?

argument constant, argument variable

argument constant, argument variable

argument count, argument vector

argument count, argument vector

argument constant, argument vector

argument constant, argument vector

argument count, argument variable

argument count, argument variable

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
What type of array is generally generated in Command-line argument?

MultiDimensional Array

MultiDimensional Array

Jagged Array

Jagged Array

2-Dimensional Array

2-Dimensional Array

Single Dimensional Array

Single Dimensional Array

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
The maximum length of the command-line arguments including the spaces is

May vary from one OS to another

May vary from one OS to another

256 characters

256 characters

Depends on the Number of arguments

Depends on the Number of arguments

128 characters

128 characters

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
The index of the last argument in command line arguments is

argc

argc

argc * 2

argc * 2

argc – 1

argc – 1

argc + 1

argc + 1

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
What is the first argument of command line ?

File Name

File Name

Program Designation

Program Designation

argument passed by user

argument passed by user

Program Name

Program Name

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
What argv means in command line argument?

Array of pointers

Array of pointers

pointer to a character array

pointer to a character array

Array of character pointers

Array of character pointers

Array of Strings

Array of Strings

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
What will be the output of the following program if argument passed to command lines are : prog 1 4 2 #include<stdio.h> int main(int argc, char *argv[]) {     int j;     j = argv[1] + argv[2] – argv[3];     printf(“%d”, j);     return 0; }

 

Error

Error

3

3

Garbage Value

Garbage Value

None of these

None of these

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
What argv[0] and argv[1] denote in Command line Arguments ?

Pointers to first two command line argument supplied.

Pointers to first two command line argument supplied.

File Name and pointer to first command line argument supplied.

File Name and pointer to first command line argument supplied.

Program Name and Pointer to the 1st argument.

Program Name and Pointer to the 1st argument.

None of these.

None of these.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
Which one of these is equivalent to argc ?

Number of Arguments

Number of Arguments

Number of Arguments – 1

Number of Arguments – 1

Number of Arguments + 2

Number of Arguments + 2

Number of Arguments + 1

Number of Arguments + 1

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 11

Time: 00:00:00
What will be output of the following program  if argument passed to command lines are : prog 1 4 2

     #include<stdio.h>
     int main(int argc, char *argv[])
      {
             while(argc–)
                   printf(“%s\n”,argv[argc]);
            
        return 0;
      }

2 4 1

2 4 1

Garbage-value 2 4 1

Garbage-value 2 4 1

Garbage-value 2 4 1 prog

Garbage-value 2 4 1 prog

Infinte Loop

Infinte Loop

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 12

Time: 00:00:00
What will be output of the following program  if argument passed to command lines are  : demo one two three

#include<stdio.h>
int main(int argc, char *argv[])
  {
       printf(“%c\n”,**+argv);
    
     return 0;
  }

n

n

o

o

t

t

Compile time error

Compile time error

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 13

Time: 00:00:00
What will be output of the following program  if argument passed to command lines are  : demo friday

#include<stdio.h>
int main(int argc, char *argv[])
{
       printf(“%c”,*++argv[1]);
  
  return 0;
}

r

r

f

f

i

i

d

d

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Get over 200+ Courses under One Subscription

mute

Don’t settle Learn from the Best with PrepInsta Prime Subscription

Learn from Top 1%

One Subscription, For Everything

The new cool way of learning and upskilling -

Limitless Learning

One Subscription access everything

Job Assurance

Get Access to PrepInsta Placement Cell

Top Faculty

from FAANG/IITs/TOP MNC's

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Comments