0
0
Operating Systemsknowledge~10 mins

Paging concept and page tables in Operating Systems - Interactive Code Practice

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

Complete the code to define the size of a page in bytes.

Operating Systems
page_size = 2[1]12  # Page size is 2 to the power of 12 bytes
Drag options to blanks, or click blank then click option'
A*
B**
C//
D+
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' instead of '**' for exponentiation.
Using '//' which is integer division.
Using '+' which adds numbers instead of exponentiation.
2fill in blank
medium

Complete the code to calculate the number of pages given the total memory size.

Operating Systems
num_pages = total_memory_size [1] page_size
Drag options to blanks, or click blank then click option'
A//
B*
C+
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' which multiplies instead of dividing.
Using '+' or '-' which do not calculate pages correctly.
3fill in blank
hard

Fix the error in the code to correctly access the frame number from a page table entry.

Operating Systems
frame_number = page_table[page_number][1] 12
Drag options to blanks, or click blank then click option'
A>>
B-
C+
D<<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<<' which shifts bits left, increasing the number.
Using '+' or '-' which do not manipulate bits.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps page numbers to frame numbers for pages with even frame numbers.

Operating Systems
page_frame_map = {page: page_table[page] [1] 12 for page in range(num_pages) if (page_table[page] [2] 12) % 2 == 0}
Drag options to blanks, or click blank then click option'
A>>
B<<
C+
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<<' which shifts bits left incorrectly.
Using '+' or '-' which do not perform bit shifts.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps page numbers to frame numbers only if the frame number is greater than 1000.

Operating Systems
filtered_map = { [1] : page_table[[2]] [3] 12 for [2] in range(num_pages) if (page_table[[2]] [3] 12) > 1000 }
Drag options to blanks, or click blank then click option'
Apage
Bpage_number
C>>
D<<
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Using '<<' instead of '>>' for bit shifting.