🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: File Handling in C++: all 10 questions

Quiz: File Handling in C++ · Question 8 of 10

In a binary file of fixed-size Student records, where does record number k (counting from 0) start?

In a binary file of fixed-size Student records, where does record number k (counting from 0) start?

  1. A.At byte k
  2. B.At byte k * sizeof(Student)
  3. C.At line k
  4. D.At byte sizeof(Student) / k
Answer & explanation

Correct answer: At byte k * sizeof(Student)

Every record takes exactly sizeof(Student) bytes, so seekg(k * sizeof(Student)) jumps to it.

Can you get the rest right without peeking?

Take the timed Quiz: File Handling in C++ quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →