For variable length records the record length must be specified at the
-
last 2 bytes of the record
-
First 2 bytes of the records
-
3rd and 4th bytes of the record
-
The record length will not be specified in the record
For variable-length records in file systems and data structures, the record length is typically stored at the beginning of the record (first 2 bytes) so the system knows how much data to read. This is a common pattern in binary file formats. Storing it at the end or middle would make it inefficient to locate.
For variable-length records in mainframe file formats (e.g. COBOL RECFM=V/VB), each record is prefixed with a Record Descriptor Word (RDW). The RDW occupies the first 4 bytes of the record, and it's specifically the first 2 bytes of that RDW that hold the binary record length; the next 2 bytes are reserved/flags. So the length is specified at the first 2 bytes of the record, matching the correct answer. It's not at the end, not at bytes 3-4, and it is always present for V-format records, ruling out the other options.