What Will Be The Output Of The Following Code In Javap Pre #370

What will be the output of the following code in java?</p> <pre><code class="language-java"> import java.util.ArrayList; public class LRU { public static void main(String[] args) { int page_frame = 3; int page_ref_string[] = {1, 2, 4, 1, 0, 3, 2, 0, 5, 4}; ArrayList<Integer> s=new ArrayList<>(page_frame); int count=0; int page_faults=0; for(int i:page_ref_string) { if(!s.contains(i)) { if(s.size()==page_frame) { s.remove(0); s.add(page_frame-1,i); } else s.add(count,i); page_faults++; ++count; } else { s.remove((Object)i); s.add(s.size(),i); } } System.out.println(page_faults); } } </code></pre>

Online Quiz This multiple choice question (MCQ) is related to the book/course gs gs122 Data Communication and Computer Network. It can also be found in gs gs122 Page Replacement Algorithm - Least Recently Used Algorithm (LRU) - Quiz No.1.


Similar question(s) are as followings:



Online Quizzes of gs122 Data Communication and Computer Network

Choose an organization

Theme Customizer

Gaussian Texture



Gradient Background