Q914
What will be the output of the following code in 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 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);
A.
7
B.
8
AnswerC.
9
D.
10
Answer: Option B
Solution
Answer: Option B
No explanation is given for this question Let's Discuss on Board