nerdexam
GIAC

GPYC · Question #22

A log file is stored in variable "a". The file has the following format for each log entry, in order, stored in big endian: Field 1: 2-byte integer Field 2: 2-byte integer Field 3: 4-byte string…

Sign in or unlock GPYC to reveal the answer and full explanation for question #22. The question stem and answer options stay visible for context.

File System & Data Management

Question

A log file is stored in variable "a". The file has the following format for each log entry, in order, stored in big endian: Field 1: 2-byte integer Field 2: 2-byte integer Field 3: 4-byte string Which of the following would unpack a line from the log file into the proper fields?

Options

  • Astruct.unpack('>HH4s',a)
  • Bstmct.unpack('<HHsss',a)
  • Cstruct.unpack('>HHHH',a)
  • Dstrnct.unpack('!BxBx4s',a)

Unlock GPYC to see the answer

You've previewed enough free GPYC questions. Unlock GPYC for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#struct module#binary unpacking#endianness#format strings
Full GPYC Practice