The PYQ practice room
GATE CS 2016 Set 2
All 65 solved GATE CS 2016 Set 2 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
2
MCQ · NAT
Revision mode
Self-paced
No timer. Focus on understanding.
Explore the questions
General Aptitude (GA)
101
Q1MCQ1 markEasyThe man who is now Municipal Commissioner worked as ____________________.Think it through. Then check your answer.Question
The man who is now Municipal Commissioner worked as ____________________.Correct answer
(B) a security guard at the university
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The correct choice is (B). The sentence requires an indefinite article 'a' before 'security guard' because he was one of many security guards (profession), and the definite article 'the' before 'university' to specify the particular institution. 'At university' (without an article) usually refers to the state of being a student.2
Q2MCQ1 markEasyNobody knows how the Indian cricket team is going to cope with the difficult and seamer-friendly wickets in Australia. Choose the option which is closest in meaning to the…Think it through. Then check your answer.Question
Nobody knows how the Indian cricket team is going to cope with the difficult and seamer-friendly wickets in Australia.Choose the option which is closest in meaning to the underlined phrase in the above sentence.Correct answer
(A) put up with
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The phrase 'cope with' means to deal effectively with something difficult. The phrase 'put up with' means to tolerate or endure something unpleasant. In this context, they are the closest in meaning. 'Put down to' means to attribute to. 'Put up against' means to place in competition with.3
Q3MCQ1 markEasyFind the odd one in the following group of words. mock, deride, praise, jeerThink it through. Then check your answer.Question
Find the odd one in the following group of words.mock, deride, praise, jeerCorrect answer
(C) praise
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The words 'mock', 'deride', and 'jeer' all have negative connotations related to ridicule, making fun of, or showing contempt for someone. 'Praise' has a positive connotation, meaning to express warm approval or admiration. Therefore, 'praise' is the odd one out.4
Q4MCQ1 markEasyPick the odd one from the following options.Think it through. Then check your answer.Question
Pick the odd one from the following options.Correct answer
(D) ONPMQ
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze the alphabetical positions of the letters in each option:(A) C(3), A(1), D(4), B(2), E(5)
Difference pattern: (B) J(10), H(8), K(11), I(9), L(12)
Difference pattern: (C) X(24), V(22), Y(25), W(23), Z(26)
Difference pattern: (D) O(15), N(14), P(16), M(13), Q(17)
Difference pattern: Option (D) does not follow the pattern of the other three options.5
Q5MCQ1 markMediumIn a quadratic function, the value of the product of the roots is 4. Find the value ofThink it through. Then check your answer.Question
In a quadratic function, the value of the product of the roots is 4. Find the value ofCorrect answer
(B) 4ⁿ
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given the product of roots .
We need to find the value of:Rewrite the denominator:Substitute this back into the expression:Since , the value is .6
Q6MCQ2 marksEasyAmong 150 faculty members in an institute, 55 are connected with each other through Facebook® and 85 are connected through WhatsApp®. 30 faculty members do not have Facebook® or…Think it through. Then check your answer.Question
Among 150 faculty members in an institute, 55 are connected with each other through Facebook® and 85 are connected through WhatsApp®. 30 faculty members do not have Facebook® or WhatsApp® accounts. The number of faculty members connected only through Facebook® accounts is ______________.Correct answer
(A) 35
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the set of faculty members connected through Facebook and be the set of faculty members connected through WhatsApp.
Total faculty members .
Number of members with neither account .
Therefore, the number of members with at least one account is:Given:Using the formula for the union of two sets:The number of faculty members connected ONLY through Facebook is:7
Q7MCQ2 marksEasyComputers were invented for performing only high-end useful computations. However, it is no understatement that they have taken over our world today. The internet, for example, is…Think it through. Then check your answer.Question
Computers were invented for performing only high-end useful computations. However, it is no understatement that they have taken over our world today. The internet, for example, is ubiquitous. Many believe that the internet itself is an unintended consequence of the original invention. With the advent of mobile computing on our phones, a whole new dimension is now enabled. One is left wondering if all these developments are good or, more importantly, required.Which of the statement(s) below is/are logically valid and can be inferred from the above paragraph?(i) The author believes that computers are not good for us.
(ii) Mobile computers and the internet are both intended inventionsCorrect answer
(D) neither (i) nor (ii)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement (i) is not inferred because the author states "One is left wondering if all these developments are good", which indicates uncertainty rather than a definitive belief that they are not good.
Statement (ii) is not inferred because the text explicitly states "Many believe that the internet itself is an unintended consequence", which contradicts the claim that it is an intended invention.
Thus, neither statement can be inferred.8
Q8MCQ2 marksEasyAll hill-stations have a lake. Ooty has two lakes. Which of the statement(s) below is/are logically valid and can be inferred from the above sentences? (i) Ooty is not a…Think it through. Then check your answer.Question
All hill-stations have a lake. Ooty has two lakes.Which of the statement(s) below is/are logically valid and can be inferred from the above sentences?(i) Ooty is not a hill-station.
(ii) No hill-station can have more than one lake.Correct answer
(D) neither (i) nor (ii)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement (i): The premise "All hill-stations have a lake" implies that having a lake is a necessary condition for being a hill-station. Ooty has two lakes, so it satisfies the condition of having a lake. We cannot infer that it is not a hill-station.
Statement (ii): The premise states hill-stations have "a lake". In logic, "a lake" means "at least one lake". It does not preclude having more than one. Therefore, we cannot infer that no hill-station can have more than one lake.
Thus, neither statement is inferred.9
Q9MCQ2 marksEasyIn a rectangle grid shown below, each cell is a rectangle. How many rectangles can be observed in the grid? [figure]Think it through. Then check your answer.Question
In a rectangle grid shown below, each cell is a rectangle. How many rectangles can be observed in the grid?
Correct answer
(C) 30
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The number of rectangles in an grid is given by the formula:Here, (rows) and (columns).10
Q10MCQ2 marksEasyChoose the correct expression for given in the graph. [figure]Think it through. Then check your answer.Question
Choose the correct expression for given in the graph.
Correct answer
(C) f(x) = 2 - x - 1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The graph shows a function which is a triangular wave with a peak. From the graph, we can observe key points:1.The peak is at , so .2.The x-intercepts are at and , so and .Let's test the options with the peak point :
(A)
(B)
(C) (Matches)
(D) (Matches)Now let's test with the point :
(C) (Matches)
(D) Thus, the correct expression is .
COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
5511
Q11NAT1 markMediumConsider the following expressions: (i) false (ii) (iii) true (iv) (v)
The number of expressions given above that are logically implied by…Think it through. Then check your answer.Question
Consider the following expressions:(i) false
(ii)
(iii) true
(iv)
(v)
The number of expressions given above that are logically implied by 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
The premise is .
Using the equivalence , we have:
.
Thus, the premise is true if and only if both is true and is true.We check each expression to see if it is true whenever and are both true:
(i) false: Always false. Not implied.
(ii) : True when is true. Implied.
(iii) true: Always true. Implied.
(iv) : True since is true. Implied.
(v) : Since is true, is false. Since is true, false true is true. Implied.Total number of implied expressions is 4.12
Q12NAT1 markMediumLet be a polynomial and be its derivative. If the degree of is 10, then the degree of is ________.Think it through. Then check your answer.Question
Let be a polynomial and be its derivative. If the degree of is 10, then the degree of is ________.Correct answer
9 to 9
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let . The expression isolates the even powers of in (since odd powers cancel out). If the degree of is 10, then the highest even power in is .Let . The expression isolates the odd powers of in (since even powers cancel out).
The terms in come from differentiating terms in .- The derivative of an even power is (an odd power).
- The derivative of an odd power is (an even power).
The highest even power in is . Its derivative is , which is an odd power of degree 9.
Any higher powers in would have to be odd (e.g., ), and their derivatives would be even (e.g., ), which would cancel out in .Thus, the degree of is 9.13
Q13NAT1 markEasyThe minimum number of colours that is sufficient to vertex-colour any planar graph is ________.Think it through. Then check your answer.Question
The minimum number of colours that is sufficient to vertex-colour any planar graph 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
According to the Four Color Theorem, any planar graph can be vertex-colored with no more than 4 colors such that no two adjacent vertices share the same color.14
Q14MCQ1 markMediumConsider the systems, each consisting of linear equations in variables. I. If , then all such systems have a solution II. If , then none of these systems has…Think it through. Then check your answer.Question
Consider the systems, each consisting of linear equations in variables.I. If , then all such systems have a solution
II. If , then none of these systems has a solution
III. If , then there exists a system which has a solutionWhich one of the following is CORRECT?Correct answer
(C) Only III is true
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the system be , where is an matrix.Statement I: If (fewer equations than variables), the system is underdetermined. While such systems often have infinite solutions if consistent, they can also be inconsistent (no solution). For example, and has but no solution. Thus, statement I is false.Statement II: If (more equations than variables), the system is overdetermined. While such systems are often inconsistent, they can have a solution if the equations are not independent and are consistent. For example, and has and a unique solution . Thus, statement II is false.Statement III: If , there exists a system which has a solution. This is true. For example, the system (homogeneous system with identity matrix) always has the trivial solution . Thus, statement III is true.Therefore, only statement III is correct.15
Q15NAT1 markEasySuppose that a shop has an equal number of LED bulbs of two different types. The probability of an LED bulb lasting more than 100 hours given that it is of Type 1 is 0.7, and…Think it through. Then check your answer.Question
Suppose that a shop has an equal number of LED bulbs of two different types. The probability of an LED bulb lasting more than 100 hours given that it is of Type 1 is 0.7, and given that it is of Type 2 is 0.4. The probability that an LED bulb chosen uniformly at random lasts more than 100 hours is _________.Correct answer
0.55 to 0.55
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the event that the bulb lasts more than 100 hours.
Let be the event that the bulb is of Type 1.
Let be the event that the bulb is of Type 2.Given:
(equal number of bulbs)
Using the Law of Total Probability:The probability is 0.55.16
Q16NAT1 markEasySuppose that the eigenvalues of matrix are 1, 2, 4. The determinant of is _________.Think it through. Then check your answer.Question
Suppose that the eigenvalues of matrix are 1, 2, 4. The determinant of is
_________.Correct answer
0.124 to 0.126
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given eigenvalues of are .The determinant of a matrix is the product of its eigenvalues:We need to find .
Using the property , we have:Using the property , we have:Thus, the value is 0.125.17
Q17NAT1 markHardConsider an eight-bit ripple-carry adder for computing the sum of and , where and are integers represented in 2’s complement form. If the decimal value of is…Think it through. Then check your answer.Question
Consider an eight-bit ripple-carry adder for computing the sum of and , where and are integers represented in 2’s complement form. If the decimal value of is one, the decimal value of that leads to the longest latency for the sum to stabilize is __________.Correct answer
-1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a ripple-carry adder, the worst-case delay (longest latency) occurs when a carry is generated at the least significant bit (LSB) position and propagates through all the bits to the most significant bit (MSB) position (and potentially out).Let the 8-bit representations be and .
Given , in 8-bit 2's complement, . So, and for .1.Carry Generation at LSB: To start the carry chain, a carry must be generated at bit 0. The generate condition is . Since , we must have .2.Carry Propagation: For the carry to ripple through the remaining bits, the propagate condition must hold for . Since for these bits, we have , which implies for all .Combining these, must be .
In 2's complement notation, the bit pattern represents the decimal value .Thus, .18
Q18MCQ1 markMediumLet, where are Boolean variables, and is the XOR operator. Which one of the following must always be…Think it through. Then check your answer.Question
Let, where are Boolean variables, and is the XOR operator.
Which one of the following must always be TRUE?Correct answer
(C) x₁ ⊕ x₃ = x₂ ⊕ x₄
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given the equation:This implies that the number of variables with value 1 is even (0, 2, or 4).Let's analyze the options:(A)
This expression is false if all variables are 1 (). Since , the condition holds, but the option statement is false. Thus, (A) is not always true.(B)
Consider the case where . The XOR sum is , so the condition holds. However, . Thus, (B) is not always true.(C)
Recall that .
So, the LHS becomes and the RHS becomes .
The statement is equivalent to .
From the given equation , we can rearrange terms:This matches the simplified form of option (C). Thus, (C) is always true.(D)
This implies all variables are 0. However, the condition also holds if all variables are 1 (sum = 4) or if two are 1 (sum = 2). Thus, (D) is not always true.19
Q19NAT1 markEasyLet be the number of distinct 16-bit integers in 2’s complement representation. Let be the number of distinct 16-bit integers in sign magnitude representation. Then…Think it through. Then check your answer.Question
Let be the number of distinct 16-bit integers in 2’s complement representation. Let be the number of distinct 16-bit integers in sign magnitude representation.
Then is _______.Correct answer
1 to 1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
For an -bit integer representation:1.2's Complement Representation:- Range of values:
- For , the range is .
- The number of distinct values is .
- So, .
- Range of values:
- For , the range is .
- Note that in sign magnitude, there are two representations for zero ( and ), which correspond to the same integer value . Therefore, the number of distinct integer values is .
- So, .
20
Q20NAT1 markEasyA processor has 40 distinct instructions and 24 general purpose registers. A 32-bit instruction word has an opcode, two register operands and an immediate operand. The number of…Think it through. Then check your answer.Question
A processor has 40 distinct instructions and 24 general purpose registers. A 32-bit instruction word has an opcode, two register operands and an immediate operand. The number of bits available for the immediate operand field is ______.Correct answer
16 to 16
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Number of bits for opcode bits.
Number of bits for one register operand bits.
Number of bits for two register operands bits.
Total bits used for opcode and registers bits.
Total instruction size bits.
Bits available for immediate operand bits.21
Q21NAT1 markMediumBreadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex at a distance four from the root. If is the -th vertex in this…Think it through. Then check your answer.Question
Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex at a distance four from the root. If is the -th vertex in this BFS traversal, then the maximum possible value of is ______.Correct answer
31 to 31
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a BFS traversal of a binary tree, nodes are visited level by level (distance from root).
To maximize , we assume the binary tree is a complete binary tree.
The number of nodes at distance is at most .
Nodes at distance 0:
Nodes at distance 1:
Nodes at distance 2:
Nodes at distance 3:
Total nodes at distances 0 to 3 .
The nodes at distance 4 will be visited after all nodes at distances 0 to 3.
The maximum number of nodes at distance 4 is .
The last node at distance 4 will be the -st node visited.
Thus, the maximum possible value of is 31.22
Q22NAT1 markEasyThe value printed by the following program is ______. [code]Think it through. Then check your answer.Question
The value printed by the following program is ______.void f(int* p, int m){ m = m + 5; *p = *p + m; return; } void main(){ int i=5, j=10; f(&i, j); printf("%d", i+j); }Correct answer
30 to 30
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Execution trace:1.mainstarts.i = 5,j = 10.2.f(&i, j)is called.ppoints toi,mis a copy ofj(10).3.Insidef:m = m + 5.4.*p = *p + m. (Sinceppoints toi,iis modified).5.freturns.6.Back inmain:printf("%d", i+j)prints .23
Q23MCQ1 markMediumAssume that the algorithms considered here sort the input sequences in ascending order. If the input is already in ascending order, which of the following are TRUE? I. Quicksort…Think it through. Then check your answer.Question
Assume that the algorithms considered here sort the input sequences in ascending order. If the input is already in ascending order, which of the following are TRUE?I. Quicksort runs in time
II. Bubblesort runs in time
III. Mergesort runs in time
IV. Insertion sort runs in timeCorrect answer
(D) I and IV only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Quicksort: When the input is already sorted (ascending), and assuming the standard pivot selection (first or last element), the partition will be extremely unbalanced (one side has 0 elements, the other has ). This leads to a recurrence , which solves to . Thus, statement I is TRUE.2.Bubblesort: The standard optimized Bubblesort (with a flag to detect if any swap occurred) will make one pass through the sorted array, perform no swaps, and terminate. This takes time. If the unoptimized version is considered, it takes . However, looking at the options, if II were true (unoptimized), then both I, II, and IV would be true, but there is no option for "I, II and IV". If II is false (optimized), then only I and IV are true, which matches option (D). Thus, we assume the optimized version. Statement II is FALSE.3.Mergesort: Mergesort always divides the array into halves and merges them. Its recurrence is always , regardless of data order. The time complexity is . Thus, statement III is FALSE.4.Insertion Sort: When the input is already sorted, the inner loop condition is never met (or met once and breaks immediately), resulting in work per element. The total time is . Thus, statement IV is TRUE.Since I and IV are true, the correct option is (D).24
Q24MCQ1 markEasyThe Floyd-Warshall algorithm for all-pair shortest paths computation is based onThink it through. Then check your answer.Question
The Floyd-Warshall algorithm for all-pair shortest paths computation is based onCorrect answer
(C) Dynamic Programming paradigm.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In CSMA/CD (Carrier Sense Multiple Access with Collision Detection):1.Carrier Sense: A station listens to the channel before transmitting. If the channel is busy, it waits.2.Collision Detection: A station listens while transmitting. If it detects a collision (signal energy spike), it stops transmitting the data packet and sends a jamming signal.- Option (A) is false because the station must sense the channel during transmission to detect collisions.
- Option (C) is false because the station stops transmitting the packet as soon as a collision is detected.
4.Exponential Backoff: After a collision, the station waits for a random amount of time chosen from an interval , where is the number of attempts. As increases, the interval grows exponentially, which spreads out the retransmission attempts of colliding stations and reduces the probability of another collision. Thus, Option (D) is true.25
Q25MCQ1 markMediumitems are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decrease-key operation, a pointer is…Think it through. Then check your answer.Question
items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decrease-key operation, a pointer is provided to the record on which the operation is to be performed.
An algorithm performs the following operations on the list in this order: delete, insert, find, and decrease-key. What is the time complexity of all these operations put together?Correct answer
(C) O(N²)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We analyze the cost of each set of operations on a sorted doubly linked list:1. delete operations: Since a pointer to the node is provided, deletion in a doubly linked list is . Total cost: .2. insert operations: To insert into a sorted linked list, we must find the correct position. In a linked list, we cannot perform binary search, so we must linearly scan. Worst case per insert isO(N). Total cost: .3. find operations: Similar to insert, finding an element in a sorted linked list requires a linear scan,O(N). Total cost: .4. decrease-key operations: A pointer is given, but after decreasing the key, the sorted order must be maintained. The node might need to be moved to a new position. In the worst case, it movesSumming these up: .The dominant term is .O(N)steps. Total cost: .26
Q26NAT1 markEasyThe number of states in the minimum sized DFA that accepts the language defined by the regular expression is ________.Think it through. Then check your answer.Question
The number of states in the minimum sized DFA that accepts the language defined by the regular expressionis ________.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 regular expression generates all strings over that contain at least one occurrence of . In other words, it generates all strings with length . The only string not generated is the empty string .The minimal DFA for this language requires 2 states:1.Initial State (): Represents having read 0 symbols (string is ). This is a non-accepting state.2.Final State (): Represents having read 1 or more symbols. This is an accepting state.Transitions:- From , on input '0' or '1', transition to .
- From , on input '0' or '1', stay in (since length is still ).
27
Q27MCQ1 markEasyLanguage is defined by the grammar: Language is defined by the grammar: Consider the following statements:…Think it through. Then check your answer.Question
Language is defined by the grammar:
Language is defined by the grammar: Consider the following statements:
: is regular
: is regularWhich one of the following is TRUE?Correct answer
(C) P is false and Q is true
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Analyze the languages generated by the grammars:1. (): This grammar generates strings of the form for . This is a classic example of a Context-Free Language (CFL) that is not regular because it requires infinite memory to match the count of 's and 's. Thus, statement is false.2. (): This grammar generates strings of the form for . This can be represented by the regular expression . Since it can be represented by a regular expression, it is a regular language. Thus, statement is true.Conclusion: is false and is true.28
Q28MCQ1 markMediumConsider the following types of languages: : Regular, : Context-free, : Recursive, : Recursively enumerable. Which of the following is/are TRUE? I.…Think it through. Then check your answer.Question
Consider the following types of languages: : Regular, : Context-free, : Recursive, : Recursively enumerable. Which of the following is/are TRUE?I. is recursively enumerable
II. is recursive
III. is context-free
IV. is context-freeCorrect answer
(D) I, II and III only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze each statement:- I. is recursively enumerable:
- is Recursive. The complement of a Recursive language () is also Recursive.
- Recursive languages are a subset of Recursively Enumerable (RE) languages.
- is RE.
- The union of two RE languages is RE. Since is Recursive (thus RE) and is RE, their union is RE.
- True.
- II. is recursive:
- is Context-Free (CFL). CFLs are a subset of Recursive languages.
- The complement of a CFL () is not necessarily CFL, but it is definitely Recursive (since Recursive languages are closed under complement).
- is Recursive.
- The union of two Recursive languages is Recursive.
- True.
- III. is context-free:
- is Regular. The Kleene star of a Regular language () is Regular.
- is CFL.
- The intersection of a Regular language and a CFL is always a CFL (Closure property).
- True.
- IV. is context-free:
- is Regular.
- is the complement of a CFL. The class of CFLs is not closed under complementation, so is not necessarily Context-Free.
- The union of a Regular language and a non-CFL is not guaranteed to be Context-Free.
- False.
29
Q29MCQ1 markEasyMatch the following: | | | | :--- | :--- | | (P) Lexical analysis | (i) Leftmost derivation | | (Q) Top down parsing | (ii) Type checking | | (R) Semantic analysis | (iii) Regular…Think it through. Then check your answer.Question
Match the following:(P) Lexical analysis (i) Leftmost derivation (Q) Top down parsing (ii) Type checking (R) Semantic analysis (iii) Regular expressions (S) Runtime environments (iv) Activation records Correct answer
(B) P rightarrow iii, Q rightarrow i, R rightarrow ii, S rightarrow iv
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The correct matching is:- (P) Lexical analysis: Uses (iii) Regular expressions to define tokens.
- (Q) Top down parsing: Uses (i) Leftmost derivation to generate the string.
- (R) Semantic analysis: Performs (ii) Type checking to ensure type compatibility.
- (S) Runtime environments: Manage memory using (iv) Activation records (stack frames) for function calls.
30
Q30MCQ1 markEasyIn which one of the following page replacement algorithms it is possible for the page fault rate to increase even when the number of allocated frames increases?Think it through. Then check your answer.Question
In which one of the following page replacement algorithms it is possible for the page fault rate to increase even when the number of allocated frames increases?Correct answer
(D) FIFO (First In First Out)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The phenomenon where the page fault rate increases as the number of allocated frames increases is known as Belady's Anomaly. This anomaly is characteristic of the FIFO (First In First Out) page replacement algorithm. Stack-based algorithms like LRU and OPT do not suffer from Belady's Anomaly.31
Q31MCQ1 markEasyB+ Trees are considered BALANCED becauseThink it through. Then check your answer.Question
B+ Trees are considered BALANCED becauseCorrect answer
(A) the lengths of the paths from the root to all leaf nodes are all equal.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A B+ Tree is a self-balancing tree data structure. The defining property that makes it "balanced" is that all leaf nodes are at the same depth. This means the length of the path from the root to any leaf node is exactly the same.32
Q32MCQ1 markEasySuppose a database schedule involves transactions . Construct the precedence graph of with vertices representing the transactions and edges representing…Think it through. Then check your answer.Question
Suppose a database schedule involves transactions . Construct the precedence graph of with vertices representing the transactions and edges representing the conflicts. If is serializable, which one of the following orderings of the vertices of the precedence graph is guaranteed to yield a serial schedule?Correct answer
(A) Topological order
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A schedule is conflict serializable if and only if its precedence graph is acyclic. If the precedence graph is acyclic, a topological sort of the graph yields a linear ordering of transactions that corresponds to a serial schedule conflict-equivalent to . Therefore, the topological order of the precedence graph guarantees a serial schedule.33
Q33MCQ1 markEasyAnarkali digitally signs a message and sends it to Salim. Verification of the signature by Salim requiresThink it through. Then check your answer.Question
Anarkali digitally signs a message and sends it to Salim. Verification of the signature by Salim requiresCorrect answer
(A) Anarkali's public key.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a digital signature scheme, the sender (Anarkali) signs the message (or its hash) using her private key. The receiver (Salim) verifies the signature using the sender's public key. This ensures that the message was indeed created by the sender (authenticity) and has not been altered (integrity).34
Q34MCQ1 markMediumIn an Ethernet local area network, which one of the following statements is TRUE?Think it through. Then check your answer.Question
In an Ethernet local area network, which one of the following statements is TRUE?Correct answer
(D) The exponential backoff mechanism reduces the probability of collision on retransmissions.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In CSMA/CD (Carrier Sense Multiple Access with Collision Detection):- A station must listen to the channel while transmitting to detect collisions. If it stops sensing, it cannot detect collisions. Thus, (A) is false.
- The jamming signal is a short signal sent by a station that detects a collision to ensure that all other stations on the network are aware of the collision and discard the frame. Padding is used to extend a frame to the minimum size (64 bytes) before transmission, not by the jamming signal. Thus, (B) is false.
- When a collision is detected, the station immediately stops transmitting the data packet and sends the jamming signal. It does not continue transmitting the packet. Thus, (C) is false.
- The binary exponential backoff algorithm is used to schedule retransmissions after a collision. It chooses a random backoff time from an interval that doubles in size with each consecutive collision ( to ). This spreads out the retransmission attempts of colliding stations, reducing the probability of another collision. Thus, (D) is true.
35
Q35MCQ1 markEasyIdentify the correct sequence in which the following packets are transmitted on the network by a host when a browser requests a webpage from a remote server, assuming that the…Think it through. Then check your answer.Question
Identify the correct sequence in which the following packets are transmitted on the network by a host when a browser requests a webpage from a remote server, assuming that the host has just been restarted.Correct answer
(C) DNS query, TCP SYN, HTTP GET request
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
When a host has just been restarted, its DNS cache is empty. Therefore, the sequence of events is:1.DNS query: The browser needs to resolve the domain name of the remote server to an IP address.2.TCP SYN: Once the IP address is obtained, the host initiates a TCP connection with the server using the 3-way handshake (SYN, SYN-ACK, ACK).3.HTTP GET request: After the TCP connection is established, the browser sends the HTTP GET request to fetch the webpage.Thus, the correct sequence is DNS query TCP SYN HTTP GET request.36
Q36MCQ2 marksMediumA binary relation on is defined as follows: if or . Consider the following propositions: P: is reflexive Q:…Think it through. Then check your answer.Question
A binary relation on is defined as follows: if or . Consider the following propositions:P: is reflexive
Q: is transitiveWhich one of the following statements is TRUE?Correct answer
(B) P is true and Q is false.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We are given the relation on defined by .Reflexivity (P):
For to be reflexive, must be true for all .
.
Since is always true, the disjunction is true. Thus, is reflexive. P is true.Transitivity (Q):
For to be transitive, if and , then .
Let's look for a counterexample.
Let .
Let .
Let .1.Check : . Since is true, this holds.2.Check : . Since is true, this holds.3.Check : . Both are false, so this does not hold.Since we found a counterexample, is not transitive. Q is false.Therefore, P is true and Q is false.37
Q37MCQ2 marksMediumWhich one of the following well-formed formulae in predicate calculus is NOT valid?Think it through. Then check your answer.Question
Which one of the following well-formed formulae in predicate calculus is NOT valid?Correct answer
(D) ∀ x (p(x) ∨ q(x)) ⇒ (∀ x p(x) ∨ ∀ x q(x))
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze each option:(A)
The consequent is equivalent to , which is equivalent to .
Thus, the formula is of the form , which is a tautology (valid).(B)
Existential quantification distributes over disjunction. . This is valid.(C)
If there exists an such that both and are true, then certainly there exists an (the same one) such that is true, and there exists an such that is true. This is valid.(D)
This is NOT valid. Universal quantification does not distribute over disjunction.
Counterexample: Let the domain be integers. Let be " is even" and be " is odd".
is true (every integer is either even or odd).
However, is false (not all are even) and is false (not all are odd).
So the consequent is false while the antecedent is true. The implication fails.38
Q38MCQ2 marksMediumConsider a set of 23 different compounds in a Chemistry lab. There is a subset of of 9 compounds, each of which reacts with exactly 3 compounds of . Consider the…Think it through. Then check your answer.Question
Consider a set of 23 different compounds in a Chemistry lab. There is a subset of of 9 compounds, each of which reacts with exactly 3 compounds of . Consider the following statements:I. Each compound in reacts with an odd number of compounds.
II. At least one compound in reacts with an odd number of compounds.
III. Each compound in reacts with an even number of compounds.Which one of the above statements is ALWAYS TRUE?Correct answer
(B) Only II
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the compounds be vertices in a graph where an edge represents a reaction. Let be the set of vertices, so . Let with . We are given that for every vertex , the degree .Let be the set of the remaining vertices. The size of this set is .By the Handshaking Lemma, the sum of degrees in a graph is equal to twice the number of edges, which is always an even number:Splitting the sum into vertices in and vertices in :Substitute the known values for :So:Since 27 is odd, for the sum to be even, the term must be odd (because Odd + Odd = Even).If the sum of a set of integers is odd, then at least one of the integers must be odd. It is not possible for all of them to be even (which makes Statement III false). It is not necessary for all of them to be odd (Statement I is not necessarily true; e.g., one could be odd and the rest even).Therefore, Statement II ("At least one compound in reacts with an odd number of compounds") is always true.39
Q39NAT2 marksMediumThe value of the expression , in the range 0 to 16, is ________.Think it through. Then check your answer.Question
The value of the expression , in the range 0 to 16, 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
To find the value of :1.Identify the modulus: The modulus is 17, which is a prime number.2.Apply Fermat's Little Theorem: Since 17 is prime and 13 is not divisible by 17, we have:3.Reduce the exponent: We divide the exponent 99 by 16 to find the remainder:So, .4.Simplify the expression:Substituting the result from Fermat's Little Theorem:
5.Calculate :
To bring into the range 0 to 16:
Thus, the value of in the range 0 to 16 is 4.40
Q40NAT2 marksMediumSuppose the functions and can be computed in 5 and 3 nanoseconds by functional units and , respectively. Given two instances of and two instances of…Think it through. Then check your answer.Question
Suppose the functions and can be computed in 5 and 3 nanoseconds by functional units and , respectively. Given two instances of and two instances of , it is required to implement the computation for . Ignoring all other delays, the minimum time required to complete this computation is ________ nanoseconds.Correct answer
28 to 28
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We have 10 tasks, where each task consists of computing (taking 3 ns) followed by (taking 5 ns). We have 2 units of and 2 units of .Step 1: Schedule G operations
Since there are 2 units, we can process 2 operations in parallel. Each batch of 2 takes 3 ns.- : Start at 0, Finish at 3 ns
- : Start at 3, Finish at 6 ns
- : Start at 6, Finish at 9 ns
- : Start at 9, Finish at 12 ns
- : Start at 12, Finish at 15 ns
operations can only start after the corresponding operation is complete AND a unit is available. There are 2 units, taking 5 ns each.- Batch 1 ():
- Ready at 3 ns. available at 0.
- Start at ns.
- Finish at ns.
- Batch 2 ():
- Ready at 6 ns. available at 8 ns (when Batch 1 finishes).
- Start at ns.
- Finish at ns.
- Batch 3 ():
- Ready at 9 ns. available at 13 ns.
- Start at ns.
- Finish at ns.
- Batch 4 ():
- Ready at 12 ns. available at 18 ns.
- Start at ns.
- Finish at ns.
- Batch 5 ():
- Ready at 15 ns. available at 23 ns.
- Start at ns.
- Finish at ns.
41
Q41NAT2 marksMediumConsider a processor with 64 registers and an instruction set of size twelve. Each instruction has five distinct fields, namely, opcode, two source register identifiers, one…Think it through. Then check your answer.Question
Consider a processor with 64 registers and an instruction set of size twelve. Each instruction has five distinct fields, namely, opcode, two source register identifiers, one destination register identifier, and a twelve-bit immediate value. Each instruction must be stored in memory in a byte-aligned fashion. If a program has 100 instructions, the amount of memory (in bytes) consumed by the program text is ________ .Correct answer
500 to 500
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Calculate bits required for each field:- Opcode: For an instruction set of size 12, we need bits.
- Registers: For 64 registers, we need bits per register identifier.
- Immediate value: Given as 12 bits.
- Opcode: 4 bits
- Source Register 1: 6 bits
- Source Register 2: 6 bits
- Destination Register: 6 bits
- Immediate: 12 bits
- Total = bits.
- The problem states instructions are stored in a byte-aligned fashion. This means each instruction must occupy an integer number of bytes.
- Size in bytes = bytes.
- Total memory = Number of instructions Size per instruction
- Total memory = bytes.
42
Q42NAT2 marksMediumThe width of the physical address on a machine is 40 bits. The width of the tag field in a 512 KB 8-way set associative cache is ________ bits.Think it through. Then check your answer.Question
The width of the physical address on a machine is 40 bits. The width of the tag field in a 512 KB 8-way set associative cache is ________ bits.Correct answer
24 to 24
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Identify given parameters:- Physical Address () width = 40 bits.
- Cache Size () = 512 KB = bytes = bytes.
- Associativity () = 8-way = .
- The physical address is split into Tag, Set Index, and Block Offset.
- .
- We need to find the Tag width.
- Number of Sets () = .
- Let Block Size be bytes ().
- .
- Set Index bits = .
- Offset bits = .
- Sum of Index and Offset = bits.
- bits.
43
Q43NAT2 marksMediumConsider a 3 GHz (gigahertz) processor with a three-stage pipeline and stage latencies , , and such that . If the longest…Think it through. Then check your answer.Question
Consider a 3 GHz (gigahertz) processor with a three-stage pipeline and stage latencies , , and such that . If the longest pipeline stage is split into two pipeline stages of equal latency, the new frequency is ________ GHz, ignoring delays in the pipeline registers.Correct answer
3.9 to 4.1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Determine current stage latencies:- Current frequency = 3 GHz.
- Cycle time ns.
- In a pipeline, the cycle time is determined by the longest stage latency. Thus, ns.
- Given relations: and .
- Express all in terms of :
- Since is the largest multiple of , is the longest stage.
- Therefore, ns.
- ns.
- ns.
- The longest stage ( ns) is split into two equal stages.
- New latencies for these split stages: ns.
- The new stages have latencies: ns, ns, ns, ns.
- New max latency ns (since ).
- New Frequency = GHz.
44
Q44NAT2 marksMediumA complete binary min-heap is made by including each integer in exactly once. The depth of a node in the heap is the length of the path from the root of the heap to…Think it through. Then check your answer.Question
A complete binary min-heap is made by including each integer in exactly once. The depth of a node in the heap is the length of the path from the root of the heap to that node. Thus, the root is at depth 0. The maximum depth at which integer 9 can appear 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
In a min-heap, every node must be smaller than its children. Therefore, for a node with value to appear at depth , all ancestors on the path from the root to this node must have values strictly smaller than . Since the values in the heap are distinct integers starting from 1, the smallest possible values for the ancestors are . Thus, to place the value at depth , we must have at least integers smaller than . This implies:Given , the maximum possible depth is:The heap contains 1023 nodes, which corresponds to a full binary tree of depth . Since depth 8 exists in the tree, it is possible to arrange the numbers such that 9 appears at depth 8 (e.g., the path ).Thus, the maximum depth is 8.45
Q45MCQ2 marksMediumThe following function computes for positive integers X and Y. [code] Which one of the following conditions is TRUE before every iteration of the loop?Think it through. Then check your answer.Question
The following function computes for positive integers X and Y.Which one of the following conditions is TRUE before every iteration of the loop?int exp(int X, int Y) { int res = 1, a = X, b = Y; while ( b != 0 ){ if ( b%2 == 0) { a = a*a; b = b/2; } else { res = res*a; b = b-1; } } return res; }Correct answer
(C) X^Y = res a^b
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We analyze the loop invariant. We want to compute . The variables are initialized asres = 1,a = X,b = Y.Initially: . This holds.Inside the loop, there are two cases:1.b is even:abecomes andbbecomes . The term becomes . The value remains unchanged.2.b is odd:Thus, the invariant holds before every iteration.resbecomes andbbecomes . The term becomes . The value remains unchanged.46
Q46MCQ2 marksMediumConsider the following New-order strategy for traversing a binary tree: Visit the root; Visit the right subtree using New-order; * Visit the left subtree using New-order; The…Think it through. Then check your answer.Question
Consider the following New-order strategy for traversing a binary tree:- Visit the root;
- Visit the right subtree using New-order;
- Visit the left subtree using New-order;
Correct answer
(C) - + 1 7 6 2 - 5 4 3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
First, we construct the expression tree from the Reverse Polish (postfix) expression: Tree Construction:1.Push 3, 4.*Node*(left: 3, right: 4).2.Push 5.-Node-(left:*, right: 5).3.Push 2.^Node^(left:-, right: 2).4.Push 6, 7.*Node*(left: 6, right: 7).5.Push 1.+Node+(left:*, right: 1).6.New-order Traversal (Root, Right, Left):-Root Node-(left:^, right:+).1.Visit Root: -2.Visit Right Subtree (+):- Root: +
- Right: 1
- Left (
*): Root \*, Right 7, Left 6 \* 7 6 - Subtree result: + 1 * 7 6
^):- Root: ^
- Right: 2
- Left (
-): Root -, Right 5, Left (*): Root \*, Right 4, Left 3 \* 4 3 - Subtree result: ^ 2 - 5 * 4 3
47
Q47NAT2 marksMediumConsider the following program: [code] Note: returns the maximum of and . The value printed by this program is ______.Think it through. Then check your answer.Question
Consider the following program:Note: returns the maximum of and .The value printed by this program is ______.int f(int *p, int n) { if (n <= 1) return 0; else return max(f(p+1,n-1),p[0]-p[1]); } int main() { int a[] = {3,5,2,6,4}; printf("%d", f(a,5)); }Correct answer
3 to 3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The function recursively computes the maximum difference for the array and its suffixes.Trace fora[] = {3, 5, 2, 6, 4}:1.f(a, 5)callsmax(f(a+1, 4), 3-5=-2)2.f(a+1, 4)callsmax(f(a+2, 3), 5-2=3)3.f(a+2, 3)callsmax(f(a+3, 2), 2-6=-4)4.f(a+3, 2)callsmax(f(a+4, 1), 6-4=2)5.Unwinding:f(a+4, 1)returns 0 (base case )f(a+3, 2) = max(0, 2) = 2f(a+2, 3) = max(2, -4) = 2f(a+1, 4) = max(2, 3) = 3f(a, 5) = max(3, -2) = 3
48
Q48NAT2 marksMediumLet , and be four matrices of dimensions , and , respectively. The minimum number of scalar…Think it through. Then check your answer.Question
Let , and be four matrices of dimensions , and , respectively. The minimum number of scalar multiplications required to find the product using the basic matrix multiplication method is ______.Correct answer
1500 to 1500
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Matrix dimensions: .
Cost .Chain Length 2:
Chain Length 3:
Chain Length 4:
Minimum cost is 1500.49
Q49NAT2 marksHardThe given diagram shows the flowchart for a recursive function . Assume that all statements, except for the recursive calls, have time complexity. If the worst case…Think it through. Then check your answer.Question
The given diagram shows the flowchart for a recursive function . Assume that all statements, except for the recursive calls, have time complexity. If the worst case time complexity of this function is , then the least possible value (accurate up to two decimal positions) of is ______.
Correct answer
2.2 to 2.4
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The worst-case time complexity is determined by the path in the flowchart that generates the maximum number of recursive calls.Tracing the longest path:1.Start (1st call)2.Right branch (2nd call) (3rd call)3.Down branch (4th call)4.Left branch (5th call) ReturnTotal recursive calls per step: 5.
Recurrence relation: .
Using Master Theorem: .
.
Rounded to two decimal places: 2.32.50
Q50NAT2 marksMediumA file system uses an in-memory cache to cache disk blocks. The miss rate of the cache is shown in the figure. The latency to read a block from the cache is 1 ms and to read a…Think it through. Then check your answer.Question
A file system uses an in-memory cache to cache disk blocks. The miss rate of the cache is shown in the figure. The latency to read a block from the cache is 1 ms and to read a block from the disk is 10 ms. Assume that the cost of checking whether a block exists in the cache is negligible. Available cache sizes are in multiples of 10 MB.The smallest cache size required to ensure an average read latency of less than 6 ms is ______ MB.
Correct answer
64 to 64
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the hit rate and be the miss rate ().
The average read latency is given by:Given:
ms
ms
We require ms.Substituting the values:So, the miss rate must be less than .Looking at the graph:- At 10 MB, Miss rate
- At 20 MB, Miss rate
- At 30 MB, Miss rate
51
Q51MCQ2 marksMediumIn an adjacency list representation of an undirected simple graph , each edge has two adjacency list entries: in the adjacency list of , and in…Think it through. Then check your answer.Question
In an adjacency list representation of an undirected simple graph , each edge has two adjacency list entries: in the adjacency list of , and in the adjacency list of . These are called twins of each other. A twin pointer is a pointer from an adjacency list entry to its twin. If and , and the memory size is not a constraint, what is the time complexity of the most efficient algorithm to set the twin pointer in each entry in each adjacency list?Correct answer
(B) Θ(n+m)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We need to link each adjacency entry with its twin . There are such entries in total.An efficient algorithm is as follows:1.Create a list of all adjacency entries. Each entry stores the vertices and a pointer to the node in the adjacency list.2.For each entry representing edge , define a canonical key, e.g., .3.Sort the list of entries based on this key. Since the vertex indices are integers in the range , we can use Radix Sort or Bucket Sort.4.The sorting takes time (since there are items and range is ).5.After sorting, the twin entries and will be adjacent in the sorted list. We can iterate through the list and link them in time.Total time complexity is .52
Q52MCQ2 marksMediumConsider the following two statements: I. If all states of an NFA are accepting states then the language accepted by the NFA is . II. There exists a regular language …Think it through. Then check your answer.Question
Consider the following two statements:I. If all states of an NFA are accepting states then the language accepted by the NFA is .
II. There exists a regular language such that for all languages , is regular.Which one of the following is CORRECT?Correct answer
(B) Only II is true
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement I is False:
An NFA accepts a string if there exists at least one path from the start state to an accepting state on input . Even if all states are accepting, it is possible that for some input string, there are no valid transitions defined (i.e., the path "dies"). In such a case, the string is not accepted. For example, an NFA with one state (accepting) and no transitions accepts only , not .Statement II is True:
We need to find one regular language such that is regular for any language . Consider the empty language . Since is regular, and for any language , , the result is always regular. Alternatively, any finite language works because the intersection of a finite language with any language is finite, and all finite languages are regular.Thus, only statement II is true.53
Q53MCQ2 marksMediumConsider the following languages: Which one of the following is TRUE?Think it through. Then check your answer.Question
Consider the following languages:Which one of the following is TRUE?Correct answer
(B) L₁ is context-free while L₂ is not context-free.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Analyze :This language can be rewritten as . A Pushdown Automaton (PDA) can recognize this language:- Push 's onto the stack.
- Push 's onto the stack.
- For every read, pop a . If 's are exhausted, pop an .
- If the stack is empty and input is consumed, accept.
2.Analyze :This language requires checking two dependencies: the number of 's equals the number of 's, AND the number of 's is twice the number of 's (or 's). A standard PDA can match 's and 's, but then the stack would be empty (or lose the count) to check against 's. Alternatively, it can't compare three groups of symbols dependent on the same simultaneously (, , ). This is a classic example of a non-CFL (similar to ). It can be proven non-CFL using the Pumping Lemma.Conclusion: is context-free, but is not context-free.54
Q54MCQ2 marksMediumConsider the following languages. …Think it through. Then check your answer.Question
Consider the following languages.where for each Turing machine , denotes a specific encoding of . Which one of the following is TRUE?Correct answer
(C) L₁, L₂ are recursive and L₃ is not recursive
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Analyze : " takes at least 2016 steps on some input".To decide this, we only need to check inputs of length up to 2016. If takes steps, it does so by reading at most the first 2016 symbols. If halts in fewer than 2016 steps on all inputs of length , it will halt in fewer than 2016 steps on all inputs (since it won't reach further symbols). Since the alphabet is finite, there are finitely many inputs of length . We can simulate on all such inputs for 2016 steps. This process is finite and guaranteed to terminate. Thus, is recursive (decidable).2.Analyze : " takes at least 2016 steps on all inputs".Similar to , if halts in steps on any input, it must do so on an input of length . We can check all inputs of length . If takes steps on all of them, then it takes steps on all inputs. This check is finite. Thus, is recursive (decidable).3.Analyze : " accepts ".This is the Halting Problem (specifically, the acceptance problem) restricted to the empty string input. It is well-known to be undecidable (recursively enumerable but not recursive).Conclusion: and are recursive, but is not.55
Q55MCQ2 marksMediumWhich one of the following grammars is free from left recursion?Think it through. Then check your answer.Question
Which one of the following grammars is free from left recursion?Correct answer
(B) S → Ab Bb c A → Bd ε B → e
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We check each grammar for left recursion (direct or indirect):(A) . This has direct left recursion in the production .(B)
Substitute into : .
Substitute and into : .
None of the productions exhibit left recursion. This grammar is free from left recursion.(C)
Consider . This is indirect left recursion ().(D)
Substitute into : .
This introduces direct left recursion in ().Therefore, only grammar (B) is free from left recursion.56
Q56MCQ2 marksMediumA student wrote two context-free grammars G1 and G2 for generating a single C-like array declaration. The dimension of the array is at least one. For example, `int…Think it through. Then check your answer.Question
A student wrote two context-free grammars G1 and G2 for generating a single C-like array declaration. The dimension of the array is at least one. For example,int a[10][3];The grammars use as the start symbol, and use six terminal symbols int ; id [ ] num.Grammar G1
Grammar G2
Which of the grammars correctly generate the declaration mentioned above?Correct answer
(A) Both G1 and G2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Both grammars generate the language of C-like array declarations correctly.For G1:
can generate or . This is right-recursive. It generates strings likeint id [num];,int id [num][num];, etc.For G2:
can generate or . This is left-recursive. It generates strings likeint id [num];,int id [num][num];, etc.Both grammars generate the correct sequence of tokens for array declarations.57
Q57NAT2 marksMediumConsider the following processes, with the arrival time and the length of the CPU burst given in milliseconds. The scheduling algorithm used is preemptive shortest remaining-time…Think it through. Then check your answer.Question
Consider the following processes, with the arrival time and the length of the CPU burst given in milliseconds. The scheduling algorithm used is preemptive shortest remaining-time first.The average turn around time of these processes is ________ milliseconds.Process Arrival Time Burst Time 0 10 3 6 7 1 8 3 Correct answer
8.2 to 8.3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The scheduling algorithm is Preemptive Shortest Remaining Time First (SRTF).Gantt Chart Execution:1.Time 0: arrives (Burst=10). starts.2.Time 3: arrives (Burst=6). has run for 3ms, remaining burst = . Comparing remaining times: . is preempted. starts.3.Time 7: arrives (Burst=1). has run for 4ms (from 3 to 7), remaining burst = . Comparing remaining times: . is preempted. starts.4.Time 8: arrives (Burst=3). has run for 1ms (from 7 to 8), remaining burst = . completes.Ready queue: . Comparing remaining times: . resumes.5.Time 10: runs for 2ms (from 8 to 10), remaining burst = . completes.Ready queue: . Comparing remaining times: . starts.6.Time 13: runs for 3ms (from 10 to 13), remaining burst = . completes.Ready queue: . resumes.7.Time 20: runs for 7ms (from 13 to 20), remaining burst = . completes.Completion Times (CT):- : 20 ms
- : 10 ms
- : 8 ms
- : 13 ms
- : ms
- : ms
- : ms
- : ms
58
Q58MCQ2 marksMediumConsider the following two-process synchronization solution. [code] The shared variableturnis initialized to zero. Which one of the following is TRUE?Think it through. Then check your answer.Question
Consider the following two-process synchronization solution.The shared variableProcess 0 --------- Entry: loop while (turn == 1); (critical section) Exit: turn = 1; Process 1 ---------- Entry: loop while (turn == 0); (critical section) Exit: turn = 0;turnis initialized to zero. Which one of the following is TRUE?Correct answer
(C) This solution violates progress requirement.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
This is the Strict Alternation approach.- Mutual Exclusion: Satisfied. Only one process can enter the critical section depending on the value of
turn. - Progress: Violated. If Process 0 is not interested in entering the critical section (or crashes outside the CS),
turnremains 0. Process 1 cannot enter even if the CS is free, because it waits forturn == 1. Thus, a process outside the critical section blocks another process from entering. - Bounded Waiting: Satisfied. There is a strict bound (alternation) on waiting.
- Mutual Exclusion: Satisfied. Only one process can enter the critical section depending on the value of
59
Q59NAT2 marksMediumConsider a non-negative counting semaphore . The operationP(S)decrements , andV(S)increments . During an execution,P(S)operations andV(S)…Think it through. Then check your answer.Question
Consider a non-negative counting semaphore . The operationP(S)decrements , andV(S)increments . During an execution,P(S)operations andV(S)operations are issued in some order. The largest initial value of for which at least oneP(S)operation will remain blocked 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
Let the initial value of the semaphore be .
Number ofP(S)operations (decrement) = 20.
Number ofV(S)operations (increment) = 12.The total number of resources required by the operations is 20.
The total number of resources available to satisfy these requests is the initial resources plus the resources released by operations:
Total Available = For at least oneP(S)operation to remain blocked, the total available resources must be strictly less than the total required resources:
Since we are looking for the largest initial value of that satisfies this condition, and must be an integer:
Thus, if , total available is . Since 20 resources are needed, 1 process will remain blocked.60
Q60NAT2 marksMediumA file system uses an in-memory cache to cache disk blocks. The miss rate of the cache is shown in the figure. The latency to read a block from the cache is ms and to read a…Think it through. Then check your answer.Question
A file system uses an in-memory cache to cache disk blocks. The miss rate of the cache is shown in the figure. The latency to read a block from the cache is ms and to read a block from the disk is ms. Assume that the cost of checking whether a block exists in the cache is negligible. Available cache sizes are in multiples of MB.
The smallest cache size required to ensure an average read latency of less than ms is _______ MB.Correct answer
30 to 30
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the hit rate and be the miss rate ().
Cache access time ms.
Disk access time ms.
Average read latency is given by:We require ms:So, the miss rate must be less than .Looking at the graph provided in the question:- At Cache Size = 10 MB, Miss Rate
- At Cache Size = 20 MB, Miss Rate
- At Cache Size = 30 MB, Miss Rate
61
Q61MCQ2 marksMediumConsider the following database schedule with two transactions, and . where denotes a read…Think it through. Then check your answer.Question
Consider the following database schedule with two transactions, and .where denotes a read operation by transaction on a variable , denotes a write operation by on a variable and denotes an abort by transaction .
Which one of the following statements about the above schedule is TRUE?Correct answer
(C) S does not have a cascading abort
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze the schedule :1.2.3.4.5.6.7. (Abort )8. (Abort )Recoverability: A schedule is recoverable if for every transaction that reads a value written by , commits before commits. In this schedule, there are no "dirty reads" (reading a value written by an uncommitted transaction). reads and before any writes occur. reads and before any writes occur. Since no transaction reads from another, the schedule is trivially recoverable.Cascading Abort: A cascading abort occurs if reads a value written by , and then aborts, forcing to abort. Since there are no read dependencies (no transaction reads data written by another uncommitted transaction), there is no cascading abort. The fact that both abort is independent of data dependencies. Thus, does not have a cascading abort (it is ACA - Avoids Cascading Aborts).Strictness: A schedule is strict if a transaction can neither read nor write a data item until the last transaction that wrote has committed or aborted. Here, writes at step 4 (). Then writes at step 6 (). At step 6, has not yet committed or aborted. Thus, overwrites an uncommitted value. This violates the strict property.Therefore, statement (C) is true.62
Q62NAT2 marksMediumConsider the following database table named water_schemes : | scheme_no | district_name | capacity | | :--- | :--- | :--- | | 1 | Ajmer | 20 | | 1 | Bikaner | 10 | | 2 | Bikaner…Think it through. Then check your answer.Question
Consider the following database table named water_schemes :The number of tuples returned by the following SQL query is _______.scheme_no district_name capacity 1 Ajmer 20 1 Bikaner 10 2 Bikaner 10 3 Bikaner 20 1 Churu 10 2 Churu 20 1 Dungargarh 10 with total(name, capacity) as select district_name, sum(capacity) from water_schemes group by district_name with total_avg(capacity) as select avg(capacity) from total select name from total, total_avg where total.capacity >= total_avg.capacityCorrect answer
2 to 2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.First, we compute thetotalCTE which groups bydistrict_nameand sums thecapacity:- Ajmer:
- Bikaner:
- Churu:
- Dungargarh:
total_avgCTE which calculates the average capacity from thetotalresults:- Average =
totalwhere the capacity is greater than or equal to the average ():- Bikaner (): Included
- Churu (): Included
- Ajmer (): Excluded
- Dungargarh (): Excluded
63
Q63NAT2 marksMediumA network has a data transmission bandwidth of bits per second. It uses CSMA/CD in the MAC layer. The maximum signal propagation time from one node to another…Think it through. Then check your answer.Question
A network has a data transmission bandwidth of bits per second. It uses CSMA/CD in the MAC layer. The maximum signal propagation time from one node to another node is microseconds. The minimum size of a frame in the network is _______ bytes.Correct answer
200 to 200
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a CSMA/CD network, the minimum frame size () must be large enough to ensure that a collision can be detected by the sender before it finishes transmitting the frame. The condition is:Where:- is the propagation delay = s
- is the bandwidth = bits/s
64
Q64MCQ2 marksMediumFor the IEEE 802.11 MAC protocol for wireless communication, which of the following statements is/are TRUE? I. At least three non-overlapping channels are available for…Think it through. Then check your answer.Question
For the IEEE 802.11 MAC protocol for wireless communication, which of the following statements is/are TRUE?I. At least three non-overlapping channels are available for transmissions.
II. The RTS-CTS mechanism is used for collision detection.
III. Unicast frames are ACKed.Correct answer
(B) I and III only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement I is TRUE: In the 2.4 GHz ISM band used by 802.11b/g, there are 11 channels (in the US), and channels 1, 6, and 11 are non-overlapping.Statement II is FALSE: The RTS-CTS (Request to Send / Clear to Send) mechanism is used for collision avoidance (CSMA/CA), specifically to address the hidden terminal problem. Collision detection (CD) is not feasible in wireless networks because the transmitter's own signal would drown out any incoming collision signal (half-duplex nature and high attenuation).Statement III is TRUE: Unlike Ethernet, IEEE 802.11 requires an explicit link-layer acknowledgement (ACK) for every successfully received unicast frame to ensure reliability over the noisy wireless medium.Therefore, only I and III are true.65
Q65NAT2 marksMediumConsider a bits/second satellite communication link with one way propagation delay of 150 milliseconds. Selective retransmission (repeat) protocol is used on…Think it through. Then check your answer.Question
Consider a bits/second satellite communication link with one way propagation delay of 150 milliseconds. Selective retransmission (repeat) protocol is used on this link to send data with a frame size of 1 kilobyte. Neglect the transmission time of acknowledgement. The minimum number of bits required for the sequence number field to achieve 100% utilization 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
Given:
Bandwidth bits/sec = 128 kbps.
Propagation delay ms.
Frame size kilobyte. Assuming .Transmission time .Let .For 100% utilization (efficiency ), the sender window size must be at least .Since the window size must be an integer, we take .In the Selective Repeat (SR) protocol, the receiver window size is typically equal to the sender window size . Thus, .The available sequence number space must satisfy the condition:The number of bits required for the sequence number field is:(Note: Even if we assume , , , , , leading to the same result.)