C-Command Line Arguments Questions and Answers
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
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.
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
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.
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
117. Find the output void main () { char s[ ] = '"rama"; strcpy(stdout,s); strcat (stdout,"shyama"); printf("%s",stdout); }
- rama
- shyama
- ramashyama
- None of these
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
119. Stream oriented files are called as
- Low level files
- High level files
- System oriented files
- All of these