The PYQ practice room
GATE CS 2021 Set 2
All 65 solved GATE CS 2021 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
3
MCQ · NAT · MSQ
Revision mode
Self-paced
No timer. Focus on understanding.
Explore the questions
General Aptitude (GA)
101
Q1MCQ1 markEasyGauri said that she can play the keyboard ___________ her sister.Think it through. Then check your answer.Question
Gauri said that she can play the keyboard ___________ her sister.Correct answer
(A) as well as
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The sentence is used to convey that Gauri, in addition to her sister, can play the keyboard. The phrase 'as well as' is a conjunction that means 'in addition to'.Let's analyze the options:
(A) as well as: This is the correct choice. "Gauri said that she can play the keyboard as well as her sister" means both Gauri and her sister can play the keyboard.
(B) as better as: This is grammatically incorrect. The correct comparative form is "better than" or for equality, "as good as".
(C) as nicest as: This is grammatically incorrect. The superlative form "nicest" cannot be used in an "as...as" construction. The correct form would be "as nice as".
(D) as worse as: This is grammatically incorrect. The correct comparative form is "worse than" or for equality, "as bad as".Therefore, "as well as" is the only grammatically correct and contextually appropriate option.2
Q2MCQ1 markEasy[figure] A transparent square sheet shown above is folded along the dotted line. The folded sheet will look like ________.Think it through. Then check your answer.Question
A transparent square sheet shown above is folded along the dotted line. The folded sheet will look like ________.
Correct answer
(B) [figure]
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
When a transparent sheet is folded along a line, the patterns on one side are reflected onto the other side.1.The original sheet has a vertical dotted line in the center.2.The left half contains a pattern resembling a 'V' shape pointing left ().3.The right half contains a curved line.4.When the sheet is folded along the dotted line (from left to right, as indicated by the options showing only the right half), the pattern on the left half is horizontally reflected. The '' shape becomes a '' shape on the right half.5.Superimposing this reflected pattern onto the existing curve on the right half results in the image shown in option (B).3
Q3MCQ1 markEasyIf is the angle, in degrees, between the longest diagonal of the cube and any one of the edges of the cube, then, =Think it through. Then check your answer.Question
If is the angle, in degrees, between the longest diagonal of the cube and any one of the edges of the cube, then, =Correct answer
(B) 1√(3)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the angle between the longest diagonal and an edge of a cube, we can use vector analysis.1.Let's place the cube in a 3D Cartesian coordinate system with one vertex at the origin (0, 0, 0) and its edges aligned with the x, y, and z axes. Let the side length of the cube be 'a'.2.The longest diagonal (or space diagonal) connects opposite vertices. Let's consider the diagonal from the origin (0, 0, 0) to the vertex (a, a, a). The vector representing this diagonal is:3.The magnitude of the diagonal vector is:4.Now, let's consider one of the edges connected to the origin. Due to the symmetry of the cube, the angle will be the same for any edge. Let's choose the edge along the x-axis. The vector representing this edge is:5.The magnitude of the edge vector is:6.The angle between two vectors and is given by the dot product formula:7.First, calculate the dot product:8.Now, solve for :Thus, the correct option is (B).4
Q4MCQ1 markEasyIf , then the value of is:Think it through. Then check your answer.Question
If , then the value of is:Correct answer
(B) 4
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given equation: Using the identity :
Let and .
Thus, the value of is 4.5
Q5MCQ1 markEasyPen : Write :: Knife : __________ Which one of the following options maintains a similar logical relation in the above?Think it through. Then check your answer.Question
Pen : Write :: Knife : __________Which one of the following options maintains a similar logical relation in the above?Correct answer
(C) Cut
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The relationship is based on the primary function of the object.
A Pen is used to Write.
Similarly, a Knife is used to Cut.6
Q6MCQ2 marksEasyListening to music during exercise improves exercise performance and reduces discomfort. Scientists researched whether listening to music while studying can help students learn…Think it through. Then check your answer.Question
Listening to music during exercise improves exercise performance and reduces discomfort. Scientists researched whether listening to music while studying can help students learn better and the results were inconclusive. Students who needed external stimulation for studying fared worse while students who did not need any external stimulation benefited from music.Which one of the following statements is the CORRECT inference of the above passage?Correct answer
(C) Listening to music has a clear positive effect on physical exercise. Music has a positive effect on learning only in some students.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Based on the passage:1.Physical Exercise: The passage explicitly states that listening to music during exercise "improves exercise performance and reduces discomfort," indicating a clear positive effect.2.Learning: The passage states that results were "inconclusive" overall, but specifically mentions that students who did not need external stimulation "benefited from music," while others "fared worse." This implies that music has a positive effect on learning only for a specific group of students.Option (C) correctly captures both these inferences.7
Q7MCQ2 marksMedium[figure] A jigsaw puzzle has 2 pieces. One of the pieces is shown above. Which one of the given options for the missing piece when assembled will form a rectangle? The piece can…Think it through. Then check your answer.Question

A jigsaw puzzle has 2 pieces. One of the pieces is shown above. Which one of the given options for the missing piece when assembled will form a rectangle?
The piece can be moved, rotated or flipped to assemble with the above piece.Correct answer
(A) [figure]
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The given piece has a right edge with a specific pattern of indentations (notches) and protrusions (tabs). Observing from top to bottom, the pattern is: Notch, Tab, Notch, Tab.To form a solid rectangle when assembled, the missing piece must have a complementary edge (left edge) that fits perfectly into this pattern. The complementary pattern required is: Tab, Notch, Tab, Notch.- Option (A): The left edge has the pattern: Tab, Notch, Tab, Notch. This matches perfectly.
- Option (B): The left edge starts with a Notch. Incorrect.
- Option (C): The pattern does not alternate correctly to match.
- Option (D): The left edge starts with a Notch. Incorrect.
8
Q8MCQ2 marksEasyThe number of students in three classes is in the ratio 3:13:6. If 18 students are added to each class, the ratio changes to 15:35:21. The total number of students in all the…Think it through. Then check your answer.Question
The number of students in three classes is in the ratio 3:13:6. If 18 students are added to each class, the ratio changes to 15:35:21.The total number of students in all the three classes in the beginning was:Correct answer
(C) 88
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the number of students in the three classes be , , and respectively.
Total number of students initially = .According to the problem, 18 students are added to each class. The new number of students becomes:
, , and .The new ratio is given as .
We can set up an equation using the ratio of the first two classes:Simplify the fraction by dividing numerator and denominator by 5:Cross-multiply:Now, substitute into the expression for the total number of students initially:
Total students = .We can verify with the third class ratio:
Class 1:
Class 2:
Class 3:
Ratio: . Dividing by 2 gives , which matches the given ratio.Thus, the initial total number of students was 88.9
Q9MCQ2 marksMedium[figure] The number of units of a product sold in three different years and the respective net profits are presented in the figure above. The cost/unit in Year 3 was ₹ 1, which…Think it through. Then check your answer.Question
The number of units of a product sold in three different years and the respective net profits are presented in the figure above. The cost/unit in Year 3 was ₹ 1, which was half the cost/unit in Year 2. The cost/unit in Year 3 was one-third of the cost/unit in Year 1. Taxes were paid on the selling price at 10%, 13% and 15% respectively for the three years. Net profit is calculated as the difference between the selling price and the sum of cost and taxes paid in that year.The ratio of the selling price in Year 2 to the selling price in Year 3 is ________.
Correct answer
(A) 4:3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let and be the total selling prices (revenue) in Year 2 and Year 3 respectively.
Let be the cost per unit in Year 1, 2, and 3.
Let be the number of units sold.
Let be the net profit.From the graph:
Year 2: ,
Year 3: , Given:
Cost/unit in Year 3 () = ₹ 1.
.For Year 2:
Total Cost = .
Tax Rate = 13% of Selling Price ().
Net Profit = Selling Price - (Total Cost + Tax)
For Year 3:
Total Cost = .
Tax Rate = 15% of Selling Price ().
Net Profit = Selling Price - (Total Cost + Tax)
Ratio:
Ratio of selling price in Year 2 to Year 3 = .10
Q10MCQ2 marksMediumSix students P, Q, R, S, T and U, with distinct heights, compare their heights and make the following observations. Observation I: S is taller than R. Observation II: Q is the…Think it through. Then check your answer.Question
Six students P, Q, R, S, T and U, with distinct heights, compare their heights and make the following observations.Observation I: S is taller than R.
Observation II: Q is the shortest of all.
Observation III: U is taller than only one student.
Observation IV: T is taller than S but is not the tallest.The number of students that are taller than R is the same as the number of students shorter than __________.Correct answer
(C) S
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the heights of the six students be represented in descending order: .1.Observation II: Q is the shortest of all. Thus, .2.Observation III: U is taller than only one student. Since Q is the shortest, U must be taller than only Q. Thus, .3.Observation I & IV: We are given and . Combining these, we get .4.Observation IV: T is not the tallest. The remaining students are P, T, S, and R for positions . Since and T cannot be , the only possible arrangement is:- The number of students taller than R () is 3 (P, T, and S).
- We need to find a student such that the number of students shorter than them is also 3.
- Looking at the order, the students shorter than S () are R, U, and Q, which totals 3 students.
Computer Science and Information Technology (CS, Set-2)
5511
Q11MCQ1 markMediumLet be a connected undirected weighted graph. Consider the following two statements. : There exists a minimum weight edge in which is present in every minimum…Think it through. Then check your answer.Question
Let be a connected undirected weighted graph. Consider the following two statements.
: There exists a minimum weight edge in which is present in every minimum spanning tree of .
: If every edge in has distinct weight, then has a unique minimum spanning tree.Which one of the following options is correct?Correct answer
(C) S₁ is false and S₂ is true.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
is false. Consider a cycle where all edges have the same minimum weight. Any minimum spanning tree (MST) will exclude one of these edges to avoid a cycle. Therefore, no single minimum weight edge is guaranteed to be present in every MST. is true. It is a standard theorem in graph theory that if all edge weights in a connected graph are distinct, then the graph has a unique minimum spanning tree.12
Q12MCQ1 markEasyLet be a binary min-heap consisting of elements implemented as an array. What is the worst case time complexity of an optimal algorithm to find the maximum element in ?Think it through. Then check your answer.Question
Let be a binary min-heap consisting of elements implemented as an array. What is the worst case time complexity of an optimal algorithm to find the maximum element in ?Correct answer
(C) Θ(n)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a binary min-heap, the minimum element is at the root. The maximum element must be one of the leaf nodes. In a heap of size , there are leaf nodes. To find the maximum among these leaves, an algorithm must inspect each one, resulting in a worst-case time complexity of .13
Q13MCQ1 markEasyConsider the following ANSI C program: [code] Which one of the following phases in a seven-phase C compiler will throw an error?Think it through. Then check your answer.Question
Consider the following ANSI C program:Which one of the following phases in a seven-phase C compiler will throw an error?int main() { Integer x; return 0; }Correct answer
(C) Semantic analyzer
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Lexical Analyzer: Identifies tokens.Integerandxare both valid identifiers.2.Syntax Analyzer: Checks the structure. The statementInteger x;follows the syntactical rule for a variable declaration (Type Identifier;).3.Semantic Analyzer: Checks for meaning and consistency. It will look up the typeInteger. SinceIntegeris not a built-in type (likeint) and has not been defined (e.g., viatypedef), the semantic analyzer will throw an error for an undefined type.4.Optimizer: Only runs on valid code.14
Q14MCQ1 markMediumThe format of the single-precision floating-point representation of a real number as per the IEEE 754 standard is as follows: [figure] Which one of the following choices is…Think it through. Then check your answer.Question
The format of the single-precision floating-point representation of a real number as per the IEEE 754 standard is as follows:Which one of the following choices is correct with respect to the smallest normalized positive number represented using the standard?
Correct answer
(C) exponent = 00000001 and mantissa = 00000000000000000000000
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In the IEEE 754 single-precision standard:1.Normalized numbers have an exponent field range from to (binary to ). The value is reserved for zero and subnormal numbers, and is reserved for infinity and NaN.2.The smallest normalized positive number occurs when the exponent field is at its minimum value () and the mantissa (fraction) is at its minimum value ().3.The implicit leading bit for normalized numbers is always .Thus, the smallest normalized positive number has:- Exponent =
- Mantissa =
15
Q15MCQ1 markMediumWhich one of the following circuits implements the Boolean function given below? , where is the minterm.Think it through. Then check your answer.Question
Which one of the following circuits implements the Boolean function given below?, where is the minterm.Correct answer
(A) [figure]
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The function is .
Using a 4x1 Multiplexer with and as select lines ():- For (inputs ): . Thus, .
- For (inputs ): . Thus, .
- For (inputs ): . Thus, .
- For (inputs ): . Thus, .
16
Q16MCQ1 markEasyConsider the following statements S1 and S2 about the relational data model: S1: A relation scheme can have at most one foreign key. S2: A foreign key in a relation scheme …Think it through. Then check your answer.Question
Consider the following statements S1 and S2 about the relational data model:S1: A relation scheme can have at most one foreign key.
S2: A foreign key in a relation scheme cannot be used to refer to tuples of .Which one of the following choices is correct?Correct answer
(D) Both S1 and S2 are false.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
S1 is false: A relation scheme can have multiple foreign keys. For example, an 'Enrollment' table might have one foreign key referring to 'Students' and another referring to 'Courses'.
S2 is false: A foreign key can refer to the same relation it is defined in. This is known as a self-referencing foreign key. A common example is an 'Employee' table where a 'ManagerID' column is a foreign key referring to the 'EmployeeID' column of the same table.
Therefore, both statements are false.17
Q17MCQ1 markEasyConsider the three-way handshake mechanism followed during TCP connection establishment between hosts and . Let and be two random 32-bit starting sequence numbers…Think it through. Then check your answer.Question
Consider the three-way handshake mechanism followed during TCP connection establishment between hosts and . Let and be two random 32-bit starting sequence numbers chosen by and respectively. Suppose sends a TCP connection request message to with a TCP segment having SYN bit = 1, SEQ number = , and ACK bit = 0. Suppose accepts the connection request. Which one of the following choices represents the information present in the TCP segment header that is sent by to ?Correct answer
(C) SYN bit = 1, SEQ number = Y, ACK bit = 1, ACK number = X+1, FIN bit = 0
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In the TCP three-way handshake process:1.Host to Host (SYN): sends a segment with SYN = 1, ACK = 0, and its initial sequence number SEQ = .2.Host to Host (SYN-ACK): responds by acknowledging 's request. It sets SYN = 1 and ACK = 1. It chooses its own initial sequence number SEQ = . The acknowledgment number (ACK number) is set to the next expected sequence number from , which is . Since this is not a connection termination, FIN = 0.3.Host to Host (ACK): acknowledges 's segment by setting SYN = 0, ACK = 1, SEQ = , and ACK number = .The question asks for the segment sent by to (step 2). This corresponds to SYN bit = 1, SEQ number = , ACK bit = 1, ACK number = , and FIN bit = 0. Thus, option (C) is correct.18
Q18MCQ1 markEasyWhat is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size ?Think it through. Then check your answer.Question
What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size ?Correct answer
(B) Θ(₂(n))
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The recursive binary search algorithm works by comparing the target value to the middle element of the array. The recurrence relation for the number of operations is:where represents the constant number of arithmetic operations (like calculating the mid index and comparisons) performed at each step.Using the Master Theorem for :
Since , we fall into Case 2 of the Master Theorem:Thus, the worst-case time complexity (and number of operations) is .19
Q19MCQ1 markMediumLet be an arbitrary regular language accepted by a minimal DFA with states. Which one of the following languages must necessarily be accepted by a…Think it through. Then check your answer.Question
Let be an arbitrary regular language accepted by a minimal DFA with states. Which one of the following languages must necessarily be accepted by a minimal DFA with states?Correct answer
(C) \0, 1\^ - L
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A fundamental property of regular languages is that if a language is regular, its complement is also regular. If is the minimal DFA for , it has states. The minimal DFA for is obtained by swapping the final and non-final states: . This resulting DFA is also minimal and has the same states. This is because the Myhill-Nerode equivalence relation for and is identical:
.
Since the number of states in a minimal DFA is equal to the number of equivalence classes of this relation, both and must have minimal DFAs with the same number of states .For the other options:- (A) and (B) involve adding or removing a specific string, which can change the number of states in the minimal DFA.
- (D) (concatenation) typically increases the number of states significantly.
20
Q20MCQ1 markMediumConsider the following ANSI C program. [code] What is the output of the above program?Think it through. Then check your answer.Question
Consider the following ANSI C program.What is the output of the above program?#include <stdio.h> int main(){ int arr[4][5]; int i, j; for (i=0; i<4; i++){ for (j=0; j<5; j++){ arr[i][j] = 10*i + j; } } printf("%d", *(arr[1] + 9)); return 0; }Correct answer
(C) 24
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The program declares a 2D arrayarr[4][5]and initializes it using the formulaarr[i][j] = 10*i + j.The expression to be printed is*(arr[1] + 9).1.Understandingarr[1]: In C,arris a 2D array.arr[1]decays to a pointer to the first element of the second row, i.e., it points toarr[1][0].2.Pointer Arithmetic: C stores 2D arrays in row-major order (contiguous memory). Adding an integer to a pointer moves it forward by that many elements of the type it points to (here,int).-
arr[1]points to the element at row index 1, column index 0. - Adding 9 moves the pointer 9 positions forward in the contiguous memory block.
- The array has 5 columns.
-
arr[1][0]is at logical index in a flattened view. -
arr[1] + 9points to logical index . - To find the row and column for index 14: (row index) and (column index).
- So,
*(arr[1] + 9)accessesarr[2][4].
- The value is initialized as
10*i + j. - For
i=2, j=4: .
-
21
Q21MSQ1 markMediumConsider the following sets, where : : Set of all matrices with entries from the set : Set of all functions from the set…Think it through. Then check your answer.Question
Consider the following sets, where :
: Set of all matrices with entries from the set
: Set of all functions from the set to the set
Which of the following choice(s) is/are correct?Correct answer
(B) There exists a surjection from S₁ to S₂.; (C) There exists a bijection from S₁ to S₂.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let us calculate the cardinality of sets and .For :
is the set of all matrices with entries from .
An matrix has entries.
Each entry can be chosen in 3 ways (either , , or ).
Therefore, the total number of such matrices is .For :
is the set of all functions from domain to codomain .
The size of the domain is .
The size of the codomain is .
The total number of functions is .
Therefore, .Conclusion:
Since , the two finite sets have the same cardinality. Thus, there exists a bijection between them.
Since a bijection exists, it implies that there exists an injection and there exists a surjection from to .Evaluating the options:
(A) False. A bijection exists.
(B) True. A surjection exists.
(C) True. A bijection exists.
(D) False. An injection exists.Correct options are (B) and (C).22
Q22MSQ1 markMediumLet be a regular language and be a context-free language. Which of the following languages is/are context-free?Think it through. Then check your answer.Question
Let be a regular language and be a context-free language. Which of the following languages is/are context-free?Correct answer
(B) L₁ ∪ L₂; (C) L₁ ∪ (L₂ ∪ L₂); (D) (L₁ ∩ L₂) ∪ (L₁ ∩ L₂)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We are given that is a regular language and is a context-free language (CFL).Option (A):
Context-free languages are not closed under complementation. Thus, is not necessarily a CFL. The intersection of a regular language () and a non-CFL () is not necessarily context-free. For example, if , then , which might not be CFL.Option (B):
Since is regular, it is also context-free. The union of two CFLs () is a CFL. However, the complement of a CFL is not necessarily a CFL. Thus, this language is not guaranteed to be context-free.Option (C):
Note that for any language , (the set of all strings over the alphabet). Thus, . The expression becomes . Since is a regular language, it is also context-free. This is always context-free.Option (D):
We can factor out from the expression:
Since , the expression simplifies to:
Since is given as a context-free language, the result is context-free.Alternatively, using closure properties:1. is regular, so is regular (regular languages are closed under complement).2.Intersection of a regular language and a CFL is a CFL. Thus, is CFL and is CFL.3.Union of two CFLs is a CFL. Thus, their union is a CFL.Therefore, options (C) and (D) are correct.23
Q23MSQ1 markEasyIn the context of compilers, which of the following is/are NOT an intermediate representation of the source program?Think it through. Then check your answer.Question
In the context of compilers, which of the following is/are NOT an intermediate representation of the source program?Correct answer
(D) Symbol table
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Intermediate representations (IR) are used by compilers to represent the source code in a form that is easy to manipulate for optimizations and code generation. Common IRs include:- Graphical IRs: Abstract Syntax Trees (AST), Directed Acyclic Graphs (DAG), and Control Flow Graphs (CFG).
- Linear IRs: Three-Address Code (TAC) and P-code.
24
Q24MSQ1 markMediumWhich of the following statement(s) is/are correct in the context of CPU scheduling?Think it through. Then check your answer.Question
Which of the following statement(s) is/are correct in the context of CPU scheduling?Correct answer
(A) Turnaround time includes waiting time.; (C) Round-robin policy can be used even when the CPU time required by each of the processes is not known apriori.; (D) Implementing preemptive scheduling needs hardware support.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Turnaround Time: Defined as the total time from process submission to completion. . Thus, it includes waiting time. Statement (A) is correct.2.Scheduling Goals: The primary goals are to maximize CPU utilization and maximize throughput, while minimizing turnaround, waiting, and response times. Statement (B) is incorrect because it mentions minimizing throughput.3.Round-Robin (RR): RR is a preemptive algorithm that uses a fixed time quantum. It does not require prior knowledge of the burst time (CPU time required) of processes. Statement (C) is correct.4.Hardware Support: Preemptive scheduling requires a hardware timer to generate interrupts at the end of a time slice to return control to the scheduler. Statement (D) is correct.25
Q25MSQ1 markMediumChoose the correct choice(s) regarding the following propositional logic assertion :…Think it through. Then check your answer.Question
Choose the correct choice(s) regarding the following propositional logic assertion :Correct answer
(B) S is a tautology.; (D) The antecedent of S is logically equivalent to the consequent of S.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the assertion be , where:- Antecedent
- Consequent
Simplifying :
Since , the antecedent is logically equivalent to the consequent (Option D is correct).
Furthermore, the assertion is of the formA → A, which is always true regardless of the truth values of , , and . Thus, is a tautology (Option B is correct).26
Q26NAT1 markMediumConsider a complete binary tree with 7 nodes. Let denote the set of first 3 elements obtained by performing Breadth-First Search (BFS) starting from the root. Let denote…Think it through. Then check your answer.Question
Consider a complete binary tree with 7 nodes. Let denote the set of first 3 elements obtained by performing Breadth-First Search (BFS) starting from the root. Let denote the set of first 3 elements obtained by performing Depth-First Search (DFS) starting from the root.
The value of 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
1.BFS Traversal: In a complete binary tree with 7 nodes (labeled 1 to 7 in level-order), the BFS traversal starting from the root is: 1, 2, 3, 4, 5, 6, 7.- The set of the first 3 elements is .
- The set of the first 3 elements is .
- .
- The cardinality .
27
Q27NAT1 markMediumConsider the following deterministic finite automaton (DFA). [figure] The number of strings of length 8 accepted by the above automaton is ________.Think it through. Then check your answer.Question
Consider the following deterministic finite automaton (DFA).The number of strings of length 8 accepted by the above automaton is ________.
Correct answer
256 to 256
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the states be (start), (top), (bottom), and (final).- Transitions from : , .
- Transitions from : , .
- Transitions from : , .
- Transitions from : .
- For length , strings are '0' (at ) and '1' (at ). Both are not accepted. (2 strings)
- For length , strings staying in are '01' (at ) and '10' (at ). (2 strings)
- For any length , there are exactly 2 strings that stay in the set (alternating 0s and 1s: and ).
Strings of length 8 not accepted = 2.
Number of accepted strings = .28
Q28NAT1 markMediumIf and are two decimal digits and , the decimal value of is ________.Think it through. Then check your answer.Question
If and are two decimal digits and , the decimal value of is ________.Correct answer
3 to 3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Convert the binary fraction to decimal:
Given , we equate the decimal values:
Comparing the digits:
The value of .29
Q29NAT1 markMediumConsider a set-associative cache of size 2KB (1KB = bytes) with cache block size of 64 bytes. Assume that the cache is byte-addressable and a 32-bit address is used for…Think it through. Then check your answer.Question
Consider a set-associative cache of size 2KB (1KB = bytes) with cache block size of 64 bytes. Assume that the cache is byte-addressable and a 32-bit address is used for accessing the cache. If the width of the tag field is 22 bits, the associativity of the cache is _______.Correct answer
2 to 2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given:- Cache Size () = 2 KB = bytes = bytes
- Block Size () = 64 bytes = bytes
- Physical Address () = 32 bits
- Tag bits () = 22 bits
1.Calculate Block Offset ():2.Calculate Set Index bits ():3.Calculate Number of Sets ():4.Calculate Associativity ():The relationship between cache size, number of sets, associativity, and block size is:
Therefore, the associativity of the cache is 2.30
Q30NAT1 markMediumConsider a computer system with DMA support. The DMA module is transferring one 8-bit character in one CPU cycle from a device to memory through cycle stealing at regular…Think it through. Then check your answer.Question
Consider a computer system with DMA support. The DMA module is transferring one 8-bit character in one CPU cycle from a device to memory through cycle stealing at regular intervals. Consider a 2 MHz processor. If 0.5% processor cycles are used for DMA, the data transfer rate of the device is _________ bits per second.Correct answer
80000 to 80000
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given:- Processor speed = 2 MHz = cycles/second.
- Percentage of cycles used for DMA = 0.5%.
- Data transferred per cycle = 1 character = 8 bits.
Since 1 cycle transfers 8 bits:The data transfer rate of the device is 80,000 bits per second.31
Q31NAT1 markHardA data file consisting of 1,50,000 student-records is stored on a hard disk with block size of 4096 bytes. The data file is sorted on the primary keyRollNo. The size of a…Think it through. Then check your answer.Question
A data file consisting of 1,50,000 student-records is stored on a hard disk with block size of 4096 bytes. The data file is sorted on the primary keyRollNo. The size of a record pointer for this disk is 7 bytes. Each student-record has a candidate key attribute calledANumof size 12 bytes. Suppose an index file with records consisting of two fields,ANumvalue and the record pointer to the corresponding student record, is built and stored on the same disk. Assume that the records of data file and index file are not split across disk blocks. The number of blocks in the index file is ___________.Correct answer
698 to 698
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Identify the Index Type: The data file is sorted on the primary keyRollNo, but the index is being built onANum(a candidate key). Since the index is not on the ordering attribute of the file, it is a secondary index. Secondary indices are dense, meaning there is one index entry for every record in the data file.2.Number of Index Entries (): Since it is a dense index, the number of index entries is equal to the number of records in the data file.3.Size of an Index Record (): Each index record consists of the search key (ANum) and a record pointer.4.Blocking Factor for the Index File (): This is the number of index records that can fit in one disk block. Since records cannot be split across blocks:5.Number of Blocks in the Index File ():Thus, the number of blocks in the index file is 698.32
Q32NAT1 markMediumFor a given biased coin, the probability that the outcome of a toss is a head is . This coin is tossed times. Let denote the random variable whose value is the…Think it through. Then check your answer.Question
For a given biased coin, the probability that the outcome of a toss is a head is . This coin is tossed times. Let denote the random variable whose value is the number of times that head appeared in these tosses. The standard deviation of (rounded to decimal places) is ________.Correct answer
15 to 16
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The random variable represents the number of successes in independent Bernoulli trials with success probability . Thus, follows a Binomial distribution: .The variance of a Binomial distribution is calculated as:Substituting the given values:The standard deviation is the square root of the variance:Rounding to two decimal places, the standard deviation is .33
Q33NAT1 markMediumConsider the following ANSI C function: [code] The value returned bySomeFunction(15, 255)is ___________.Think it through. Then check your answer.Question
Consider the following ANSI C function:The value returned byint SomeFunction(int x, int y) { if ((x == 1) || (y == 1)) return 1; if (x == y) return x; if (x > y) return SomeFunction(x - y, y); if (y > x) return SomeFunction(x, y - x); }SomeFunction(15, 255)is ___________.Correct answer
15 to 15
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The functionSomeFunction(x, y)is a recursive implementation of the Euclidean algorithm for finding the Greatest Common Divisor (GCD) of two numbers, with an additional base case that returns if either input is .For and :1.Since , it callsSomeFunction(15, 255 - 15) = SomeFunction(15, 240).2.This process of subtracting from continues until becomes (since is a multiple of , specifically ).3.When the callSince , the base caseSomeFunction(15, 15)is reached, the conditionif (x == y)is satisfied, and it returns .(x == 1) || (y == 1)is never reached. Thus, the function returns .34
Q34NAT1 markMediumSuppose that is a matrix such that every solution of the equation is a scalar multiple of . The rank of is ___________.Think it through. Then check your answer.Question
Suppose that is a matrix such that every solution of the equation is a scalar multiple of . The rank of 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 matrix is of size . The equation defines the null space (kernel) of .The problem states that every solution of is a scalar multiple of the non-zero vector . This implies that the null space of is spanned by a single vector, so the dimension of the null space (nullity) is .According to the Rank-Nullity Theorem:where is the number of columns of the matrix . Here, .35
Q35NAT1 markMediumSuppose that is a continuous function on the interval and a differentiable function in the interval such that for every in…Think it through. Then check your answer.Question
Suppose that is a continuous function on the interval and a differentiable function in the interval such that for every in the interval, . If , then is at most ________.Correct answer
19 to 19
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
According to the Mean Value Theorem (MVT), for a function that is continuous on and differentiable on , there exists at least one such that:Given , , and . Also, for all .
Applying MVT:Therefore, the maximum possible value of is 19.36
Q36MCQ2 marksMediumConsider the string abbccddeee. Each letter in the string must be assigned a binary code satisfying the following properties: 1. For any two letters, the code assigned to one…Think it through. Then check your answer.Question
Consider the string abbccddeee. Each letter in the string must be assigned a binary code satisfying the following properties:1.For any two letters, the code assigned to one letter must not be a prefix of the code assigned to the other letter.2.For any two letters of the same frequency, the letter which occurs earlier in the dictionary order is assigned a code whose length is at most the length of the code assigned to the other letter.Among the set of all binary code assignments which satisfy the above two properties, what is the minimum length of the encoded string?Correct answer
(B) 23
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
First, determine the frequencies of each character in the string abbccddeee:- a: 1
- b: 2
- c: 2
- d: 2
- e: 3
Property 2 states that for characters with the same frequency, the one earlier in alphabetical order must have a code length the one later. Here, b, c, and d all have frequency 2. So, .Constructing the Huffman tree for frequencies {1, 2, 2, 2, 3}:1.Combine 1(a) and 2(b) 3. Remaining: {2(c), 2(d), 3(e), 3(node1)}2.Combine 2(c) and 2(d) 4. Remaining: {3(e), 3(node1), 4(node2)}3.Combine 3(e) and 3(node1) 6. Remaining: {4(node2), 6(node3)}4.Combine 4 and 6 10.Code lengths from this tree:- a: 3 bits (node4 node3 node1 a)
- b: 3 bits (node4 node3 node1 b)
- e: 2 bits (node4 node3 e)
- c: 2 bits (node4 node2 c)
- d: 2 bits (node4 node2 d)
To satisfy the property while maintaining minimum total length, we swap the codes of b and c (since they have the same frequency, the total length remains the same).
New lengths: . Still violates .
Optimal assignment of lengths {3, 3, 2, 2, 2} to {a, b, c, d, e} to satisfy :
.
Total length = .37
Q37MCQ2 marksMediumAssume a two-level inclusive cache hierarchy, L1 and L2, where L2 is the larger of the two. Consider the following statements. : Read misses in a write through L1 cache do…Think it through. Then check your answer.Question
Assume a two-level inclusive cache hierarchy, L1 and L2, where L2 is the larger of the two. Consider the following statements.
: Read misses in a write through L1 cache do not result in writebacks of dirty lines to the L2.
: Write allocate policy must be used in conjunction with write through caches and no-write allocate policy is used with writeback caches.Which of the following statements is correct?Correct answer
(A) S₁ is true and S₂ is false
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement is true: In a write-through L1 cache, every write operation updates both the L1 and the L2 (or memory) simultaneously. Therefore, the L1 cache never contains "dirty" data (data that is different from the next level). When a read miss occurs and a line needs to be replaced in L1, there is no need to write back the replaced line to L2 because it is already consistent. Statement is false: While write-through caches are commonly paired with no-write-allocate (write-around) and write-back caches with write-allocate, these are not mandatory requirements. It is possible to design a system with write-through and write-allocate, or write-back with no-write-allocate. The word "must" makes the statement incorrect.38
Q38MCQ2 marksMediumSuppose we want to design a synchronous circuit that processes a string of 0's and 1's. Given a string, it produces another string by replacing the first 1 in any subsequence of…Think it through. Then check your answer.Question
Suppose we want to design a synchronous circuit that processes a string of 0's and 1's. Given a string, it produces another string by replacing the first 1 in any subsequence of consecutive 1's by a 0. Consider the following example.Input sequence:
Output sequence:
A Mealy Machine is a state machine where both the next state and the output are functions of the present state and the current input. The above mentioned circuit can be designed as a two-state Mealy machine. The states in the Mealy machine can be represented using Boolean values 0 and 1. We denote the current state, the next state, the next incoming bit, and the output bit of the Mealy machine by the variables , , and respectively. Assume the initial state of the Mealy machine is 0.
What are the Boolean expressions corresponding to and in terms of and ?Correct answer
(B) t = b y = sb
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the state represent whether we have just seen a 1 (i.e., we are inside a sequence of 1s).- : The previous bit was 0 (or we are at the start). We are not currently in a sequence of 1s.
- : The previous bit was 1. We are currently inside a sequence of 1s.
1.Current State (Previous bit 0):- Input : The sequence of 0s continues. Output . Next state .
- Input : This is the first 1 of a new sequence. The problem states we must replace the first 1 with 0. So, Output . Since the current bit is 1, the next state becomes .
- Input : The sequence of 1s has ended. Output . Next state .
- Input : This is a subsequent 1 in the sequence. We should output it as is. Output . Since the current bit is 1, the next state remains .
Deriving Boolean Expressions:Current State () Input () Next State () Output () 0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 - For : Looking at the column for , it is exactly the same as the input column .
- For : The output is 1 only when and .
39
Q39MCQ2 marksMediumIn an examination, a student can choose the order in which two questions (QuesA and QuesB) must be attempted. - If the first question is answered wrong, the student gets zero…40
Q40MCQ2 marksHardConsider the following ANSI C code segment: [code] Assume that the variable y points to a struct (allocated on the heap) containing two fields f1 and f2, and the local…Think it through. Then check your answer.Question
Consider the following ANSI C code segment:Assume that the variable y points to a struct (allocated on the heap) containing two fields f1 and f2, and the local variables x, y, z, p, q, and i are allotted registers. Common sub-expression elimination (CSE) optimization is applied on the code. The number of addition and dereference operations (of the formz = x + 3 + y->f1 + y->f2; for (i = 0; i < 200; i = i + 2) { if (z > i) { p = p + x + 3; q = q + y->f1; } else { p = p + y->f2; q = q + x + 3; } }y->f1ory->f2) in the optimized code, respectively, are:Correct answer
(D) 303 and 2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We analyze the code with Common Sub-expression Elimination (CSE).1. Pre-loop Analysis:
Code:z = x + 3 + y->f1 + y->f2;t1 = x + 3(1 addition)t2 = y->f1(1 dereference)t3 = t1 + t2(1 addition)t4 = y->f2(1 dereference)z = t3 + t4(1 addition)
The valuest1(),t2(), andt4() are stored in registers and reused.2. Loop Control Analysis:
Code:for (i = 0; i < 200; i = i + 2)- The loop runs for . Total iterations = 100.
- Increment
i = i + 2is executed 100 times. - Loop control totals: 100 additions.
Inside the loop,x+3,y->f1, andy->f2are available ast1,t2,t4.Ifz > i(True block):p = p + t1(1 addition)q = q + t2(1 addition)
p = p + t4(1 addition)q = q + t1(1 addition)
- Additions:
- Dereferences:
41
Q41MCQ2 marksEasyThe relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the…Think it through. Then check your answer.Question
The relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the employee is assigned. Each employee is assigned to exactly one department.emp(empId, name, gender, salary, deptId)Consider the following SQL query:The above query gives, for each department in the company, the number of female employees whose salary is greater than the average salary ofselect deptId, count(*) from emp where gender = "female" and salary > (select avg(salary) from emp) group by deptId;Correct answer
(B) employees in the company.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The subquery(select avg(salary) from emp)is an uncorrelated subquery that calculates the average salary of all employees in the entire company. The outer query then filters for employees who are female and have a salary greater than this company-wide average. Finally, thegroup by deptIdclause counts these specific female employees for each department. Therefore, the query counts female employees in each department whose salary is greater than the average salary of all employees in the company.42
Q42MCQ2 marksMediumLet be the following schedule of operations of three transactions , and in a relational database system:…Think it through. Then check your answer.Question
Let be the following schedule of operations of three transactions , and in a relational database system:Consider the statements P and Q below:P: is conflict-serializable.
Q: If commits before finishes, then is recoverable.Which one of the following choices is correct?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
1.Conflict Serializability (P): We check for conflicting operations between different transactions:- On : precedes .
- On : precedes .
- On : precedes .
2.Recoverability (Q): A schedule is recoverable if for every pair of transactions and such that reads a data item previously written by , the commit of occurs before the commit of .In , performs after has performed . Thus, reads from . For the schedule to be recoverable, must commit before . Statement Q says if commits before finishes, the schedule is recoverable, which is false. Statement Q is false.43
Q43MCQ2 marksHardA bag has red balls and black balls. All balls are identical except for their colours. In a trial, a ball is randomly drawn from the bag, its colour is noted and the ball…Think it through. Then check your answer.Question
A bag has red balls and black balls. All balls are identical except for their colours. In a trial, a ball is randomly drawn from the bag, its colour is noted and the ball is placed back into the bag along with another ball of the same colour. Note that the number of balls in the bag will increase by one, after the trial. A sequence of four such trials is conducted. Which one of the following choices gives the probability of drawing a red ball in the fourth trial?Correct answer
(A) (r)/(r+b)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
This problem describes Pólya's Urn model. In this model, the probability of drawing a ball of a specific color in any trial is equal to the initial probability of drawing that color in the first trial.
Initially, .
For the second trial:
.
By induction, the probability of drawing a red ball in any trial remains . Thus, for the fourth trial, the probability is .44
Q44MCQ2 marksMediumConsider the cyclic redundancy check (CRC) based error detecting scheme having the generator polynomial . Suppose the message is to be…Think it through. Then check your answer.Question
Consider the cyclic redundancy check (CRC) based error detecting scheme having the generator polynomial . Suppose the message is to be transmitted. Check bits are appended at the end of the message by the transmitter using the above CRC scheme. The transmitted bit string is denoted by . The value of the checkbit sequence isCorrect answer
(C) 100
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.The generator polynomial corresponds to the bit string (coefficients of ).2.The message . The number of check bits to be appended is (the degree of the generator polynomial).3.Append zeros to the message: .4.Perform modulo-2 division of by :45
Q45MCQ2 marksMediumConsider the following ANSI C program: [code] Which one of the statements below is correct about the program?Think it through. Then check your answer.Question
Consider the following ANSI C program:Which one of the statements below is correct about the program?#include <stdio.h> #include <stdlib.h> struct Node{ int value; struct Node *next;}; int main(){ struct Node *boxE, *head, *boxN; int index = 0; boxE = head = (struct Node *) malloc(sizeof(struct Node)); head->value = index; for (index = 1; index <= 3; index++){ boxN = (struct Node *) malloc(sizeof(struct Node)); boxE->next = boxN; boxN->value = index; boxE = boxN; } for (index = 0; index <= 3; index++) { printf("Value at index %d is %d\n", index, head->value); head = head->next; printf("Value at index %d is %d\n", index+1, head->value); } }Correct answer
(D) It dereferences an uninitialized pointer that may result in a run-time error.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.The first loop creates a linked list with 4 nodes (values 0, 1, 2, 3).2.boxEpoints to the last node (value 3). Note thatboxE->nextis never initialized toNULLafter the loop finishes.3.The second loop iterates forindex = 0, 1, 2, 3.4.In the final iteration (index = 3):printf("Value at index 3 is %d\n", 3, head->value);executes correctly (head is at node 3).head = head->next;setsheadto the uninitializednextpointer of the last node.printf("Value at index 4 is %d\n", 4, head->value);attempts to dereference this uninitialized pointer, which leads to undefined behavior and typically a run-time error (segmentation fault).
46
Q46MCQ2 marksMediumConsider the following two statements about regular languages: : Every infinite regular language contains an undecidable language as a subset. : Every finite language is…Think it through. Then check your answer.Question
Consider the following two statements about regular languages:
: Every infinite regular language contains an undecidable language as a subset.
: Every finite language is regular.
Which one of the following choices is correct?Correct answer
(C) Both S₁ and S₂ are true.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
is true: Any infinite set (including an infinite regular language) has uncountably many subsets (). Since the set of all decidable languages is countable, there must be uncountably many subsets that are undecidable.
is true: Every finite language is regular because a finite automaton can be constructed to accept exactly the finite set of strings in the language (or a regular expression can be formed by the union of all strings).47
Q47MCQ2 marksMediumFor two -dimensional real vectors and , the operation is defined as follows: Let be a set of…Think it through. Then check your answer.Question
For two -dimensional real vectors and , the operation is defined as follows:Let be a set of 10-dimensional non-zero real vectors such that for every pair of distinct vectors , . What is the maximum cardinality possible for the set ?Correct answer
(B) 10
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The operation is the standard dot product (inner product) in . The condition for distinct implies that the vectors in the set are pairwise orthogonal. It is a well-known property in linear algebra that any set of pairwise orthogonal non-zero vectors is linearly independent. Since the vectors are 10-dimensional, they are elements of the vector space . The dimension of is 10, which means the maximum number of linearly independent vectors in this space is 10. Therefore, the maximum cardinality of the set is 10.48
Q48MCQ2 marksEasyFor a statement in a program, in the context of liveness analysis, the following sets are defined: : the set of variables used in : the set of variables…Think it through. Then check your answer.Question
For a statement in a program, in the context of liveness analysis, the following sets are defined:
: the set of variables used in
: the set of variables that are live at the entry of
: the set of variables that are live at the exit of Consider a basic block that consists of two statements, followed by . Which one of the following statements is correct?Correct answer
(A) OUT(S₁) = IN(S₂)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In liveness analysis (a backward data-flow analysis), the set of variables live at the exit of a statement () is determined by the variables live at the entry of its successors. In a basic block where statements are executed sequentially, the immediate successor of statement is . The program point corresponding to the exit of is identical to the program point corresponding to the entry of . Therefore, the set of variables live at the exit of must be exactly the same as the set of variables live at the entry of . Thus, .Other options are incorrect because:- (B) relates to of the same statement incorrectly (the standard equation is ).
- (C) and (D) introduce dependencies that do not hold for sequential execution in this manner.
49
Q49MCQ2 marksMediumFor constants and , consider the following recurrence defined on the non-negative integers: Which one of the…Think it through. Then check your answer.Question
For constants and , consider the following recurrence defined on the non-negative integers:Which one of the following options is correct about the recurrence ?Correct answer
(C) If f(n) is O(n^(_b(a) - ε)) for some ε 0, then T(n) is Θ(n^(_b(a))).
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
This question tests the understanding of the Master Theorem for solving recurrences of the form .Let . The Master Theorem has three main cases comparing to :1.Case 1: If for some constant , then .2.Case 2: If , then .3.Case 3: If for some constant , and if for some constant and sufficiently large , then .Analyzing the options:- (A) This is not generally true. For example, if , then . If , this falls into an extended case where , not .
- (B) This is not generally true. The behavior depends on the relationship between and .
- (C) This statement matches Case 1 of the Master Theorem exactly. If is polynomially smaller than , then the solution is dominated by the leaf level of the recursion tree, which is . This is the correct statement.
- (D) This corresponds to Case 2 of the Master Theorem. However, the conclusion is incorrect. If , then , not .
50
Q50MSQ2 marksMediumSuppose the following functional dependencies hold on a relation with attributes and :P → QRRS → TWhich of the following functional…Think it through. Then check your answer.Question
Suppose the following functional dependencies hold on a relation with attributes and :P → QRRS → TWhich of the following functional dependencies can be inferred from the above functional dependencies?Correct answer
(A) PS arrow T; (C) P arrow R; (D) PS arrow Q
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given functional dependencies (FDs):1.P → QR2.From FD 1, using the decomposition rule, we can infer:RS → TP → QP → R(This makes option (C) correct)
PS → T:
FromP → R, by augmentation with , we getPS → RS.
SincePS → RSandRS → T(FD 2), by transitivity, we getPS → T. (This makes option (A) correct)Now, considerPS → Q:
FromP → Q, by augmentation with , we getPS → QS.
FromPS → QS, by decomposition, we getPS → Q. (This makes option (D) correct)Option (B)R → Tcannot be inferred because we only know that is functionally dependent on the combination of and , not on alone.51
Q51MSQ2 marksHardFor a string , we define to be the reverse of . For example, if then . Which of the following languages is/are context-free?Think it through. Then check your answer.Question
For a string , we define to be the reverse of . For example, if then .
Which of the following languages is/are context-free?Correct answer
(B) \w w^R x x^R w, x ∈ \0, 1\^ \; (C) \w x w^R w, x ∈ \0, 1\^ \; (D) \w x x^R w^R w, x ∈ \0, 1\^ \
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Analysis of the options:- (A) : This language requires matching with and with in a cross-serial manner. A single stack cannot handle this interleaved matching. Thus, it is not context-free.
- (B) : This is the concatenation of two context-free languages and . Since context-free languages are closed under concatenation, this language is context-free.
- (C) : If we take , then the language becomes , which is regular. Even if is not empty, we can match the first part with the last part while ignoring the middle part . This can be done with a PDA. In fact, for any , this language simplifies to because we can always choose to be the first character and to be the last character if they match, or just choose . Thus, it is regular and therefore context-free.
- (D) : This represents nested matching where matches on the outside and matches on the inside. This is a classic context-free language structure (like balanced parentheses).
52
Q52MSQ2 marksMediumConsider the following multi-threaded code segment (in a mix of C and pseudo-code), invoked by two processes P1 and P2, and each of the processes spawns two threads T1 and T2:…Think it through. Then check your answer.Question
Consider the following multi-threaded code segment (in a mix of C and pseudo-code), invoked by two processes P1 and P2, and each of the processes spawns two threads T1 and T2:int x = 0; // global Lock L1; // global main() { create a thread to execute foo(); // Thread T1 create a thread to execute foo(); // Thread T2 wait for the two threads to finish execution; print (x); } foo() { int y = 0; Acquire L1; x = x + 1; y = y + 1; Release L1; print (y); }
Which of the following statement(s) is/are correct?Correct answer
(A) Both P1 and P2 will print the value of x as 2.; (D) Both T1 and T2, in both the processes, will print the value of y as 1.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Step-by-step analysis:1.Process Isolation: Processes P1 and P2 have separate address spaces. Global variables likexandL1are local to each process. They are not shared between P1 and P2.2.Process P1: It spawns two threads T1 and T2. These threads share the same address space, includingxandL1. Both threads callfoo(). Insidefoo(), the critical sectionx = x + 1is protected byAcquire L1andRelease L1. Thus,xwill be incremented exactly twice (once by T1, once by T2). The final value ofxprinted by P1 will be 2.3.Process P2: Similarly, P2 has its ownxandL1. Its threads T1 and T2 will increment its ownxtwice. The final value ofxprinted by P2 will also be 2. Thus, statement (A) is correct and (B) is incorrect.4.Variable y: The variableyis declared insidefoo(), making it a local variable. In multi-threaded environments, each thread has its own stack, and thus its own copy of local variables.5.Thread Execution: For every thread (T1 and T2 in both P1 and P2),yis initialized to 0, incremented to 1, and then printed. No thread sharesywith another. Therefore, every thread will printyas 1. Thus, statement (D) is correct and (C) is incorrect.53
Q53MSQ2 marksHardConsider a computer system with multiple shared resource types, with one instance per resource type. Each instance can be owned by only one process at a time. Owning and freeing…Think it through. Then check your answer.Question
Consider a computer system with multiple shared resource types, with one instance per resource type. Each instance can be owned by only one process at a time. Owning and freeing of resources are done by holding a global lock (L). The following scheme is used to own a resource instance :Which of the following choice(s) about the above scheme is/are correct?function OWNRESOURCE(Resource R) Acquire lock L // a global lock if R is available then Acquire R Release lock L else if R is owned by another process P then Terminate P, after releasing all resources owned by P Acquire R Restart P Release lock L end if end if end functionCorrect answer
(A) The scheme ensures that deadlocks will not occur.; (B) The scheme may lead to live-lock.; (C) The scheme may lead to starvation.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Deadlock: The scheme uses preemption (terminating process and releasing its resources) to resolve resource conflicts. By allowing preemption, the circular wait condition for deadlock is broken. Therefore, deadlocks will not occur. (A is correct)2.Live-lock: Two processes could repeatedly preempt each other. For example, owns , preempts to get , then restarts and preempts to get back. This cycle can continue indefinitely without either process making progress. (B is correct)3.Starvation: A process could be repeatedly terminated and restarted by other processes, never getting a chance to complete its execution. (C is correct)4.Mutual Exclusion: The global lock ensures that the check for resource availability and its acquisition are atomic. Only one process can successfully execute the acquisition logic for a specific resource at any time. (D is incorrect)54
Q54MSQ2 marksHardIf the numerical value of a 2-byte unsigned integer on a little endian computer is 255 more than that on a big endian computer, which of the following choices represent(s) the…Think it through. Then check your answer.Question
If the numerical value of a 2-byte unsigned integer on a little endian computer is 255 more than that on a big endian computer, which of the following choices represent(s) the unsigned integer on a little endian computer?Correct answer
(A) 0x6665; (D) 0x0100
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the two bytes in memory be and at addresses and respectively.- On a Big Endian computer, the most significant byte is at the lower address: .
- On a Little Endian computer, the least significant byte is at the lower address: .
The question asks for the representation of the integer on a little endian computer, which is the value . In hexadecimal, this is .
Checking the options:
(A) 0x6665: . . (Correct)
(B) 0x0001: . . (Incorrect)
(C) 0x4243: . . (Incorrect)
(D) 0x0100: . . (Correct)55
Q55MSQ2 marksMediumConsider a computer network using the distance vector routing algorithm in its network layer. The partial topology of the network is as shown below. [figure] The objective is to…Think it through. Then check your answer.Question
Consider a computer network using the distance vector routing algorithm in its network layer. The partial topology of the network is as shown below.The objective is to find the shortest-path path from the router to routers and . Assume that does not initially know the shortest routes to and . Assume that has three neighbouring routers denoted as , , and . During one iteration, measures its distance to its neighbours , , and as , , and , respectively. Router gets routing vectors from its neighbours that indicate that the distance to router from routers , , and are , , and , respectively. The routing vector also indicates that the distance to router from routers , , and are , , and , respectively. Which of the following statement(s) is/are correct with respect to the new routing table of , after updation during this iteration?
Correct answer
(B) The distance from R to Q will be stored as 7.; (C) The next hop router for a packet from R to P is Y.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In distance vector routing, the distance to a destination from router is updated as:
Given distances to neighbors:
For destination P:
The minimum is achieved via neighbor . So, distance is 8 and next hop is .For destination Q:
The minimum is achieved via neighbor . So, distance is 7 and next hop is .Evaluating options:
(A) Distance to is 8, not 10. (False)
(B) Distance to is 7. (True)
(C) Next hop for is . (True)
(D) Next hop for is , not . (False)56
Q56MSQ2 marksHardConsider the following directed graph: [figure] Which of the following is/are correct about the graph?Think it through. Then check your answer.Question
Consider the following directed graph:Which of the following is/are correct about the graph?
Correct answer
(A) The graph does not have a topological order.; (B) A depth-first traversal starting at vertex S classifies three directed edges as back edges.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Topological Order: A directed graph has a topological order if and only if it is a Directed Acyclic Graph (DAG). By inspecting the graph, we can identify cycles. For example, the cycle exists (where denotes the vertex at column and row ). Since the graph contains cycles, it cannot have a topological order. Thus, (A) is correct.2.Back Edges in DFS: A DFS starting from will encounter cycles. For this specific grid structure, a standard DFS traversal will identify 3 back edges corresponding to the independent cycles formed by the alternating directions of rows and columns. Thus, (B) is correct.3.Strongly Connected Components: Every graph has strongly connected components (SCCs). Since this graph has cycles, it contains non-trivial SCCs. Therefore, (C) is false.4.Strong Connectivity: The graph is not strongly connected because there is no directed path between every pair of vertices (e.g., no path from the top-right vertex back to ). Thus, (D) is false.57
Q57MSQ2 marksHardWhich of the following regular expressions represent(s) the set of all binary numbers that are divisible by three? Assume that the string is divisible by three.Think it through. Then check your answer.Question
Which of the following regular expressions represent(s) the set of all binary numbers that are divisible by three? Assume that the string is divisible by three.Correct answer
(A) (0 + 1(01^ 0)^ 1)^; (B) (0 + 11 + 10(1 + 00)^ 01)^; (C) (0^ (1(01^ 0)^ 1)^)^
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The DFA for binary numbers divisible by 3 has three states representing remainders 0, 1, and 2.- State (rem 0):
- State (rem 1):
- State (rem 2):
1.Eliminate : The path becomes a self-loop on with the label .2.The resulting expression for the transition from back to via is .3.Combined with the self-loop on , the full RE is . This matches option (A).Option (C) is equivalent to (A) because .
Option (B) is another valid representation of the same language, derived by considering different paths through the DFA.
Option (D) is incorrect as it fails to generate valid strings like (decimal 9).58
Q58NAT2 marksHardConsider a three-level page table to translate a 39-bit virtual address to a physical address as shown below. [figure] The page size is 4KB ( bytes) and page…Think it through. Then check your answer.Question
Consider a three-level page table to translate a 39-bit virtual address to a physical address as shown below.The page size is 4KB ( bytes) and page table entry size at every level is 8 bytes. A process is currently using 2GB ( bytes) virtual memory which is mapped to 2GB of physical memory. The minimum amount of memory required for the page table of across all levels is ________ KB.
Correct answer
4108 to 4108
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given:- Virtual Address = 39 bits
- Page size = 4 KB = bytes Page offset = 12 bits
- Level 1, 2, and 3 offsets are each 9 bits each table has entries.
- PTE size = 8 bytes.
- Size of one page table at any level = bytes = 4096 bytes = 4 KB.
- Number of pages = pages.
1.Level 3: Each L3 table covers 512 pages. Number of L3 tables = tables.2.Level 2: Each L2 table covers 512 L3 tables. Number of L2 tables = tables.3.Level 1: One L1 table is always required to start the translation. It points to the 2 L2 tables.Total number of page tables = tables.
Total memory required = KB.59
Q59NAT2 marksMediumConsider the following ANSI C program. [code] The output of the program upon execution is _______Think it through. Then check your answer.Question
Consider the following ANSI C program.#include <stdio.h> int foo(int x, int y, int q) { if ((x <= 0) && (y <= 0)) return q; if (x <= 0) return foo(x, y-q, q); if (y <= 0) return foo(x-q, y, q); return foo(x, y-q, q) + foo(x-q, y, q); } int main() { int r = foo(15, 15, 10); printf("%d", r); return 0; }
The output of the program upon execution is _______Correct answer
60 to 60
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The functionfoo(x, y, q)recursively computes a value. The base case returnsq(which is 10) when bothxandyare . If only one is , it recurses by reducing the other variable. If both are positive, it branches.Let's tracefoo(15, 15, 10):1.foo(15, 15, 10)calls:-
foo(15, 5, 10) -
foo(5, 15, 10)
foo(15, 5, 10)calls:-
foo(15, -5, 10): Since , callsfoo(5, -5, 10)foo(-5, -5, 10). Returns 10. -
foo(5, 5, 10): Callsfoo(5, -5, 10)(returns 10) +foo(-5, 5, 10)(returns 10). Sum = 20. - Total for this branch: .
foo(5, 15, 10)calls:-
foo(5, 5, 10): As calculated above, returns 20. -
foo(-5, 15, 10): Since , callsfoo(-5, 5, 10)foo(-5, -5, 10). Returns 10. - Total for this branch: .
- .
-
60
Q60NAT2 marksMediumLet be a set consisting of 10 elements. The number of tuples of the form such that and are subsets of , and is ____________.Think it through. Then check your answer.Question
Let be a set consisting of 10 elements. The number of tuples of the form such that and are subsets of , and is ____________.Correct answer
59049 to 59049
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be a set with elements, where . We want to find the number of pairs such that .For any element , there are four logical possibilities regarding its membership in sets and :1. and2. and3. and4. andThe condition requires that if , then must be in . Therefore, the case ( and ) is forbidden. This leaves exactly 3 valid possibilities for each element :1. and2. and3. andSince there are elements in and the choice for each element is independent, the total number of such tuples is .Given , the answer is:61
Q61NAT2 marksMediumConsider the following augmented grammar with as the set of terminals. \begin{array}{l} S' \rightarrow S \\ S \rightarrow S \# c S \\ S \rightarrow S S…Think it through. Then check your answer.Question
Consider the following augmented grammar with as the set of terminals.Let . The number of items in the set 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
The grammar has the following productions:1.2.3.S → S S4.5.6.7.8.There are 7 productions for the non-terminal .Step 1: Compute
Since the dot is before , we add all productions of with the dot at the beginning:
We look for items in where the dot is immediately before . There is only one such item: .
Moving the dot past , the kernel of is .
Now we compute the closure of this kernel. Since the dot is before , we add all productions of with the dot at the beginning:- (Kernel)
We look for items in where the dot is immediately before . There is only one such item: .
Moving the dot past , the kernel of is .
This kernel is identical to the kernel of . Thus, the closure will be identical to .
Total items in .The number of items in the set is 8.62
Q62NAT2 marksHardConsider a Boolean function such that The number of literals in the minimal sum-of-products…Think it through. Then check your answer.Question
Consider a Boolean function such that
The number of literals in the minimal sum-of-products expression of is ________.Correct answer
6 to 6
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the minimal sum-of-products (SOP) expression, we first determine the minterms for which the function is 1, 0, or Don't Care.Step 1: Analyze the given conditions1.- This corresponds to the case where and .
- Indices (binary ): (0), (1), (8), (9).
- All these minterms are 1.
- This corresponds to and .
- Indices:
- (10). Value: .
- (11). Value: .
- (14). Value: .
- (15). Value: .
- This corresponds to .
- Indices:
- (4). Value: .
- (5). Value: .
- (6). Value: .
- (7). Value: .
- (12). Value: .
- (13). Value: .
- (14). Value: (Consistent).
- (15). Value: (Consistent).
- 1s: 0, 1, 6, 7, 8, 9, 11, 13, 14, 15
- 0s: 4, 5, 10, 12
- Don't Cares: The inputs not covered by the conditions are (Indices 2 and 3). We can treat them as Don't Cares () to minimize the expression, though in this specific case, they don't reduce the literal count further.
Step 3: Grouping00 01 11 10 00 1 1 d d 01 0 0 1 1 11 0 1 1 1 10 1 1 1 0 1.Group 1: Corners/Edges for minterms 0, 1, 8, 9.- Cells: .
- Variable constant: .
- Term: . (2 literals)
- Cells: .
- Variable constant: .
- Term: . (2 literals)
- Cells: .
- Variable constant: .
- Term: . (2 literals)
- covers 0, 1, 8, 9.
- covers 6, 7, 14, 15.
- covers 9, 11, 13, 15.
- All 1s are covered. No redundant groups (removing any group leaves some 1s uncovered).
.63
Q63NAT2 marksHardConsider a pipelined processor with 5 stages, Instruction Fetch (IF), Instruction Decode (ID), Execute (EX), Memory Access (MEM), and Write Back (WB). Each stage of the pipeline,…Think it through. Then check your answer.Question
Consider a pipelined processor with 5 stages, Instruction Fetch (IF), Instruction Decode (ID), Execute (EX), Memory Access (MEM), and Write Back (WB). Each stage of the pipeline, except the EX stage, takes one cycle. Assume that the ID stage merely decodes the instruction and the register read is performed in the EX stage. The EX stage takes one cycle for ADD instruction and two cycles for MUL instruction. Ignore pipeline register latencies.
Consider the following sequence of 8 instructions:Assume that every MUL instruction is data-dependent on the ADD instruction just before it and every ADD instruction (except the first ADD) is data-dependent on the MUL instruction just before it. The Speedup is defined as follows:The Speedup achieved in executing the given instruction sequence on the pipelined processor (rounded to 2 decimal places) is _______.Correct answer
1.87 to 1.88
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the sequence of instructions be (ADD), (MUL), (ADD), (MUL), (ADD), (MUL), (ADD), (MUL).Case 1: Without Operand Forwarding
In this case, a dependent instruction must wait for the producer to write back (WB) the result to the register file before it can read the operands. The problem states that register read is performed in the EX stage. Thus, the EX stage of the consumer can only start after the WB stage of the producer is completed.- (ADD): 1 cycle EX. Pipeline: IF, ID, EX, MEM, WB. Completes WB at cycle 5.
- (MUL): Depends on . Can start EX at cycle . EX takes 2 cycles (6, 7). MEM 8, WB 9.
- (ADD): Depends on . Can start EX at cycle . EX takes 1 cycle (10). MEM 11, WB 12.
- (MUL): Depends on . Can start EX at cycle . EX takes 2 cycles (13, 14). MEM 15, WB 16.
- (ADD): Depends on . Can start EX at cycle . EX takes 1 cycle (17). MEM 18, WB 19.
- (MUL): Depends on . Can start EX at cycle . EX takes 2 cycles (20, 21). MEM 22, WB 23.
- (ADD): Depends on . Can start EX at cycle . EX takes 1 cycle (24). MEM 25, WB 26.
- (MUL): Depends on . Can start EX at cycle . EX takes 2 cycles (27, 28). MEM 29, WB 30.
With forwarding, the result is available at the end of the EX stage of the producer and can be forwarded to the start of the EX stage of the consumer. Thus, the consumer's EX stage can start immediately after the producer's EX stage finishes.- (ADD): EX finishes at cycle 3.
- (MUL): EX starts at 4. Duration 2. Finishes at 5.
- (ADD): EX starts at 6. Duration 1. Finishes at 6.
- (MUL): EX starts at 7. Duration 2. Finishes at 8.
- (ADD): EX starts at 9. Duration 1. Finishes at 9.
- (MUL): EX starts at 10. Duration 2. Finishes at 11.
- (ADD): EX starts at 12. Duration 1. Finishes at 12.
- (MUL): EX starts at 13. Duration 2. Finishes at 14.
Total execution time with forwarding = 16 cycles.Speedup CalculationRounded to 2 decimal places, the speedup is 1.88.64
Q64NAT2 marksMediumConsider a network using the pure ALOHA medium access control protocol, where each frame is of length bits. The channel transmission rate is Mbps ( bits per…Think it through. Then check your answer.Question
Consider a network using the pure ALOHA medium access control protocol, where each frame is of length bits. The channel transmission rate is Mbps ( bits per second). The aggregate number of transmissions across all the nodes (including new frame transmissions and retransmitted frames due to collisions) is modelled as a Poisson process with a rate of frames per second. Throughput is defined as the average number of frames successfully transmitted per second. The throughput of the network (rounded to the nearest integer) is ___________.Correct answer
130 to 140
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In Pure ALOHA, the throughput is given by the formula:where is the offered load (average number of frames per frame transmission time).Step 1: Calculate the frame transmission time ():Step 2: Calculate the offered load ():
The aggregate arrival rate is given as frames per second.Step 3: Calculate the throughput ():This represents the average number of successful transmissions per frame time .Step 4: Calculate the throughput in frames per second:Step 5: Round to the nearest integer:
The throughput is approximately frames per second. The official GATE answer key provides a range of to .65
Q65NAT2 marksMediumIn a directed acyclic graph with a source vertex , the quality-score of a directed path is defined to be the product of the weights of the edges on the path. Further, for a…Think it through. Then check your answer.Question
In a directed acyclic graph with a source vertex , the quality-score of a directed path is defined to be the product of the weights of the edges on the path. Further, for a vertex other than , the quality-score of is defined to be the maximum among the quality-scores of all the paths from to . The quality-score of is assumed to be 1.The sum of the quality-scores of all the vertices in the graph shown above is __________.
Correct answer
929 to 929
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let denote the quality-score of vertex . We are given .
For any other vertex , .
This can be computed using dynamic programming or by processing vertices in topological order: .Let's compute the quality-scores for each vertex:1.: (Given)2.: Incoming from . .3.: Incoming from . .4.: Incoming from . .5.: Incoming from . .6.: Incoming from and .- Via :
- Via :
- .
- Via :
- Via :
- .
- Via :
- Via :
- .
- Via :
- Via :
- .
Sum
Sum
Sum
Sum
Sum .