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
71. To flush all output streams we can write
- fflush(stdout)
- fflush(NULL)
- fflush(ALL)
- None of these
72. Which of the following function is appropriate to read one character at a time ?
- fscanf()
- fgetc()
- read()
- fgets()
73. In what order do the two command line variablesl appear in the definition of main ?
- Count then argument array
- Argument array then count
- They don't appear in the definition of main
- There is only one argument.
74. The function unlik (filename) is used
- to remove link between file and buffer
- To remove the existing file from the directory
- To remove the contents of file only
- None of these
75. Which of the following function return NULL on end of the file ?
- fgetc()
- getw()
- fprintf()
- fgets()
76. O_CREAT command can
- Create new text file if not exist.
- Does not create new text file if not exist.
- If text file exist then overwrite it.
- None of these
77. Opening of file stream means
- An action of connecting buffer to device
- An action of connecting program to buffer
- File processing
- None of these
78. What does the argument count variable store ?
- The number of arguments
- The number of arguments plus one
- The number of arguments minus one
- The total size of the argument array
79. Find the output #include"stdio.h" void main ( ) { FILE *fp; int x; fp=fopen("xyz.txt","w"); x=fprintf(fp, "%d%d", 1, 2, 3); printf("%d" ,x); }
- 1
- 2
- 3
- None of these
80. Which of the following command directly writes into disk file ?
- fwrite()
- write()
- Both a and b
- None of these