Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8847409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:11:02+00:00 2026-06-14T12:11:02+00:00

It is not a homework question. It came in my semester exam today. This

  • 0

It is not a homework question. It came in my semester exam today.

This code fragment computes the average of each table colum t[i][j] 0<=i<18 ; 0<=j<1024

for (j = 0; j < 1024; i++) {  
   temp = 0;  
   for (i = 0; i < 18; i++) {  
      temp += temp + t[i][j];  
   }  
   cout << temp/18;
}

Variables are 32-bit floating point values.

Variables i, j, temp are stored in processor register(so no need of memory reference to access temp. Main memory is word addressable and paged containing 17 frames, each of size 1024 words and one word is 4 bytes. Page replacement policy is LRU.

Determine the number of page faults to execute the given program fragment? Ans: 18432

How to compute it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:11:03+00:00Added an answer on June 14, 2026 at 12:11 pm
    int array[3][3] = {{0, 1, 2},
                      {3, 4, 5},
                      {6, 7, 8}};
    

    The layout of this array in memory is [0, 1, 2, 3, 4, 5, 6, 7, 8] which is

    array[0][0]
    array[0][1]
    array[0][2]
    array[1][0]
    array[1][1]
    array[1][2]
    array[2][0]
    array[2][1]
    array[2][2]
    

    Here the memory address difference between array[1][0] and array[2][0] is 3;

    So given an array a[18][1024]. The difference between a[i][j] and a[i+1][j] is 1024 bytes(The size of a page fault). So, each time your inner loop triggers that causes a page fault. Your inner loop triggers 18*1024 times(18432).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to solve this problem, its not a homework question, its just code
This is not a homework question, rather an exam study guide question. What is
This is not homework, just a question about my code (I'm learning C++). I
So this is not a homework question. It's a question from a previous exam
This is not a homework question, it is an exam preparation question. I should
This IS NOT a Homework question! While building my current student database project I
Firstly this is not a homework question. I am practicing my knowledge on java.
This is NOT a homework question, actually I am doing this for fun. Here
This is not a homework question, just something at work that's bugging me. I'm
This is an interview test question not homework. The test has been done. Which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.