0
0
Computer Networksknowledge~10 mins

Classful addressing (Class A, B, C) 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 identify the class of an IP address based on its first octet.

Computer Networks
if 1 <= first_octet <= [1]:
    ip_class = 'A'
Drag options to blanks, or click blank then click option'
A127
B255
C126
D128
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 127 or 128 as the upper limit for Class A.
2fill in blank
medium

Complete the code to check if an IP address belongs to Class B based on its first octet.

Computer Networks
if [1] <= first_octet <= 191:
    ip_class = 'B'
Drag options to blanks, or click blank then click option'
A255
B192
C126
D128
Attempts:
3 left
💡 Hint
Common Mistakes
Using 192 as the lower bound instead of 128.
3fill in blank
hard

Fix the error in the code to correctly identify Class C IP addresses.

Computer Networks
if 192 <= first_octet <= [1]:
    ip_class = 'C'
Drag options to blanks, or click blank then click option'
A223
B224
C191
D255
Attempts:
3 left
💡 Hint
Common Mistakes
Using 224 or 255 as the upper limit for Class C.
4fill in blank
hard

Fill both blanks to complete the code that determines the class of an IP address based on its first octet.

Computer Networks
if first_octet >= [1] and first_octet <= [2]:
    ip_class = 'B'
Drag options to blanks, or click blank then click option'
A128
B191
C223
D126
Attempts:
3 left
💡 Hint
Common Mistakes
Using 126 or 223 as bounds for Class B.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps IP classes to their first octet ranges.

Computer Networks
ip_classes = {
    'A': (1, [1]),
    'B': ([2], [3]),
    'C': (192, 223)
}
Drag options to blanks, or click blank then click option'
A126
B128
C191
D224
Attempts:
3 left
💡 Hint
Common Mistakes
Using 127 or 224 in the ranges incorrectly.