Consider the following program fragment that deals with a table T with 17 rows…

UGC NET 2023

Consider the following program fragment that deals with a table T with 17 rows and 1024 columns, computing an average for each column and printing it to screen (i is row index and j is column index):

for j = [0 … 1023] {
    temp = 0
    for i = [0 … 16] {
        temp = temp + T[i][j]
    }
    print (temp / 17.0);
}

T[i][j] and temp are 32-bit floating point values and memory is word addressable.
The temporary variable temp is kept in a processor register, so access to temp does not involve a memory reference.

The main memory is paged and holds 16 pages of size 1024 words.
The page replacement policy is Least Recently Used (LRU).

If T is stored in the virtual address space in row-major format, how many page faults will be encountered?

Assume that T starts at a page boundary and that none of its pages is initially resident in main memory.

  1. A.

    16,402

  2. B.

    17,408

  3. C.

    18,208

  4. D.

    18,608

Attempted by 104 students.

Sign up free to check your answer

Sign up free

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs

Loading lesson…