C-Command Line Arguments Questions and Answers

Practice Mode
Showing 10 of 129 questions
Q41
State the correct statement
  • A fclose() don't flush any unwritten data for the associated file.
  • B it is good practice to explicity use fclose() to close files that you have opened.
  • C fopen() automatically creates the bufer area in memory.
  • D Both b & c.
Answer: Option D
Q42
fclose () don't flush any unwritten data for the associated file.
  • A 13
  • B 26
  • C 27
  • D None of these
Answer: Option B
Q43
Find the output #include"stdio.h" void main ( ) { FILE *p; char *ch; ch="Welcome to puri"; p=fopen(raja.txt",'w"); fprintf(p, "%s",ch); fclose(p); p=fopen("raja.txt","r"); fflush(p); fscanf(p,"%s",ch); printf("%s",ch); }
  • A Welcome
  • B Welcome to puri
  • C Compilation error
  • D No output
Answer: Option A
Q44
If the file name is aaa and type from the command prompt aaa xxx yyy zzz then the following program prints xxx yyy and zzz. Which of the following option is true. #jinclude <stdio.h> int main (int argc, char *argv[]) { int x; printf(%d\n", argc); for (x=; x<argc; x++) printf(%s\n", argv[x]); return 0; }
  • A xxx is the 1st command line argument and yyy would be the second command line argument
  • B aaa is the 1st command line argument
  • C aaa xx yyy zzz is the 1st command line argument
  • D None of the above
Answer: Option B
Q45
Tthe contents of a file will be lost if it is opened in
  • A a mode
  • B a- mode
  • C w+ mode
  • D a+ mode
Answer: Option C
Q46
Which of the following command is used to access file randomly ?
  • A ftell()
  • B fseek()
  • C fgets()
  • D None of these
Answer: Option B
Q47
A stream can be thougght of as
  • A A system call
  • B A library function
  • C Both a and b
  • D A source or sink of data associated with disk or their devicesd
Answer: Option D
Q48
State the correct statement.
  • A fgets() read a line of string from a keyboard.
  • B gets () read a line of string from a file.
  • C fgets() takes two arguments.
  • D None of these
Answer: Option D
Q49
The function ftell(fp) returns
  • A the beginning position of the file represented by fp.
  • B the end position o the file represented by fp.
  • C The current position of the file represented by fp.
  • D None of these
Answer: Option C
Q50
The function ftell(fp) returns
  • A The beginning position of the file reresented by fp.
  • B The end position of the file represented by fp
  • C the current position of the file represented by fp.
  • D None of these
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test