C-Command Line Arguments Questions and Answers

Take Exam

Command line arguments in C allow passing values to a program at runtime through the main() function parameters argc and argv. This feature is essential for flexible and interactive program execution. Many programming questions and answers in coding interviews test this concept through practical applications and debugging scenarios. This section provides C command line argument questions with answers and explanations, helping learners strengthen their understanding of runtime input handling. These examples are useful for TCS, Tech Mahindra, and Wipro placement exams where efficiency and clarity of coding are tested.

C-Command Line Arguments

Showing 10 of 129 questions

111. What is the name of the active file pointer of file in Turbo C?

  • buffer
  • curp
  • istemp
  • level
Show Answer Report

112. The first argument argc in main () function counts

  • The no. of command line strings including the execution command.
  • the no.of command line strings excluding the execution command.
  • the no. of lines in a program
  • the no. of characters in a program.
Show Answer Report

113. The argument argv [] is used to

  • Count the no. of command line arguments.
  • pass strings to the programs including the execution command.
  • Pass strings to the programs excluding the execution command.
  • Both a and b
Show Answer Report

114. What is the file extension for font files?

  • .font
  • .txt
  • .bgi
  • .chr
Show Answer Report

115. puts(argv[0])

  • Prints the name of the source code file.
  • Prints argv
  • Prints the name of the executable code file
  • prints the number o command line arguments.
Show Answer Report

116. Which of the following header file must included to use functions with variable number of arguments?

  • vararg.h
  • stdlib.h
  • stdarg.h
  • All of the above
Show Answer Report

117. Find the output void main () { char s[ ] = '"rama"; strcpy(stdout,s); strcat (stdout,"shyama"); printf("%s",stdout); }

  • rama
  • shyama
  • ramashyama
  • None of these
Show Answer Report

118. Without function parameter as argudment counter, we can achieve argument counter using

  • extern int __argc;
  • extern int_argc;
  • extern int & argc;
  • None of the above
Show Answer Report

119. Stream oriented files are called as

  • Low level files
  • High level files
  • System oriented files
  • All of these
Show Answer Report

120. What type is argv?

  • char *
  • int
  • char **
  • None
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test