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…

The correct answer is A. struct.unpack('>HH4s',a). You've hit your limit · resets 1pm (America/New_York)

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)

How the community answered

(30 responses)
  • A
    70% (21)
  • B
    3% (1)
  • C
    10% (3)
  • D
    17% (5)

Explanation

You've hit your limit · resets 1pm (America/New_York)

Topics

#struct module#binary unpacking#endianness#format strings

Community Discussion

No community discussion yet for this question.

Full GPYC Practice