3. Extract a Field Your program is receiving records from the network, formatted as described in the table below: Bytes 0 Bits 7 6 5 4 3 2 1 0765432107654321 0-3 4-7 8-11 12-15 source-id destination-id 1 size data r flag 2 pri 3 76543210 message-type data-routing The records are provided as byte arrays (or lists) such that the 'destination-id' field, for example, is contained in record [4] and Pick ONE option

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
ALL
O
>
3. Extract a Field
Your program is receiving records from the network, formatted as described in the table below:
Bytes
0-3
4-7
8-11
12-15
***
0
Bits 7 6 5 4 3 2
(record[2] & 0xF0) >> 4
(record[6] | OXF) >> 4
(record[2] >> 4) & 0x7
(record[2] & 0x7) << 1
10 765
destination-id
(record[6] & 0x70) >> 4
Clear Selection
source-id
1
2
43210 7 6 5 4 3
size
data
flag
2
10 7 6 5
message-type
The records are provided as byte arrays (or lists) such that the 'destination-id' field, for example, is contained in record [4] and record [5]. How would you go about extracting out the 'flag' field and returning its value?
Pick ONE option
pri
4
3
32 1 0
data-routing
(Alt + A)
Transcribed Image Text:ALL O > 3. Extract a Field Your program is receiving records from the network, formatted as described in the table below: Bytes 0-3 4-7 8-11 12-15 *** 0 Bits 7 6 5 4 3 2 (record[2] & 0xF0) >> 4 (record[6] | OXF) >> 4 (record[2] >> 4) & 0x7 (record[2] & 0x7) << 1 10 765 destination-id (record[6] & 0x70) >> 4 Clear Selection source-id 1 2 43210 7 6 5 4 3 size data flag 2 10 7 6 5 message-type The records are provided as byte arrays (or lists) such that the 'destination-id' field, for example, is contained in record [4] and record [5]. How would you go about extracting out the 'flag' field and returning its value? Pick ONE option pri 4 3 32 1 0 data-routing (Alt + A)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education