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

21. The modes of open ( ) command declare in

  • fcntr.h
  • sys.h
  • stat.h
  • stdio.h
Show Answer Report

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.
Show Answer Report

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
Show Answer Report

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
Show Answer Report

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
Show Answer Report

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.
Show Answer Report

27. Getw ( ) and putw() are

  • Character I/O
  • Integer I/O
  • Formatted I/O
  • String I/O
Show Answer Report

28. On successful execution of fputc() returns

  • An integer representing the character written
  • Current file position
  • Current cursor position
  • None of these
Show Answer Report

29. How many parameters sopen( )take

  • 2
  • 3
  • 4
  • 5
Show Answer Report

30. SH_DENYNO is declared in which header file ?

  • stat.h
  • share.h
  • sys.h
  • stdio.h
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test