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
22. The 'w' mode of fopen( )
- it returns 0 if disk spce isavailable.
- it returns 1 if disk space is available.
- it returns offset address if disk space is available.
- None of these.
23. the process of establishing a connection between the program and a file is called
- Opening a stream
- Opening a file
- Creating a file
- All of the above
24. the mode "ab+" is used as
- To open a binary file
- to open a binary file in append mode.
- To open a binary file in write mode
- None of these
25. What this code do? #include "stdio.h" void main ( ) { FILE *p; p=fopen("xyz.txt",'w'); }
- This can open xyz text file in write mode
- This can open xyz text file in write mode and append at the end
- This can open xyz text file in read mode
- Compilation error
26. The mode "r+" can be used as
- To read, write and modiy existing data of a text file.
- to read, write and modify existing data of a binary file.
- Only to read the text file.
- Only to read the binary file.
28. On successful execution of fputc() returns
- An integer representing the character written
- Current file position
- Current cursor position
- None of these