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
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
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)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F655e5d67-ab19-404c-b883-3aa3c693f6a1%2Fa177437e-b8e3-44b8-884b-8ccc114f8b48%2Fonjfatr_processed.png&w=3840&q=75)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps

Recommended textbooks for you

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education