0
0
Computer Networksknowledge~10 mins

Flow control (stop-and-wait, sliding window) 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 flow control method where the sender waits for an acknowledgment after sending each frame.

Computer Networks
if sender_waits_for_ack == [1]:
    method = "Stop-and-Wait"
Drag options to blanks, or click blank then click option'
ATrue
BFalse
CMaybe
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing False because they think the sender sends frames continuously.
Selecting None or Maybe as they are not boolean values.
2fill in blank
medium

Complete the code to calculate the window size in sliding window flow control given the sequence number bits.

Computer Networks
window_size = 2[1] - 1
Drag options to blanks, or click blank then click option'
A**2
B**3
C**5
D**4
Attempts:
3 left
💡 Hint
Common Mistakes
Using addition instead of exponentiation.
Forgetting to subtract 1 from the power of 2.
3fill in blank
hard

Fix the error in the code that checks if the sender can send more frames in sliding window protocol.

Computer Networks
if frames_sent < [1]:
    can_send = True
else:
    can_send = False
Drag options to blanks, or click blank then click option'
Awindow_size - 1
Bwindow_size + 1
Cwindow_size
Dwindow_size * 2
Attempts:
3 left
💡 Hint
Common Mistakes
Adding or subtracting 1 incorrectly from window size.
Multiplying window size by 2 which is not correct.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps frame numbers to their acknowledgment status if the frame number is less than the window size.

Computer Networks
{frame_num: status for frame_num, status in frames.items() if frame_num [1] window_size and status [2] 'sent'}
Drag options to blanks, or click blank then click option'
A<
B==
C!=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '<' for frame number comparison.
Using '!=' instead of '==' for status comparison.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps sequence numbers (mod window size) to frame data for frames with status 'acknowledged'.

Computer Networks
{(frame_num [1] window_size): data for frame_num, (data, status) in frames.items() if status [2] 'acknowledged' and frame_num [3] window_size}
Drag options to blanks, or click blank then click option'
A%
B==
C<
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using subtraction (-) instead of modulo (%).
Using '!=' instead of '==' for status check.
Using '>' instead of '<' for frame number filtering.