The PYQ practice room
GATE CS 2022 Set 1
All 65 solved GATE CS 2022 Set 1 questions in exam order. Open a question, commit to an answer, and learn from the step-by-step solution. One question at a time.
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.Questions
65
Paper marks
100
Question formats
3
MCQ · NAT · MSQ
Revision mode
Self-paced
No timer. Focus on understanding.
Explore the questions
General Aptitude (GA)
101
Q1MCQ1 markEasyThe _______ is too high for it to be considered _______.Think it through. Then check your answer.Question
The _______ is too high for it to be considered _______.Correct answer
(D) fare / fair
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The sentence tests the knowledge of homophones: fair and fare.1.Fare (noun) refers to the money paid for a journey on public transport (e.g., bus fare, air fare).2.Fair (adjective) means reasonable, just, or equitable.In the context of the sentence:- The first blank refers to a cost, so "**fare**" is the correct choice.
- The second blank refers to whether that cost is reasonable, so "**fair**" is the correct choice.
- Option (A) is incorrect as it reverses the words.
- Option (B) is incorrect because "faer" is not a standard English word.
- Option (C) is incorrect because the second blank requires an adjective, not the noun "fare".
- Option (D) is correct as it uses the noun "fare" for the cost and the adjective "fair" for the reasonableness.
2
Q2MCQ1 markEasyA function is defined in the interval on the -axis as…Think it through. Then check your answer.Question
A function is defined in the interval on the -axis asWhich one of the following is the area under the curve for the interval on the -axis?Correct answer
(C) (13)/(6)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The area under the curve from to is given by the integral . Since the function is defined piecewise, we split the integral into three parts corresponding to the intervals:Calculating each part:1.2.3.Summing the areas:3
Q3MCQ1 markEasyLet be a root of the equation . Then the value of the expression isThink it through. Then check your answer.Question
Let be a root of the equation .
Then the value of the expression isCorrect answer
(D) -126
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given that is a root of , we have:We need to find the value of .
Rearranging the terms to group with and with :We know . Substituting this into the expressions:So,Since :4
Q4MCQ1 markEasyGiven below are four statements. Statement 1: All students are inquisitive. Statement 2: Some students are inquisitive. Statement 3: No student is inquisitive. Statement 4: Some…Think it through. Then check your answer.Question
Given below are four statements.Statement 1: All students are inquisitive.
Statement 2: Some students are inquisitive.
Statement 3: No student is inquisitive.
Statement 4: Some students are not inquisitive.From the given four statements, find the two statements that CANNOT BE TRUE simultaneously, assuming that there is at least one student in the class.Correct answer
(A) Statement 1 and Statement 3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We analyze the statements using the Square of Opposition in logic:- Statement 1 (A): All students are inquisitive.
- Statement 2 (I): Some students are inquisitive.
- Statement 3 (E): No student is inquisitive.
- Statement 4 (O): Some students are not inquisitive.
- Statement 1 and Statement 3: These are contrary statements. If "All" is true, "None" must be false. If "None" is true, "All" must be false. They cannot both be true at the same time (though both can be false). Thus, they cannot be true simultaneously.
- Statement 1 and Statement 2: If "All" is true, "Some" is necessarily true (subalternation). They can be true simultaneously.
- Statement 2 and Statement 4: "Some are" and "Some are not" are sub-contraries. They can both be true simultaneously (e.g., if the class is mixed).
- Statement 3 and Statement 4: If "No student is inquisitive" is true, then it implies "Some students are not inquisitive". They can be true simultaneously.
5
Q5MCQ1 markMediumA palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters. [figure] From the additional…Think it through. Then check your answer.Question
A palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters.From the additional plates given in the options, which one of the combinations of additional plates would allow the player to construct a five-letter palindrome. The player should use all the five plates exactly once. The plates can be rotated in their plane.
Correct answer
(B) [figure]
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The player starts with letters A and D.
To form a 5-letter palindrome, the set of 5 letters must consist of two pairs of matching letters and one central letter (e.g., ).Let's analyze the options (allowing for rotation):- Option (A): Contains D, O/Q, J. Total set: {A, D, D, O, J}. We have a pair of Ds, but A, O, J are singles. Cannot form a palindrome.
- Option (B): Contains R, an inverted 'A' (which becomes A when rotated), and a rotated 'R' (which becomes R). Total set: {A, D, R, A, R}. This gives us two As, two Rs, and one D. We can arrange these as R A D A R, which is a palindrome.
- Option (C): Contains Z, 3, D. Total set: {A, D, Z, 3, D}. Pair of Ds, but A, Z, 3 are singles. Cannot form a palindrome.
- Option (D): Contains I, 7, Y. Total set: {A, D, I, 7, Y}. All singles. Cannot form a palindrome.
6
Q6MCQ2 marksEasySome people believe that "what gets measured, improves". Some others believe that "what gets measured, gets gamed". One possible reason for the difference in the beliefs is the…Think it through. Then check your answer.Question
Some people believe that "what gets measured, improves". Some others believe that "what gets measured, gets gamed". One possible reason for the difference in the beliefs is the work culture in organizations. In organizations with good work culture, metrics help improve outcomes. However, the same metrics are counterproductive in organizations with poor work culture.Which one of the following is the CORRECT logical inference based on the information in the above passage?Correct answer
(B) Metrics are useful in organizations with good work culture
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The passage states: "In organizations with good work culture, metrics help improve outcomes."Let's evaluate the options:- (A) The passage says metrics are "counterproductive" in poor work culture, so they are not useful. Incorrect.
- (B) Since metrics "help improve outcomes" in good work culture, it is logically valid to infer they are "useful". Correct.
- (C) Contradicts the passage which says they improve outcomes in good culture. Incorrect.
- (D) Contradicts the passage. Incorrect.
7
Q7MCQ2 marksEasyIn a recently conducted national entrance test, boys constituted 65% of those who appeared for the test. Girls constituted the remaining candidates and they accounted for 60% of…Think it through. Then check your answer.Question
In a recently conducted national entrance test, boys constituted 65% of those who appeared for the test. Girls constituted the remaining candidates and they accounted for 60% of the qualified candidates.Which one of the following is the correct logical inference based on the information provided in the above passage?Correct answer
(D) The number of boys who qualified the test is less than the number of girls who qualified
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the total number of candidates who appeared, and be the total number of candidates who qualified.From the given information:1.Boys appeared:2.Girls appeared: (since )3.Girls qualified:4.Boys qualified: (since )Analyzing the options:
(A) , which is false.
(B) , which is false.
(C) , which is false.
(D) , which is true.Thus, the number of boys who qualified is less than the number of girls who qualified.8
Q8MCQ2 marksMediumA box contains five balls of same size and shape. Three of them are green coloured balls and two of them are orange coloured balls. Balls are drawn from the box one at a time. If…Think it through. Then check your answer.Question
A box contains five balls of same size and shape. Three of them are green coloured balls and two of them are orange coloured balls. Balls are drawn from the box one at a time. If a green ball is drawn, it is not replaced. If an orange ball is drawn, it is replaced with another orange ball.First ball is drawn. What is the probability of getting an orange ball in the next draw?Correct answer
(D) (23)/(50)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let denote drawing a green ball and denote drawing an orange ball.
Initial state: 3 Green, 2 Orange. Total = 5.Case 1: First ball is Green ().
Probability .
Since green is not replaced, the box now has 2 Green, 2 Orange. Total = 4.
Probability of drawing Orange next () = .Case 2: First ball is Orange ().
Probability .
Since orange is replaced with another orange ball, the composition remains 3 Green, 2 Orange. Total = 5.
Probability of drawing Orange next () = .Total Probability of :9
Q9MCQ2 marksMediumThe corners and mid-points of the sides of a triangle are named using the distinct letters P, Q, R, S, T and U, but not necessarily in the same order. Consider the following…Think it through. Then check your answer.Question
The corners and mid-points of the sides of a triangle are named using the distinct letters P, Q, R, S, T and U, but not necessarily in the same order. Consider the following statements:- The line joining P and R is parallel to the line joining Q and S.
- P is placed on the side opposite to the corner T.
- S and U cannot be placed on the same side.
Correct answer
(B) S cannot be placed at a corner
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze the geometry and statements:1."The line joining P and R is parallel to the line joining Q and S."In a triangle, a line segment is parallel to another only if one connects two midpoints and the other connects the two corners of the third side (Midpoint Theorem). Thus, one pair (e.g., P, R) are corners and the other pair (Q, S) are midpoints, or vice versa.2."P is placed on the side opposite to the corner T."- If P were a midpoint, for PR to be parallel to QS, P and R would likely be midpoints of the sides adjacent to a vertex, and QS would be the base. However, if P is on the side opposite to T, and T is a corner, P lies on the base. This suggests P is a corner on the base line.
- Let's assume P and R are the corners of the base. Then the line PR is the base side.
- For QS to be parallel to PR, Q and S must be the midpoints of the other two sides.
- In this configuration: P and R are corners. Q and S are midpoints.
- T must be the third corner (opposite to side PR). This satisfies "P is placed on the side opposite to the corner T" (since P is an endpoint of that side).
- We have corners: P, R, T. Midpoints: Q, S, U.
- Q and S are midpoints of sides TP and TR (or vice versa).
- U is the midpoint of the base PR.
- S is on side TR (or TP). U is on side PR. They are on different sides. This satisfies the condition.
- Suppose Q and S are corners (base QS) and P, R are midpoints.
- Then P is a midpoint on a side adjacent to the top vertex.
- Statement 2 says P is on the side opposite to corner T. If P is a midpoint, T must be the opposite vertex. But in this setup, the vertex opposite to P's side is one of the base corners (Q or S). So T would be Q or S.
- Statement 3 says S and U cannot be on the same side. If T=S, then S is a corner. U would be the midpoint of the base QS. Thus S and U would both be on the side QS. This contradicts Statement 3.
- The valid configuration is: P and R are corners; Q and S are midpoints.
- Since S is a midpoint, it cannot be placed at a corner.
- Therefore, statement (B) is correct.
10
Q10MCQ2 marksMediumA plot of land must be divided between four families. They want their individual plots to be similar in shape, not necessarily equal in area. The land has equally spaced poles,…Think it through. Then check your answer.Question
A plot of land must be divided between four families. They want their individual plots to be similar in shape, not necessarily equal in area. The land has equally spaced poles, marked as dots in the below figure. Two ropes, R1 and R2, are already present and cannot be moved.What is the least number of additional straight ropes needed to create the desired plots? A single rope can pass through three poles that are aligned in a straight line.
Correct answer
(D) 3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The problem asks for the minimum number of additional straight ropes to divide the land into four plots of similar shape. The existing shape is a square with a corner removed (an L-shape) formed by a grid of dots. The existing ropes R1 and R2 partially divide the area.To divide an L-shaped region into 4 smaller similar L-shaped regions, we typically need to add lines that partition the central area and extend to the boundaries. By adding 3 additional ropes, we can complete the division into 4 identical smaller L-shapes.
Computer Science and Information Technology (CS)
5511
Q11MCQ1 markMediumWhich one of the following statements is TRUE for all positive functions ?Think it through. Then check your answer.Question
Which one of the following statements is TRUE for all positive functions ?Correct answer
(A) f(n²) = θ(f(n)²), when f(n) is a polynomial
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze the options:(A) If is a polynomial, let for some constants .
Then .
And .
Since , . This statement is TRUE.(C) If is an exponential function, let .
Then .
And .
Since grows much faster than , . This statement is FALSE.(B) and (D) are not true for all positive functions (counterexamples can be found using the functions above).12
Q12MCQ1 markMediumWhich one of the following regular expressions correctly represents the language of the finite automaton given below? [figure]Think it through. Then check your answer.Question
Which one of the following regular expressions correctly represents the language of the finite automaton given below?
Correct answer
(D) (ba^ a + ab^ b)^ (ab^ + ba^)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The finite automaton (NFA) has the following structure:- Start state .
- Transition (where is an accepting state).
- Transition (where is an accepting state).
- From : Self-loop , and transition back to . This creates a loop , represented by .
- From : Self-loop , and transition back to . This creates a loop , represented by .
Finally, to accept, it must transition to (path ) or (path ).Combining these, the regular expression is: .13
Q13MCQ1 markEasyWhich one of the following statements is TRUE?Think it through. Then check your answer.Question
Which one of the following statements is TRUE?Correct answer
(D) LR(1) parsing is sufficient for deterministic context-free languages.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Option (D) is correct. parsers are capable of parsing all Deterministic Context-Free Languages (DCFLs).Option (A) is incorrect. The construction of an parser involves merging states from the automaton that have the same core items. This merging process can introduce Reduce-Reduce conflicts (but not Shift-Reduce conflicts), even if the original parser was conflict-free.Option (B) is incorrect. The symbol table is a data structure used throughout the compilation process, including syntax analysis, semantic analysis, and code generation, not just lexical analysis.Option (C) is incorrect. Data flow analysis is a technique used primarily for code optimization (e.g., constant propagation, liveness analysis), not for run-time memory management.14
Q14MCQ1 markEasyIn a relational data model, which one of the following statements is TRUE?Think it through. Then check your answer.Question
In a relational data model, which one of the following statements is TRUE?Correct answer
(A) A relation with only two attributes is always in BCNF.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Option (A) is correct. Consider a relation with two attributes, say and . The possible non-trivial functional dependencies areA → B,B → A, or both. In any of these cases, the determinant (left-hand side) is a superkey, which satisfies the condition for Boyce-Codd Normal Form (BCNF). If there are no non-trivial dependencies, the only superkey is , and the relation is trivially in BCNF.Option (B) is incorrect. A relation where all attributes are prime is always in 3NF, but not necessarily in BCNF. For example,R(A, B, C)with dependenciesAB → CandC → Bhas keys and . All attributes are prime, butC → Bviolates BCNF because is not a superkey.Option (C) is incorrect. A relation can be composed entirely of prime attributes (e.g., the example in B).Option (D) is incorrect. Decomposition into BCNF is lossless but not always dependency preserving.15
Q15MCQ1 markEasyConsider the problem of reversing a singly linked list. To take an example, given the linked list below, [figure] the reversed linked list should look like [figure] Which one of…Think it through. Then check your answer.Question
Consider the problem of reversing a singly linked list. To take an example, given the linked list below,the reversed linked list should look like
Which one of the following statements is TRUE about the time complexity of algorithms that solve the above problem in space?
Correct answer
(A) The best algorithm for the problem takes θ(n) time in the worst case.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Option (A) is correct. A singly linked list can be reversed in place using an iterative algorithm that maintains three pointers:prev,current, andnext. This approach iterates through the list once, reversing thenextpointer of each node to point to theprevnode. This process requires auxiliary space and takes time, where is the number of nodes in the list.16
Q16MCQ1 markMediumSuppose we are given keys, hash table slots, and two simple uniform hash functions and . Further suppose our hashing scheme uses for the odd keys and…Think it through. Then check your answer.Question
Suppose we are given keys, hash table slots, and two simple uniform hash functions and . Further suppose our hashing scheme uses for the odd keys and for the even keys. What is the expected number of keys in a slot?Correct answer
(B) (n)/(m)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the total number of keys and be the number of slots.
Let be the number of odd keys and be the number of even keys, such that .For any specific slot :
The probability that a specific odd key hashes to slot using is (simple uniform hashing).
The expected number of odd keys in slot is .The probability that a specific even key hashes to slot using is (simple uniform hashing).
The expected number of even keys in slot is .The total expected number of keys in slot is:
.17
Q17MCQ1 markEasyWhich one of the following facilitates transfer of bulk data from hard disk to main memory with the highest throughput?Think it through. Then check your answer.Question
Which one of the following facilitates transfer of bulk data from hard disk to main memory with the highest throughput?Correct answer
(A) DMA based I/O transfer
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
DMA (Direct Memory Access) allows the I/O device to transfer data directly to/from main memory without the continuous intervention of the CPU. This is much faster for bulk data transfers compared to Programmed I/O (polling) or Interrupt-driven I/O, where the CPU is involved in moving each word or byte.18
Q18MCQ1 markEasyLet R1 and R2 be two 4-bit registers that store numbers in 2’s complement form. For the operation R1+R2, which one of the following values of R1 and R2 gives an arithmetic…Think it through. Then check your answer.Question
Let R1 and R2 be two 4-bit registers that store numbers in 2’s complement form. For the operation R1+R2, which one of the following values of R1 and R2 gives an arithmetic overflow?Correct answer
(B) R1 = 1100 and R2 = 1010
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In 4-bit 2's complement representation, the range of values is to .
Overflow occurs when adding two numbers of the same sign results in a number of the opposite sign.(A) . Discard carry . Correct.
(B) . Discard carry . Incorrect. Negative + Negative = Positive implies Overflow.
(C) . Correct.
(D) . Discard carry . Correct.19
Q19MCQ1 markMediumConsider the following threads, , and executing on a single processor, synchronized using three binary semaphore variables, , and , operated upon…Think it through. Then check your answer.Question
Consider the following threads, , and executing on a single processor, synchronized using three binary semaphore variables, , and , operated upon using standardwait()andsignal(). The threads can be context switched in any order and at any time.Which initialization of the semaphores would print the sequence BCABCABCA....?while(true){while(true){while(true){wait(S3);wait(S1);wait(S2);print("C");print("B");print("A");signal(S2); }signal(S3); }signal(S1); }Correct answer
(C) S₁ = 1; S₂ = 0; S₃ = 0
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To print the sequence BCABCABCA..., the order of execution must be1.The first character is 'B', printed by . executeswait(S1). For to proceed first, must be initialized to 1.2.After printing 'B', executessignal(S3). This should enable to print 'C'.3.The second character is 'C', printed by . executeswait(S3). Since signals , can proceed if was initially 0.4.After printing 'C', executessignal(S2). This should enable to print 'A'.5.The third character is 'A', printed by . executeswait(S2). Since signals , can proceed if was initially 0.6.After printing 'A', executesThus, the initial values must be .signal(S1), which allows to start the next cycle.20
Q20MCQ1 markEasyConsider the following two statements with respect to the matrices and . Statement 1: Statement…Think it through. Then check your answer.Question
Consider the following two statements with respect to the matrices and .Statement 1:
Statement 2: .where represents the trace of a matrix. Which one of the following holds?Correct answer
(C) Both Statement 1 and Statement 2 are correct.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The trace of a product of two matrices and satisfies provided that both products and are square matrices.- In Statement 1, is and is . Thus is and is . Both are square, so is a standard identity.
- In Statement 2, and are both . Thus and are both . Both are square, so is also a standard identity.
21
Q21MCQ1 markEasyWhat is printed by the following ANSI C program? [code]Think it through. Then check your answer.Question
What is printed by the following ANSI C program?#include<stdio.h> int main(int argc, char *argv[]) { int x = 1, z[2] = {10, 11}; int *p = NULL; p = &x; *p = 10; p = &z[1]; *(&z[0] + 1) += 3; printf("%d, %d, %d\n", x, z[0], z[1]); return 0; }Correct answer
(D) 10, 10, 14
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's trace the program execution:1.int x = 1, z[2] = {10, 11};initializes .2.p = &x;makes pointer point to .3.*p = 10;changes the value of to 10.4.p = &z[1];makes pointer point to .5.*(&z[0] + 1) += 3;&z[0]is the address of the first element of array .&z[0] + 1is the address of the second element, which is&z[1].*(&z[0] + 1)is the value at that address, which is .z[1] += 3;updates from 11 to .
printf("%d, %d, %d\n", x, z[0], z[1]);prints the current values: .
Thus, the output is10, 10, 14.22
Q22MCQ1 markMediumConsider an enterprise network with two Ethernet segments, a web server and a firewall, connected via three routers as shown below. [figure] What is the number of subnets inside…Think it through. Then check your answer.Question
Consider an enterprise network with two Ethernet segments, a web server and a firewall, connected via three routers as shown below.What is the number of subnets inside the enterprise network?
Correct answer
(C) 6
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A subnet is required for each segment of the network that is not further subdivided. In a router-based network, each interface of a router connects to a different subnet.
Let's identify the distinct network segments in the given diagram:1.The link between the top router (connected to the Internet) and the firewall. This is a point-to-point link and requires one subnet.2.The link between the firewall and the central router. This is another point-to-point link requiring one subnet.3.The left Ethernet segment connected to the central router. This is a broadcast domain and requires one subnet.4.The link between the central router and the web server. This is a point-to-point link requiring one subnet.5.The link between the central router and the right router. This is a point-to-point link requiring one subnet.6.The right Ethernet segment connected to the right router. This is another broadcast domain and requires one subnet.Counting these up, we have a total of 6 subnets inside the enterprise network.Therefore, the correct answer is 6.23
Q23MSQ1 markMediumWhich of the following statements is/are TRUE?Think it through. Then check your answer.Question
Which of the following statements is/are TRUE?Correct answer
(B) If a language L and its complement L are both recursively enumerable, then L must be recursive.; (C) Complement of a context-free language must be recursive.; (D) If L₁ and L₂ are regular, then L₁ ∩ L₂ must be deterministic context-free.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement (A) is FALSE. Consider , which is a regular language and thus recursively enumerable. Any undecidable language is a subset of . Therefore, a subset of a recursively enumerable language is not necessarily recursive.Statement (B) is TRUE. This is a standard theorem: A language is recursive (decidable) if and only if both and its complement are recursively enumerable.Statement (C) is TRUE. Every context-free language (CFL) is recursive (decidable). The class of recursive languages is closed under complementation. Therefore, the complement of a CFL is recursive.Statement (D) is TRUE. The class of regular languages is closed under intersection. Thus, is regular. Since every regular language is a deterministic context-free language (DCFL), must be deterministic context-free.24
Q24MSQ1 markMediumLet WB and WT be two set associative cache organizations that use LRU algorithm for cache block replacement. WB is a write back cache and WT is a write through cache. Which of the…Think it through. Then check your answer.Question
Let WB and WT be two set associative cache organizations that use LRU algorithm for cache block replacement. WB is a write back cache and WT is a write through cache. Which of the following statements is/are FALSE?Correct answer
(A) Each cache block in WB and WT has a dirty bit.; (B) Every write hit in WB leads to a data transfer from cache to main memory.; (D) A read miss in WB will never lead to eviction of a dirty block from WB.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The question asks for the FALSE statements.(A) Each cache block in WB and WT has a dirty bit.
A dirty bit is required for a write-back (WB) cache to track whether a block has been modified. This is necessary to know if the block needs to be written back to main memory upon eviction. However, in a write-through (WT) cache, every write is immediately propagated to main memory, so the cache and memory are always consistent. Thus, a WT cache does not need a dirty bit. Since the statement claims that WT also has a dirty bit, the statement is FALSE.(B) Every write hit in WB leads to a data transfer from cache to main memory.
This describes a write-through policy. In a write-back (WB) cache, on a write hit, only the cache block is updated, and its dirty bit is set. The data is written to main memory only when the dirty block is evicted. Therefore, the statement is FALSE.(C) Eviction of a block from WT will not lead to data transfer from cache to main memory.
In a write-through (WT) cache, main memory is updated on every write operation. This ensures that the main memory always holds the most recent version of the data. Consequently, when a block is evicted from the cache, there is no need to write it back to memory. The statement is TRUE.(D) A read miss in WB will never lead to eviction of a dirty block from WB.
A read miss requires fetching a new block from memory. If the target cache set is full, a block must be evicted based on the LRU policy. The block chosen for eviction could be clean or dirty. If the LRU block happens to be dirty, it must be evicted (and written back to memory) to make space for the new block. The statement claims this will never happen, which is incorrect. Therefore, the statement is FALSE.The false statements are A, B, and D.25
Q25MSQ1 markHardConsider the following three relations in a relational database. Which of…Think it through. Then check your answer.Question
Consider the following three relations in a relational database.Which of the following relational algebra expressions return the set of who own all the brands?Correct answer
(A) _(eId)(_(eId, bId)(Own) / _(bId)(Brand)); (B) _(eId)(Own) - _(eId)((_(eId)(Own) × _(bId)(Brand)) - _(eId, bId)(Own))
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The query asks for the division operation .1.Option (A) represents the division operation directly: . This is correct.2.Option (B) represents the expansion of the division operation using basic operators:This logic finds all potential (eId, bId) pairs, subtracts actual owned pairs to find missing pairs, projects to find eIds with missing brands, and subtracts those from the set of all eIds. This is the standard definition of division. This is correct.3.Option (C) divides by , which is the set of brands owned by someone, not necessarily all brands in theBrandtable. Incorrect.4.Option (D) is syntactically and logically incorrect.26
Q26MSQ1 markMediumWhich of the following statements is/are TRUE with respect to deadlocks?Think it through. Then check your answer.Question
Which of the following statements is/are TRUE with respect to deadlocks?Correct answer
(A) Circular wait is a necessary condition for the formation of deadlock.; (D) In the resource-allocation graph of a system, if every edge is an assignment edge, then the system is not in deadlock state.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Statement (A): According to Coffman's conditions, Circular Wait is one of the four necessary conditions for a deadlock to occur. True.2.Statement (B): In a system with multiple instances of resources, a cycle in the Resource Allocation Graph (or wait-for graph) is a necessary but not sufficient condition for deadlock. A knot is required, or graph reduction must be checked. False.3.Statement (C): An unsafe state implies that the system may enter a deadlock, but it is not guaranteed. A deadlock will necessarily occur only if the system cannot avoid it regardless of future requests, but an unsafe state just means there is no guaranteed safe sequence; dynamic execution might still avoid deadlock. False.4.Statement (D): An assignment edge goes from a Resource to a Process (R → P), indicating the process holds the resource. If every edge is an assignment edge, there are no request edges (P → R), meaning no process is waiting for a resource. Without waiting, there is no deadlock. True.27
Q27MSQ1 markMediumWhich of the following statements is/are TRUE for a group ?Think it through. Then check your answer.Question
Which of the following statements is/are TRUE for a group ?Correct answer
(A) If for all x, y ∈ G, (xy)² = x² y², then G is commutative.; (B) If for all x ∈ G, x² = 1, then G is commutative. Here, 1 is the identity element of G.; (C) If the order of G is 2, then G is commutative.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Statement (A): Given . Expanding, . By left cancellation of and right cancellation of , we get . Thus, is commutative (Abelian). True.2.Statement (B): Given for all . This implies . For any , consider . Since , . Since elements are their own inverses, . Thus . True.3.Statement (C): If the order of is 2, let . The only possible operation table forces and . This is cyclic and commutative. Generally, any group of prime order is cyclic and thus commutative. True.4.Statement (D): If a group is commutative, all its elements commute. Therefore, elements in any subgroup must also commute. A subgroup of an Abelian group is always Abelian. False.28
Q28NAT1 markMediumSuppose a binary search tree with 1000 distinct elements is also a complete binary tree. The tree is stored using the array representation of binary heap trees. Assuming that the…Think it through. Then check your answer.Question
Suppose a binary search tree with 1000 distinct elements is also a complete binary tree. The tree is stored using the array representation of binary heap trees. Assuming that the array indices start with 0, the largest element of the tree is stored at index_____________.Correct answer
509 to 509
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the -th largest element in a Binary Search Tree (BST), we perform a reverse in-order traversal (Right, Root, Left). Since the tree is also a Complete Binary Tree (CBT) stored in an array, the structure is fixed.Array Indexing Properties:
For a node at index :- Left Child:
- Right Child:
- Parent:
- Total nodes (indices to ).
The largest element in a BST is the rightmost node. We start at the root () and keep moving to the right child as long as the index is within bounds ().- Next right child: . Node has no right child.
- Does node have a left child? . No.
- Thus, index 510 is the largest element.
Since node is a leaf (no left child), the next largest element is its parent (since was a right child).- Parent of : .
- Thus, index 254 is the 2nd largest element.
After visiting , we must explore its left subtree to find the next largest values. The largest value in the left subtree is the rightmost node of that subtree.- Left child of : .
- Does node have a right child? . No.
- Since node has no right child, it is the largest element in the left subtree of .
- Thus, index 509 is the 3rd largest element.
The 3rd largest element is stored at index 509.29
Q29NAT1 markMediumConsider the augmented grammar with as the set of terminals. If is the…Think it through. Then check your answer.Question
Consider the augmented grammar with as the set of terminals.If is the set of two items , then contains exactly __________ items.Correct answer
5 to 5
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The given set of items is .The operation involves finding the transition on the terminal symbol .1.Identify the kernel item:The item in with the dot before is .
Moving the dot over , we get the kernel item for the next state:
2.Compute the closure:We need to include all production rules for the non-terminal immediately following the dot ().- Add productions for :
Now, check the new items. We have a dot before (already handled) and a dot before . We must add productions for .- Add productions for :
3.Final Set of Items:The complete set of items in the new state is:
1.
2.
3.
4.
5. There are exactly 5 items in this set.30
Q30NAT1 markMediumConsider a simple undirected graph of 10 vertices. If the graph is disconnected, then the maximum number of edges it can have is ____________.Think it through. Then check your answer.Question
Consider a simple undirected graph of 10 vertices. If the graph is disconnected, then the maximum number of edges it can have is ____________.Correct answer
36 to 36
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.A simple undirected graph with vertices is disconnected if it has at least two connected components.2.To maximize the number of edges in a disconnected graph, we should have exactly two components: one component being a complete graph and the other being an isolated vertex .3.For , the components are and .4.The number of edges in a complete graph is .5.For , the number of edges is .6.The isolated vertex has 0 edges.7.Total maximum edges = .31
Q31NAT1 markMediumConsider a relationR(A, B, C, D, E)with the following three functional dependencies.AB → C;BC → D;C → E; The number of superkeys in the…Think it through. Then check your answer.Question
Consider a relationR(A, B, C, D, E)with the following three functional dependencies.AB → C;BC → D;C → E;The number of superkeys in the relation is _____________.Correct answer
8 to 8
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the number of superkeys, we first need to identify the candidate keys of the relationR(A, B, C, D, E).1.Identify essential attributes: Attributes and do not appear on the right-hand side of any functional dependency. Therefore, and must be part of every candidate key.2.Check closure of essential attributes:(starting set)
UsingAB → C,
UsingC → E,
UsingBC → D(since ),
Since contains all attributes of the relation, is a candidate key.3.Check for other candidate keys: Since any candidate key must contain and , and is already a candidate key, no proper subset of can be a candidate key. Thus, is the only candidate key.4.Calculate the number of superkeys: A superkey is any set of attributes that contains a candidate key. Here, any superkey must contain . The remaining attributes are . The number of ways to choose a subset of these 3 attributes to add to is .The 8 superkeys are: .32
Q32NAT1 markMediumThe number of arrangements of six identical balls in three identical bins is______.Think it through. Then check your answer.Question
The number of arrangements of six identical balls in three identical bins is______.Correct answer
7 to 7
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The problem asks for the number of ways to distribute identical balls into identical bins. This is equivalent to finding the number of partitions of the integer 6 into at most 3 parts.Let the number of balls in the three bins be such that and . We list all such non-increasing sequences:1.2.3.4.5.6.7.There are 7 such distinct arrangements.33
Q33NAT1 markMediumA cache memory that has a hit rate of 0.8 has an access latency 10 ns and miss penalty 100 ns. An optimization is done on the cache to reduce the miss rate. However, the…Think it through. Then check your answer.Question
A cache memory that has a hit rate of 0.8 has an access latency 10 ns and miss penalty 100 ns. An optimization is done on the cache to reduce the miss rate. However, the optimization results in an increase of cache access latency to 15 ns, whereas the miss penalty is not affected. The minimum hit rate (rounded off to two decimal places) needed after the optimization such that it should not increase the average memory access time is _____________.Correct answer
0.85 to 0.85
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The average memory access time () is calculated as:where is the hit rate, is the hit latency, and is the additional time taken on a miss.Initial State:- ns
- ns
- ns
- ns
- ns (unchanged)
- Let be the new hit rate.
To not increase the average memory access time, we need :The minimum hit rate required is 0.85.34
Q34NAT1 markMediumThe value of the following limit is ___________ [figure]Think it through. Then check your answer.Question
The value of the following limit is ___________
Correct answer
-0.5
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the given limit be .As , the numerator and the denominator . This is an indeterminate form of the type .We can solve this using L'Hôpital's Rule. Let and .
Then, .
And .Applying L'Hôpital's Rule:Substituting into the expression:Alternatively, using standard limits:
We know the standard limit .Let . As , we have .Thus, the value of the limit is -0.5.35
Q35NAT1 markMediumConsider the resolution of the domain namewww.gate.org.inby a DNS resolver. Assume that no resource records are cached anywhere across the DNS servers and that iterative query…Think it through. Then check your answer.Question
Consider the resolution of the domain namewww.gate.org.inby a DNS resolver. Assume that no resource records are cached anywhere across the DNS servers and that iterative query mechanism is used in the resolution. The number of DNS query-response pairs involved in completely resolving the domain name is_____________.Correct answer
4 to 4
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In an iterative DNS resolution forwww.gate.org.inwith no caching:1.The resolver queries a Root DNS server to find the TLD server for.in. (1 pair)2.The resolver queries the .in TLD server to find the authoritative server fororg.in. (1 pair)3.The resolver queries the org.in authoritative server to find the authoritative server forgate.org.in. (1 pair)4.The resolver queries the gate.org.in authoritative server to find the IP address forTotal number of query-response pairs = .www.gate.org.in. (1 pair)36
Q36MCQ2 marksMediumWhich one of the following is the closed form for the generating function of the sequence defined below?…Think it through. Then check your answer.Question
Which one of the following is the closed form for the generating function of the sequence defined below?Correct answer
(A) (x(1+x²))/((1-x²)²) + (1)/(1-x)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The sequence is
The generating function is
Split into even and odd indices:
Even terms:
Odd terms:
So,
Now, let's check Option A:
This matches our derived .37
Q37MCQ2 marksMediumConsider a simple undirected unweighted graph with at least three vertices. If is the adjacency matrix of the graph, then the number of 3-cycles in the graph is given by the…Think it through. Then check your answer.Question
Consider a simple undirected unweighted graph with at least three vertices. If is the adjacency matrix of the graph, then the number of 3-cycles in the graph is given by the trace ofCorrect answer
(D) A³ divided by 6
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a simple undirected graph, the number of paths of length from vertex to vertex is given by the -th entry of the matrix . The trace of , denoted as , is the sum of the diagonal elements, which represents the total number of paths of length that start and end at the same vertex.For , a path of length 3 that starts and ends at the same vertex is a 3-cycle (a triangle). In a simple graph, each 3-cycle is counted 6 times in because:1.It can start at any of the 3 vertices ( or ).2.For each starting vertex, it can be traversed in 2 directions (e.g., and ).Therefore, the number of 3-cycles is , which is the trace of .38
Q38MCQ2 marksMediumWhich one of the following statements is FALSE?Think it through. Then check your answer.Question
Which one of the following statements is FALSE?Correct answer
(C) The memory access time using a given inverted page table is always same for all incoming virtual addresses.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's evaluate each statement:(A) True: A Translation Lookaside Buffer (TLB) is typically implemented using Content-Addressable Memory (CAM), which allows for high-speed parallel associative searching of all entries.(B) True: A TLB hit implies that the page table entry for that virtual address is present and valid. This means the corresponding page is currently resident in physical (main) memory. A cache miss simply means the data isn't in the faster cache levels, but it must be in main memory.(C) False: Inverted page tables use a hash table to map virtual addresses to physical frames. Because of potential hash collisions, entries are often stored in chains (linked lists). Searching through these chains takes variable time depending on the length of the chain and the position of the entry, so access time is not constant.(D) True: In hashed page tables, collisions are handled by chaining. If two different virtual addresses hash to the same bucket, the system must traverse the linked list to find the correct entry. The time taken depends on the depth of the entry in the list, so the access times will likely differ.39
Q39MCQ2 marksMediumLet and denote read and write operations on a data element by a transaction , respectively. Consider the schedule with four transactions.…Think it through. Then check your answer.Question
Let and denote read and write operations on a data element by a transaction , respectively. Consider the schedule with four transactions. Which one of the following serial schedules is conflict equivalent to ?Correct answer
(A) T₁ arrow T₃ arrow T₄ arrow T₂
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the conflict equivalent serial schedule, we identify all conflicting operations (different transactions, same data item, at least one is a write) and determine the required order:1.Conflicts on :- is before
- is before
- is before (No conflict as it's the same transaction)
- is before
- is before
- is before
- is before
From the edges, we see that must be first, followed by , then , and finally .
The only valid serial order is .40
Q40MCQ2 marksMediumConsider a digital display system (DDS) shown in the figure that displays the contents of register X. A 16-bit code word is used to load a word in X, either from S or from R. S is…Think it through. Then check your answer.Question
Consider a digital display system (DDS) shown in the figure that displays the contents of register X. A 16-bit code word is used to load a word in X, either from S or from R. S is a 1024-word memory segment and R is a 32-word register file. Based on the value of mode bit M, T selects an input word to load in X. P and Q interface with the corresponding bits in the code word to choose the addressed word.
Which one of the following represents the functionality of P, Q, and T?
Correct answer
(C) P is 10:2¹⁰ decoder; Q is 5:2⁵ decoder; T is 2:1 multiplexer
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Analyze S (Memory Segment): S is a 1024-word memory. To address 1024 words, we need address bits. The component P takes the S-address (from the code word) and enables the specific word in S. This is the function of a decoder. Specifically, a decoder takes 10 input bits and activates one of the output lines corresponding to the rows/words in the memory.2.Analyze R (Register File): R is a 32-word register file. To address 32 registers, we need address bits. The component Q takes the R-address and selects the specific register. This is the function of a decoder (or decoder).3.Analyze T: T takes the data output from S and the data output from R and selects one of them to load into register X, based on the mode bit M. Since it selects 1 out of 2 inputs, T is a 2:1 multiplexer.Therefore:- P is a decoder.
- Q is a decoder.
- T is a 2:1 multiplexer.
41
Q41MCQ2 marksMediumConsider three floating point numbers , and stored in registers , and , respectively as per IEEE-754 single…Think it through. Then check your answer.Question
Consider three floating point numbers , and stored in registers , and , respectively as per IEEE-754 single precision floating point format. The 32-bit content stored in these registers (in hexadecimal form) are as follows.Which one of the following is FALSE?Correct answer
(B) C = A + B
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We decode the IEEE-754 single precision values (Sign bit , 8-bit Exponent , 23-bit Mantissa ). Value .1. Decode ():- Binary:
1100 0001 0100 0000 ... - (Negative)
- . Exponent .
- (Binary fraction )
- .
- Binary:
0100 0010 0001 0000 ... - (Positive)
- . Exponent .
- (Binary fraction )
- .
- Binary:
0100 0001 0100 0000 ... - (Positive)
- . Exponent .
- (Binary fraction )
- .
- (A) . TRUE.
- (B) . FALSE.
- (C) . TRUE.
- (D) . TRUE.
- Binary:
42
Q42MCQ2 marksHardConsider four processes P, Q, R, and S scheduled on a CPU as per round robin algorithm with a time quantum of 4 units. The processes arrive in the order P, Q, R, S, all at time…Think it through. Then check your answer.Question
Consider four processes P, Q, R, and S scheduled on a CPU as per round robin algorithm with a time quantum of 4 units. The processes arrive in the order P, Q, R, S, all at time . There is exactly one context switch from S to Q, exactly one context switch from R to Q, and exactly two context switches from Q to R. There is no context switch from S to P. Switching to a ready process after the termination of another process is also considered a context switch. Which one of the following is NOT possible as CPU burst time (in time units) of these processes?Correct answer
(D) P = 3, Q = 7, R = 7, S = 3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We analyze the execution sequence based on the constraints and the Round Robin (TQ=4) policy. Order: P, Q, R, S.Constraints:1.S Q: Exactly 1.2.R Q: Exactly 1.3.Q R: Exactly 2.4.S P: 0.Analysis of Option (D): P=3, Q=7, R=7, S=3- Round 1:
- P runs for 3 units (Finishes). Switch P Q.
- Q runs for 4 units (Remaining: 3). Switch Q R. (Count Q R = 1)
- R runs for 4 units (Remaining: 3). Switch R S.
- S runs for 3 units (Finishes). Switch S Q. (Count S Q = 1)
- Round 2:
- Queue has Q, R.
- Q runs for 3 units (Finishes). Switch Q R. (Count Q R = 2)
- R runs for 3 units (Finishes). Terminate.
- S Q: 1 (Satisfied)
- Q R: 2 (Satisfied)
- S P: 0 (Satisfied)
- R Q: In the sequence above, the switches involving R are: Q R (Round 1), R S (Round 1), Q R (Round 2). R terminates after the second run. There is NO switch from R to Q. The count is 0.
- The problem requires exactly one switch from R to Q.
Seq: P(4, done) Q(4, rem 6) R(4, rem 2) S(2, done) Q(4, rem 2) R(2, done) Q(2, done).
Switches: P Q, Q R(1), R S, S Q(1), Q R(2), R Q(1). All constraints satisfied.43
Q43MCQ2 marksMediumWhat is printed by the following ANSI C program? [code]Think it through. Then check your answer.Question
What is printed by the following ANSI C program?#include<stdio.h> int main(int argc, char *argv[]) { int a[3][3][3] = {{1, 2, 3, 4, 5, 6, 7, 8, 9}, {10, 11, 12, 13, 14, 15, 16, 17, 18}, {19, 20, 21, 22, 23, 24, 25, 26, 27}}; int i = 0, j = 0, k = 0; for( i = 0; i < 3; i++ ){ for(k = 0; k < 3; k++ ) printf("%d ", a[i][j][k]); printf("\n"); } return 0; }Correct answer
(A) 1 2 3 10 11 12 19 20 21
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The arrayais a 3D array of dimensions . It is initialized with three blocks of elements.a[0]corresponds to the first block:{1, 2, 3, 4, 5, 6, 7, 8, 9}. In row-major order,a[0][0]is{1, 2, 3}.a[1]corresponds to the second block:{10, 11, ..., 18}.a[1][0]is{10, 11, 12}.a[2]corresponds to the third block:{19, 20, ..., 27}.a[2][0]is{19, 20, 21}.
ifrom 0 to 2 andkfrom 0 to 2, whilejis fixed at 0.- When
i=0, it printsa[0][0][0],a[0][0][1],a[0][0][2], which are1, 2, 3. - When
i=1, it printsa[1][0][0],a[1][0][1],a[1][0][2], which are10, 11, 12. - When
i=2, it printsa[2][0][0],a[2][0][1],a[2][0][2], which are19, 20, 21.
1 2 3
10 11 12
19 20 2144
Q44MCQ2 marksMediumWhat is printed by the following ANSI C program? [code] ASCII encoding for relevant characters is given below | A | B | C | ... | Z | |---|---|---|---|---| | 65 | 66 | 67 | ... |…Think it through. Then check your answer.Question
What is printed by the following ANSI C program?#include<stdio.h> int main(int argc, char *argv[]){ char a = 'P'; char b = 'x'; char c = (a & b) + '*'; char d = (a | b) - '-'; char e = (a ^ b) + '+'; printf("%c %c %c\n", c, d, e); return 0; }
ASCII encoding for relevant characters is given belowA B C ... Z 65 66 67 ... 90 a b c ... z 97 98 99 ... 122 * + - 42 43 45 Correct answer
(A) z K S
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We calculate the ASCII values and bitwise operations:a = 'P'has ASCII value 80 (). Binary:01010000.b = 'x'has ASCII value 120 (). Binary:01111000.
1.c = (a & b) + '*'a & b=01010000&01111000=01010000(80).c = 80 + 42(ASCII for*) = 122.- ASCII 122 corresponds to
'z'.
d = (a | b) - '-'a | b=01010000|01111000=01111000(120).d = 120 - 45(ASCII for-) = 75.- ASCII 75 corresponds to
'K'().
e = (a ^ b) + '+'a ^ b=01010000^01111000=00101000(32 + 8 = 40).e = 40 + 43(ASCII for+) = 83.- ASCII 83 corresponds to
'S'().
z K S.45
Q45MCQ2 marksMediumConsider solving the following system of simultaneous equations using LU decomposition. where and…Think it through. Then check your answer.Question
Consider solving the following system of simultaneous equations using LU decomposition.where and are denoted asWhich one of the following is the correct combination of values for , , and ?Correct answer
(D) L₃₂ = -(1)/(2), U₃₃ = -(1)/(2), x₁ = 0
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We perform LU decomposition () using the Doolittle algorithm (where ).
Matrix .1.First row of U (same as A):.2.First column of L:.
.
.3.Second row of U:.
.4.Second column of L:.
.5.Third row of U:.So, and .Now solve for using and , where .Forward substitution ():
.
.
.Backward substitution ():
.
.
.Thus, , , and .46
Q46MSQ2 marksMediumWhich of the following is/are undecidable?Think it through. Then check your answer.Question
Which of the following is/are undecidable?Correct answer
(A) Given two Turing machines M₁ and M₂, decide if L(M₁) = L(M₂).; (B) Given a Turing machine M, decide if L(M) is regular.; (C) Given a Turing machine M, decide if M accepts all strings.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Option (A) is the Equivalence Problem for Turing Machines, which is undecidable.
Option (B) asks if the language of a TM is regular. By Rice's Theorem, any non-trivial property of the RE languages is undecidable. Regularity is a non-trivial property, so this is undecidable.
Option (C) is the Totality Problem (), which is undecidable.
Option (D) is decidable. Since the machine runs for a fixed number of steps (1073), it can only scan a bounded prefix of the input (at most 1073 symbols). We only need to simulate on all strings of length up to 1073. If halts or loops within 1073 steps on any such string, we can determine the answer. Since the set of strings to check is finite and the simulation is bounded, this is decidable.47
Q47MSQ2 marksHardConsider the following languages: Note that is the reversal of the…Think it through. Then check your answer.Question
Consider the following languages:Note that is the reversal of the string . Which of the following is/are TRUE?Correct answer
(A) L₁ and L₂ are regular.; (B) L₁ and L₂ are context-free.; (C) L₁ is regular and L₂ is context-free.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
For : Since can be any string, we can choose , which gives . Even if is implied, . In either case, is regular.For : must be non-empty, so it starts with or . If starts with , ends with . Since , there is at least one character in between. Thus, any string starting and ending with with length is in (choose ). Similarly for . Thus , which is regular.Since both are regular, they are also context-free. Therefore, statements (A), (B), and (C) are all true.48
Q48MSQ2 marksHardConsider the following languages: Which of the following…Think it through. Then check your answer.Question
Consider the following languages:Which of the following statements is/are FALSE?Correct answer
(B) Neither L₁ nor L₂ is context-free.; (C) L₂, L₃ and L₂ ∩ L₃ all are context-free.; (D) Neither L₁ nor its complement is context-free.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Analyze the languages:- is a standard example of a Context-Sensitive Language that is NOT Context-Free. However, its complement IS Context-Free.
- involves matching 's and 's while 's can be anything. This is a Deterministic Context-Free Language (DCFL).
- involves matching 's and 's while 's can be anything. This is also a DCFL.
- , which is NOT Context-Free.
(A) True. is not CFL. are DCFL.
(B) False. IS context-free.
(C) False. is not context-free.
(D) False. The complement of IS context-free.The question asks for FALSE statements.49
Q49MSQ2 marksMediumConsider a simple undirected weighted graph , all of whose edge weights are distinct. Which of the following statements about the minimum spanning trees of is/are TRUE?Think it through. Then check your answer.Question
Consider a simple undirected weighted graph , all of whose edge weights are distinct. Which of the following statements about the minimum spanning trees of is/are TRUE?Correct answer
(A) The edge with the second smallest weight is always part of any minimum spanning tree of G.; (B) One or both of the edges with the third smallest and the fourth smallest weights are part of any minimum spanning tree of G.; (C) Suppose S ⊆ V be such that S ≠ ∅ and S ≠ V. Consider the edge with the minimum weight such that one of its vertices is in S and the other in V S. Such an edge will always be part of any minimum spanning tree of G.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Since all edge weights are distinct, the Minimum Spanning Tree (MST) of is unique. Therefore, option (D) is false.Option (A): In Kruskal's algorithm, edges are sorted by weight. The smallest edge is always added (no cycle). The second smallest edge is also always added because two edges cannot form a cycle in a simple graph (a cycle requires at least 3 edges). Thus, the second smallest edge is always in the MST. This statement is TRUE.Option (B): Consider a triangle graph () with edge weights 1, 2, 3. The MST contains edges {1, 2}. The edge with weight 3 (3rd smallest) is excluded. The 4th smallest edge does not exist. The statement "One or both... are part" is false for this graph. Even if we consider a graph with 4 edges, say a cycle of 4 with weights 1, 2, 3, 4, the MST is {1, 2, 3}, so 4 is excluded. Thus, this statement is not always true.Option (C): This is the Cut Property of MSTs. For any cut , the minimum weight edge crossing the cut must be part of the MST. This is a fundamental theorem. This statement is TRUE.Correct Options: A, C.50
Q50MSQ2 marksHardThe following simple undirected graph is referred to as the Peterson graph. [figure] Which of the following statements is/are TRUE?Think it through. Then check your answer.Question
The following simple undirected graph is referred to as the Peterson graph.
Which of the following statements is/are TRUE?Correct answer
(A) The chromatic number of the graph is 3.; (B) The graph has a Hamiltonian path.; (C) The following graph is isomorphic to the Peterson graph. [figure]
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Option (A): The Peterson graph is 3-colorable. Its chromatic number is 3. TRUE.
Option (B): The Peterson graph has a Hamiltonian path (a path visiting every vertex exactly once) but does not have a Hamiltonian cycle. TRUE.
Option (C): The graph shown is a known isomorphic representation of the Peterson graph (often drawn as a circle with chords or a bipartite-like structure with specific connections). TRUE.
Option (D): The maximum independent set size of the Peterson graph is 4. FALSE.Correct Options: A, B, C.51
Q51MSQ2 marksHardConsider the following recurrence: …Think it through. Then check your answer.Question
Consider the following recurrence:Then, which of the following statements is/are TRUE?Correct answer
(A) f(2ⁿ - 1) = 2ⁿ - 1; (B) f(2ⁿ) = 1; (C) f(5 · 2ⁿ) = 2ⁿ⁺¹ + 1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The recurrence describes the solution to the Josephus problem with step . The closed form is given by: if where , then .(A) . We can write . Here and .
. TRUE.(B) . Here and .
. TRUE.(C) . Here and .
. TRUE.(D) . Here and .
.
The option claims . This is only true if . For , it is false. FALSE.Correct Options: A, B, C.52
Q52MSQ2 marksHardWhich of the properties hold for the adjacency matrix of a simple undirected unweighted graph having vertices?Think it through. Then check your answer.Question
Which of the properties hold for the adjacency matrix of a simple undirected unweighted graph having vertices?Correct answer
(A) The diagonal entries of A² are the degrees of the vertices of the graph.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Option (A): The -th entry of is given by . Since the graph is undirected, is symmetric (), so . For an unweighted simple graph, , so . Thus, . This statement is TRUE.Option (B): Consider a path graph with vertices 1-2-3 (). The adjacency matrix is . Then . . The entries and are zero, yet the graph is connected. This statement is FALSE.Option (C): The sum of all elements of is . The condition implies . A graph with vertices consisting of a triangle () and an isolated vertex has and , satisfying the condition, but it contains a cycle. This statement is FALSE.Option (D): Having at least a 1 in each row/column implies every vertex has a degree of at least 1 (no isolated vertices). Consider a graph with consisting of two disjoint edges (). Every row has a 1, but the graph is disconnected. This statement is FALSE.53
Q53MSQ2 marksMediumWhich of the following is/are the eigenvector(s) for the matrix given below?…Think it through. Then check your answer.Question
Which of the following is/are the eigenvector(s) for the matrix given below?Correct answer
(A) pmatrix -1 \ 1 \ 0 \ 1 pmatrix; (C) pmatrix -1 \ 0 \ 2 \ 2 pmatrix; (D) pmatrix 0 \ 1 \ -3 \ 0 pmatrix
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the given matrix. We check for each option.(A) :
Row 1:
Row 2:
Row 3:
Row 4:
Result is . Eigenvector with .(B) :
Row 1: . Not an eigenvector.(C) :
Row 1:
Row 2:
Row 3:
Row 4:
Result is . Eigenvector with .(D) :
Row 1:
Row 2:
Row 3:
Row 4:
Result is . Eigenvector with .54
Q54MSQ2 marksHardConsider a system with 2 KB direct mapped data cache with a block size of 64 bytes. The system has a physical address space of 64 KB and a word length of 16 bits. During the…Think it through. Then check your answer.Question
Consider a system with 2 KB direct mapped data cache with a block size of 64 bytes. The system has a physical address space of 64 KB and a word length of 16 bits. During the execution of a program, four data words P, Q, R, and S are accessed in that order 10 times (i.e., PQRSPQRS…). Hence, there are 40 accesses to data cache altogether. Assume that the data cache is initially empty and no other data words are accessed by the program. The addresses of the first bytes of P, Q, R, and S are 0xA248, 0xC28A, 0xCA8A, and 0xA262, respectively. For the execution of the above program, which of the following statements is/are TRUE with respect to the data cache?Correct answer
(A) Every access to S is a hit.; (B) Once P is brought to the cache it is never evicted.; (D) Every access to R evicts Q from the cache.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Cache parameters: Size = 2KB = 2048 bytes, Block = 64 bytes. Number of lines = . Index bits = . Offset bits = .Address mapping (Binary):
P: 0xA248 = 1010 0010 0100 1000. Index (bits 6-10): 01001 (9). Tag: 10100 (20).
Q: 0xC28A = 1100 0010 1000 1010. Index: 01010 (10). Tag: 11000 (24).
R: 0xCA8A = 1100 1010 1000 1010. Index: 01010 (10). Tag: 11001 (25).
S: 0xA262 = 1010 0010 0110 0010. Index: 01001 (9). Tag: 10100 (20).Analysis:1.P and S map to Set 9 with the same Tag (20). They are in the same 64-byte block (0xA240 to 0xA27F). Accessing P brings the block containing S. No conflict between P and S.2.Q and R map to Set 10 with different Tags (24 vs 25). They conflict.Sequence P, Q, R, S:- P: Miss (Cold). Loads Block(P,S) into Set 9.
- Q: Miss (Cold). Loads Block(Q) into Set 10.
- R: Miss (Conflict). Evicts Q, loads Block(R) into Set 10.
- S: Hit (Block(P,S) is in Set 9).
(A) S is always a hit because P loads the block and nothing evicts Set 9. TRUE.
(B) P is in Set 9. Only S accesses Set 9, and it's in the same block. Never evicted. TRUE.
(C) At the end, Set 9 has Block(P,S) and Set 10 has Block(R). P, S, and R reside in cache. Statement "Only R and S" implies P is not there, which is false. FALSE.
(D) Every access to R occurs after Q, finding Block(Q) in Set 10. R must evict Q. TRUE.55
Q55MSQ2 marksMediumConsider routing table of an organization’s router shown below: | Subnet Number | Subnet Mask | Next Hop | | :--- | :--- | :--- | | 12.20.164.0 | 255.255.252.0 | R1 | |…Think it through. Then check your answer.Question
Consider routing table of an organization’s router shown below:Which of the following prefixes in CIDR notation can be collectively used to correctly aggregate all of the subnets in the routing table?Subnet Number Subnet Mask Next Hop 12.20.164.0 255.255.252.0 R1 12.20.170.0 255.255.254.0 R2 12.20.168.0 255.255.254.0 Interface 0 12.20.166.0 255.255.254.0 Interface 1 default R3 Correct answer
(B) 12.20.164.0/22; (D) 12.20.168.0/22
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To aggregate the subnets, we first determine the range of IP addresses covered by each entry in the routing table:1. (Mask ): Range to .2. (Mask ): Range to .3. (Mask ): Range to .4. (Mask ): Range to (this is a subset of the first range).The total range to be covered is to .- The range is exactly covered by the prefix (Option B).
- The range (combining and ) is exactly covered by the prefix (Option D).
56
Q56NAT2 marksMediumConsider the relational database with the following four schemas and their respective instances. Student(sNo, sName, dNo) Dept(dNo, dName)…Think it through. Then check your answer.Question
Consider the relational database with the following four schemas and their respective instances.Student(sNo, sName, dNo) Dept(dNo, dName)
Course(cNo, cName, dNo) Register(sNo, cNo)Student sNo sName dNo S01 James D01 S02 Rocky D01 S03 Jackson D02 S04 Jane D01 S05 Milli D02 Dept dNo dName D01 CSE D02 EEE Course cNo cName dNo C11 DS D01 C12 OS D01 C21 DE D02 C22 PT D02 C23 CV D03 SQL Query:Register sNo cNo S01 C11 S01 C12 S02 C11 S03 C21 S03 C22 S03 C23 S04 C11 S04 C12 S05 C11 S05 C21 The number of rows returned by the above SQL query is___________.SELECT * FROM Student AS S WHERE NOT EXIST (SELECT cNo FROM Course WHERE dNo = "D01" EXCEPT SELECT cNo FROM Register WHERE sNo = S.sNo)Correct answer
2 to 2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The SQL query performs a relational division operation. It selects all students from theStudenttable who have registered for every course offered by department 'D01'.1.Identify courses in department 'D01': From theCoursetable, these are {C11, C12}.2.Check each student's registrations from theRegistertable:- S01: Registered for {C11, C12}. (Matches all D01 courses)
- S02: Registered for {C11}. (Missing C12)
- S03: Registered for {C21, C22, C23}. (Missing C11, C12)
- S04: Registered for {C11, C12}. (Matches all D01 courses)
- S05: Registered for {C11, C21}. (Missing C12)
57
Q57NAT2 marksHardConsider a network with three routers P, Q, R shown in the figure below. All the links have cost of unity. [figure] The routers exchange distance vector routing information and…Think it through. Then check your answer.Question
Consider a network with three routers P, Q, R shown in the figure below. All the links have cost of unity.The routers exchange distance vector routing information and have converged on the routing tables, after which the link Q−R fails. Assume that P and Q send out routing updates at random times, each at the same average rate. The probability of a routing loop formation (rounded off to one decimal place) between P and Q, leading to count-to-infinity problem, is___________.
Correct answer
0.5 to 0.5
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In Distance Vector Routing, a routing loop (count-to-infinity) occurs if a router receives an update about a destination from a neighbor that was previously using that router to reach the same destination.Initially, the network is converged:- is at distance 0 from .
- reaches via with cost 1.
- reaches via with cost 2.
58
Q58NAT2 marksHardLetG(V, E)be a directed graph, where is the set of vertices and is the set of directed edges, as defined by the following adjacency matrix .…Think it through. Then check your answer.Question
LetG(V, E)be a directed graph, where is the set of vertices and is the set of directed edges, as defined by the following adjacency matrix . indicates a directed edge from node to node . A directed spanning tree of , rooted at , is defined as a subgraph of such that the undirected version of is a tree, and contains a directed path from to every other vertex in . The number of such directed spanning trees rooted at vertex 5 is _____________.Correct answer
24 to 24
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The problem asks for the number of directed spanning trees (arborescences) rooted at vertex 5. A directed spanning tree rooted at requires that every vertex has exactly one incoming edge, and there are no cycles.The adjacency matrix is given by . This means there is a directed edge if and only if . Since self-loops () cannot be part of a spanning tree, valid edges for the tree must satisfy . This implies that edges always go from a higher index to a lower index, so the graph is a Directed Acyclic Graph (DAG) (ignoring self-loops). Consequently, any selection of one parent for each node (except the root) will not form a cycle.We need to choose a parent (source node) for each vertex such that the parent satisfies (since the edge is ).- For vertex 4: Possible parents are (since ). 1 choice.
- For vertex 3: Possible parents are (since ). 2 choices.
- For vertex 2: Possible parents are (since ). 3 choices.
- For vertex 1: Possible parents are (since ). 4 choices.
59
Q59NAT2 marksMediumConsider a 100 Mbps link between an earth station (sender) and a satellite (receiver) at an altitude of 2100 km. The signal propagates at a speed of 3x10⁸ m/s. The time taken (in…Think it through. Then check your answer.Question
Consider a 100 Mbps link between an earth station (sender) and a satellite (receiver) at an altitude of 2100 km. The signal propagates at a speed of 3x10⁸ m/s. The time taken (in milliseconds, rounded off to two decimal places) for the receiver to completely receive a packet of 1000 bytes transmitted by the sender is __________.Correct answer
7.07 to 7.09
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The total time for the receiver to completely receive the packet is the sum of the transmission time () and the propagation time ().Given data:- Bandwidth (B) = 100 Mbps = bits per second
- Packet Size (L) = 1000 bytes = bits
- Distance (d) = 2100 km = m = m
- Propagation Speed (v) = m/s
This is the time required to push all the bits of the packet onto the link.
seconds
To convert to milliseconds, multiply by 1000:
ms2. Calculate Propagation Time ():
This is the time it takes for the first bit to travel from the sender to the receiver.
seconds
To convert to milliseconds, multiply by 1000:
ms3. Calculate Total Time:
The time for the receiver to completely receive the packet is the time from when the first bit is sent until the last bit is received. This is the sum of transmission time and propagation time.
Total Time =
Total Time = msThe question asks to round off to two decimal places, which gives 7.08.60
Q60NAT2 marksMediumConsider the data transfer using TCP over a link. Assuming that the maximum segment lifetime (MSL) is set to , the minimum number of bits…Think it through. Then check your answer.Question
Consider the data transfer using TCP over a link. Assuming that the maximum segment lifetime (MSL) is set to , the minimum number of bits required for the sequence number field of the TCP header, to prevent the sequence number space from wrapping around during the MSL is____________.Correct answer
33 to 33
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To prevent the sequence number space from wrapping around during the Maximum Segment Lifetime (), the total number of unique sequence numbers available must be at least the total number of bytes transmitted during that period.1.Calculate the data rate in bytes per second:2.Calculate the total data transmitted during MSL:3.Determine the number of bits () required for the sequence number field:The sequence number space with bits is . We need:
Taking on both sides:
Since the number of bits must be an integer, the minimum number of bits required is .61
Q61NAT2 marksMediumA processor operating at 2 GHz has a standard 5-stage RISC instruction pipeline having a base CPI (cycles per instruction) of one without any pipeline hazards. For a given…Think it through. Then check your answer.Question
A processor operating at 2 GHz has a standard 5-stage RISC instruction pipeline having a base CPI (cycles per instruction) of one without any pipeline hazards. For a given program that has 30% branch instructions, control hazards incur 2 cycles stall for every branch. A new version of the processor operating at same clock frequency has an additional branch predictor unit (BPU) that completely eliminates stalls for correctly predicted branches. There is neither any savings nor any additional stalls for wrong predictions. There are no structural hazards and data hazards for and . If the BPU has a prediction accuracy of 80%, the speed up (rounded off to two decimal places) obtained by over in executing is____________.Correct answer
1.42 to 1.45
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the speedup of processor over , we need to calculate the effective CPI (Cycles Per Instruction) for both processors. The speedup is the ratio of the execution time of to . Since the clock frequency and instruction count are the same for both, the speedup is the ratio of their CPIs.Step 1: Calculate CPI for- Base CPI = 1
- Branch frequency = 30% = 0.3
- Stall penalty per branch = 2 cycles
- Pipeline stalls per instruction = cycles
- Effective
- Base CPI = 1
- Branch frequency = 0.3
- Prediction accuracy = 80% = 0.8
- Misprediction rate =
- Stalls occur only on mispredictions (wrong predictions). The penalty is the same as (2 cycles).
- Stalls per branch = cycles
- Pipeline stalls per instruction = cycles
- Effective
62
Q62NAT2 marksMediumConsider the queues containing four elements and containing none (shown as the Initial State in the figure). The only operations allowed on these two queues are…Think it through. Then check your answer.Question
Consider the queues containing four elements and containing none (shown as the Initial State in the figure). The only operations allowed on these two queues areEnqueue(Q,element)andDequeue(Q). The minimum number ofEnqueueoperations on required to place the elements of in in reverse order (shown as the Final State in the figure) without using any additional storage is ___________.
Correct answer
0 to 0
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To reverse the elements of into without using any additional explicit storage (like an auxiliary queue or array), we can utilize the implicit stack of a recursive function. The procedure is as follows:Execution Trace:void reverse(Queue Q1, Queue Q2) { if (isEmpty(Q1)) return; // Remove element from Q1 and hold it in the recursion stack int x = Dequeue(Q1); // Recursive call to process the rest reverse(Q1, Q2); // Enqueue the held element into Q2 as the recursion unwinds Enqueue(Q2, x); }1.Dequeue(Q1)removes 1. Recurse.2.Dequeue(Q1)removes 2. Recurse.3.Dequeue(Q1)removes 3. Recurse.4.Dequeue(Q1)removes 4. Recurse.5. is empty. Return.6.Enqueue(Q2, 4)(4 is added to ).7.Enqueue(Q2, 3)(3 is added to ).8.Enqueue(Q2, 2)(2 is added to ).9.Result: contains and is empty.During this entire process, we only performEnqueue(Q2, 1)(1 is added to ).Dequeueon andEnqueueon . We never perform anEnqueueoperation on . Thus, the minimum number ofEnqueueoperations on is 0.63
Q63NAT2 marksHardConsider two files systems and , that use contiguous allocation and linked allocation, respectively. A file of size 100 blocks is already stored in A and also in B. Now,…Think it through. Then check your answer.Question
Consider two files systems and , that use contiguous allocation and linked allocation, respectively. A file of size 100 blocks is already stored in A and also in B. Now, consider inserting a new block in the middle of the file (between and block), whose data is already available in the memory. Assume that there are enough free blocks at the end of the file and that the file control blocks are already in memory. Let the number of disk accesses required to insert a block in the middle of the file in and are and , respectively, then the value of is _________.Correct answer
153 to 153
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
For File System A (Contiguous Allocation):- The file has 100 blocks. We need to insert a new block between the and blocks (i.e., at position 51).
- This requires shifting the blocks from index 51 to 100 (total blocks) one position to the right (to indices 52 to 101) to create space.
- Shifting 50 blocks involves reading each block and writing it to the new location.
- Number of Reads = 50
- Number of Writes = 50
- After shifting, we write the new block at index 51.
- Number of Writes = 1
- Total disk accesses for A () = .
- To insert a block after the block, we must traverse the linked list from the beginning to reach the block (since linked allocation does not support random access).
- We read blocks 1 to 50 to find the pointer in the block.
- Number of Reads = 50
- We then update the pointer of the block to point to the new block, and the new block points to the old block.
- We write the updated block and the new block to disk.
- Number of Writes = 2
- Total disk accesses for B () = .
64
Q64NAT2 marksMediumConsider a demand paging system with four page frames (initially empty) and LRU page replacement policy. For the following page reference string…Think it through. Then check your answer.Question
Consider a demand paging system with four page frames (initially empty) and LRU page replacement policy. For the following page reference stringthe page fault rate, defined as the ratio of number of page faults to the number of memory accesses (rounded off to one decimal place) is _________.Correct answer
0.6 to 0.6
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the page fault rate, we trace the memory accesses using the LRU (Least Recently Used) policy with 4 frames:1.7: Page Fault. Frames: [7]2.2: Page Fault. Frames: [7, 2]3.7: Page Hit. Frames: [2, 7] (7 is now most recently used)4.3: Page Fault. Frames: [2, 7, 3]5.2: Page Hit. Frames: [7, 3, 2] (2 is now most recently used)6.5: Page Fault. Frames: [7, 3, 2, 5]7.3: Page Hit. Frames: [7, 2, 5, 3] (3 is now most recently used)8.4: Page Fault. Replace 7 (least recently used). Frames: [2, 5, 3, 4]9.6: Page Fault. Replace 2 (least recently used). Frames: [5, 3, 4, 6]10.7: Page Fault. Replace 5 (least recently used). Frames: [3, 4, 6, 7]11.7: Page Hit. Frames: [3, 4, 6, 7]12.1: Page Fault. Replace 3 (least recently used). Frames: [4, 6, 7, 1]13.5: Page Fault. Replace 4 (least recently used). Frames: [6, 7, 1, 5]14.6: Page Hit. Frames: [7, 1, 5, 6]15.1: Page Hit. Frames: [7, 5, 6, 1]Total number of memory accesses = 15
Total number of page faults = 9
Page fault rate =65
Q65NAT2 marksHardConsider the following grammar along with translation rules. [figure] Here # and % are operators and id is a token that represents an integer and id.val represents the…Think it through. Then check your answer.Question
Consider the following grammar along with translation rules.Here # and % are operators and id is a token that represents an integer and id.val represents the corresponding integer value. The set of non-terminals is and a subscripted non-terminal indicates an instance of the non-terminal.Using this translation scheme, the computed value of S.val for root of the parse tree for the expression
20#10%5#8%2%2is __________.Correct answer
80 to 80
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The given grammar defines the precedence and associativity of the operators # and %.Grammar:1.2.S → T3.4.T → R5.Translation Rules:- For rule 1:
- For rule 3: (integer division)
- Precedence: Since the production for involves (i.e., can derive a string of s separated by #), and can derive a string of s separated by %, the operator % has higher precedence than the operator #.
- Associativity: The productions and are left-recursive. This means both operators # and % are left-associative.
The expression to evaluate is20#10%5#8%2%2.Based on the precedence and associativity rules derived from the grammar, we can parenthesize the expression to show the order of evaluation:Expression:( (20 # (10 % 5)) # ((8 % 2) % 2) )Let's evaluate the sub-expressions step-by-step according to the translation rules:1.Evaluate the innermost parentheses first.-
(10 % 5): This corresponds to the production . The translation rule is . Here, is 10 and is 5. So, the value is . -
(8 % 2): Similarly, this evaluates to .
( (20 # 2) # (4 % 2) )3.Evaluate the next level of parentheses.-
(4 % 2): This evaluates to .
( (20 # 2) # 2 )5.Now, evaluate the remaining expression from left to right due to left-associativity of #.-
(20 # 2): This corresponds to the production . The translation rule is . Here, is 20 and is 2. So, the value is .
(40 # 2)7.Finally, evaluate the last operation.-
(40 # 2): This evaluates to .