Question 78Asked in BEL PE Computer Science, 20 Dec 2025 (5:00 PM)

Which statement correctly reads a string from a text file into a character array str?

  1. Aread(fp, str, sizeof(str));
  2. Bfscanf(fp, "%s", &str);
  3. Cfgetc(fp, str);
  4. Dfgets(str, sizeof(str), fp);
Show answerHide answer

Correct answer: (D) fgets(str, sizeof(str), fp);

From BEL PE Computer Science PYQ, 20 Dec 2025 (5:00 PM)

This is question 78 of BEL PE Computer Science PYQ, 20 Dec 2025 (5:00 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.