C Programming MCQ Questions and Answers

Practice Mode
Showing 10 of 25 questions
Q11
If fopen Q fails, it returns
  • A -1
  • B NULL
  • C 1
  • D the file pointer
Answer: Option B
Q12
The function fclose() is
  • A used to disconnect a program from file
  • B used to close a file logically
  • C both options a and b
  • D a mandatory function call in file handling
Answer: Option C
Q13
The action of connecting a program from a file is obtained by the function
  • A fclose()
  • B delete()
  • C fdisconnect()
  • D clear()
Answer: Option A
Q14
The value returned by fcloseQ, if an error occurs is
  • A 0
  • B 1
  • C EOF
  • D -1
Answer: Option C
Q15
The function(s) used for reading a character from a file is (are)
  • A getc()
  • B fgetc()
  • C both options an and b
  • D fgetcharo()
Answer: Option C
Q16
The function(s) used for writing a character to a file is (are)
  • A put()
  • B fputc()
  • C both options a and b
  • D fputcharQ
Answer: Option C
Q17
The function(s) used for reading formatted input data from a file is (are)
  • A getchar()
  • B fscanf()
  • C scanf()
  • D gets()
Answer: Option B
Q18
The function used for random access of a file is
  • A fseek()
  • B ftel()
  • C sarch()
  • D rewind()
Answer: Option A
Q19
What is the value of origin used in fseek(fptr,position, origin);? to represent end of file.
  • A 0
  • B 1
  • C 2
  • D EOF
Answer: Option C
Q20
What is the value of origin used in fssek(fptr, position, origin);? to represent the beginning of the file
  • A 0
  • B 1
  • C 2
  • D START
Answer: Option A
Questions and Answers for Competitive Exams Various Entrance Test