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

31. fclose () function can

  • Closes the stream
  • Flushes all unwritten data from the stream.
  • Discard all unread buffered input and free all allocated buffer.
  • All of the above
Show Answer Report

32. If an error occurs during closing of a file then fclose () returns

  • EOF
  • Zero
  • File pointer
  • None of these
Show Answer Report

33. File I/O functions

  • Contains functions to receive input from KB and write output to VDU.
  • Contains functions to perform I/O operations on hard disk.
  • Contains functions similalr to all operating system.
  • All of the above
Show Answer Report

34. Find the output #include "stdio.h" void main ( ) { int i=5; char x='x'; float y=3.9; char str[20]; sprint(str,"%d %c %f",i,x,y); printf("%s",str); }

  • x
  • 5 x 3.9
  • 5 x 3.90000
  • Compilation error
Show Answer Report

35. The commonly used functions for writing to a text stream are

  • putc( )
  • fputc( )
  • fputs( )
  • All of the above
Show Answer Report

36. in UNIX, file protection can be assigned at

  • user level
  • Group level
  • Other
  • All of the above
Show Answer Report

37. The sector size of a disk working in MS DOS envoronment is

  • 512 bytes
  • 256 bytes
  • 1024 bytes
  • None of these
Show Answer Report

38. The function read ( ) returns

  • Actual number of bytes transferredon successful reading
  • -1 if an EOF is found
  • 0 if an error occurs.
  • All of the above
Show Answer Report

39. Find out the output #include "fcnt1.h" #include"sys\stat.h" void main ( ) { int x; x=open ("raja.txt", 0_CREAT | _TEXT, S_TWRITE); printf ("%d", k); }

  • 5
  • 6
  • 7
  • None of these
Show Answer Report

40. State the correct statement.

  • fseek() only works with file handler
  • Iseek() only works with file pointer
  • close() closes the file pointer
  • None of these
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test