0
0
Computer Networksknowledge~10 mins

IPv4 address structure in Computer Networks - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to show the number of bits in an IPv4 address.

Computer Networks
ipv4_bits = [1]
Drag options to blanks, or click blank then click option'
A128
B64
C32
D16
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing IPv4 with IPv6 bit length.
Choosing 64 or 128 bits which are for other protocols.
2fill in blank
medium

Complete the code to represent an IPv4 address as four decimal numbers separated by dots.

Computer Networks
ipv4_address = "[1].168.1.1"
Drag options to blanks, or click blank then click option'
A192
B256
C300
D500
Attempts:
3 left
💡 Hint
Common Mistakes
Using numbers greater than 255 in an IPv4 address.
Confusing decimal and binary representations.
3fill in blank
hard

Fix the error in the code that tries to split an IPv4 address into its parts.

Computer Networks
parts = ipv4_address.[1](".")
Drag options to blanks, or click blank then click option'
Ajoin
Bsplit
Creplace
Dappend
Attempts:
3 left
💡 Hint
Common Mistakes
Using join which combines strings instead of splitting.
Using replace which changes characters but does not split.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each octet string to its integer value.

Computer Networks
octet_values = {octet: int([1]) for octet in ipv4_address.[2](".")}
Drag options to blanks, or click blank then click option'
Aoctet
Bipv4_address
Csplit
Djoin
Attempts:
3 left
💡 Hint
Common Mistakes
Using join instead of split.
Trying to convert the whole address string instead of each octet.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps each octet to True if it is greater than 127, otherwise False.

Computer Networks
octet_flags = {octet: int(octet) [1] 127 for octet in ipv4_address.[2]("[3]")}
Drag options to blanks, or click blank then click option'
A>
Bsplit
C.
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' for the comparison.
Using wrong separator in split method.