nerdexam
Python_Institute

PCAP-31-03 · Question #105

You are going to read 16 bytes from a binary file into a bytearray called data. Which lines would you use? (Select two answers)

The correct answer is A. data = bytearray (16) bf.readinto (data) D. data = bytearray (binfile.read (16)). See the full explanation below for the reasoning.

Question

You are going to read 16 bytes from a binary file into a bytearray called data. Which lines would you use? (Select two answers)

Options

  • Adata = bytearray (16) bf.readinto (data)
  • Bdata = binfile.read (bytearray (16))
  • Cbf. readinto (data = bytearray (16))
  • Ddata = bytearray (binfile.read (16))

How the community answered

(18 responses)
  • A
    83% (15)
  • B
    11% (2)
  • C
    6% (1)

Community Discussion

No community discussion yet for this question.

Full PCAP-31-03 Practice