0
0
Computer Networksknowledge~10 mins

Subnetting and subnet masks 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 calculate the number of hosts in a subnet given the subnet mask bits.

Computer Networks
hosts = (2 ** (32 - [1])) - 2
Drag options to blanks, or click blank then click option'
A24
B26
C16
D30
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to subtract 2 for network and broadcast addresses.
Using the subnet mask bits directly instead of subtracting from 32.
2fill in blank
medium

Complete the code to find the subnet mask in dotted decimal notation from the number of mask bits.

Computer Networks
mask = [[1] for i in range(4)]
Drag options to blanks, or click blank then click option'
A0
B128
C192
D255
Attempts:
3 left
💡 Hint
Common Mistakes
Using 128 or 192 for all bytes instead of 255 for full bytes.
Confusing mask bits with decimal values.
3fill in blank
hard

Fix the error in the code to calculate the number of subnets given the borrowed bits.

Computer Networks
subnets = 2 ** [1]
Drag options to blanks, or click blank then click option'
Ahost_bits
Bborrowed_bits
Cmask_bits
Dnetwork_bits
Attempts:
3 left
💡 Hint
Common Mistakes
Using host bits or mask bits instead of borrowed bits.
Confusing network bits with borrowed bits.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps subnet numbers to their subnet masks in binary.

Computer Networks
subnet_masks = {n: bin(255 << (8 - [1])) for n in range([2])}
Drag options to blanks, or click blank then click option'
Aborrowed_bits
Bhost_bits
Csubnets
Dmask_bits
Attempts:
3 left
💡 Hint
Common Mistakes
Using host bits or mask bits incorrectly in the shift.
Using mask bits instead of number of subnets in range.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps subnet numbers to their broadcast addresses.

Computer Networks
broadcasts = {n: network_base + ([1] * n) + [2] for n in range([3])}
Drag options to blanks, or click blank then click option'
Asubnet_size
Bsubnet_size - 1
Cnumber_of_subnets
Dhost_bits
Attempts:
3 left
💡 Hint
Common Mistakes
Using host bits instead of subnet size.
Confusing number of subnets with host bits.