← 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?
- A.At byte k
- B.At byte k * sizeof(Student)
- C.At line k
- 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 →