The PYQ practice room
GATE CS 2017 Set 1
All 65 solved GATE CS 2017 Set 1 questions in exam order. Open a question, commit to an answer, and learn from the step-by-step solution. One question at a time.
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.Questions
65
Paper marks
100
Question formats
2
MCQ · NAT
Revision mode
Self-paced
No timer. Focus on understanding.
Explore the questions
General Aptitude (GA)
1056
Q56MCQ1 markEasyAfter Rajendra Chola returned from his voyage to Indonesia, he __________ to visit the temple in Thanjavur.Think it through. Then check your answer.Question
After Rajendra Chola returned from his voyage to Indonesia, he __________ to visit the temple in Thanjavur.Correct answer
(C) wished
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The sentence describes a sequence of events that happened in the past. The first event, 'Rajendra Chola returned', is in the simple past tense. The action of wishing to visit the temple happened after his return.Let's analyze the options:- (A) 'was wishing' (past continuous) is used for an ongoing action in the past. It doesn't fit the context of a single desire or decision that followed an event.
- (B) 'is wishing' (present continuous) is incorrect because the entire context is in the past.
- (C) 'wished' (simple past) correctly indicates a completed action or state that occurred in the past, following the action of returning.
- (D) 'had wished' (past perfect) would imply that the wish occurred before he returned, which contradicts the logical flow suggested by 'After...'.
57
Q57MCQ1 markEasyResearch in the workplace reveals that people work for many reasons __________.Think it through. Then check your answer.Question
Research in the workplace reveals that people work for many reasons __________.Correct answer
(D) besides money
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
This question tests the difference between the words 'beside' and 'besides'.- Beside is a preposition that means 'next to' or 'at the side of'. For example, "He sat beside the driver."
- Besides is a preposition or an adverb that means 'in addition to' or 'apart from'. For example, "What other languages do you know besides Spanish?"
- (A) money beside: Incorrect word order and wrong word.
- (B) beside money: This would mean 'next to money', which is semantically incorrect in this context.
- (C) money besides: Incorrect word order.
- (D) besides money: This means 'in addition to money', which fits the context perfectly.
58
Q58MCQ1 markEasyRahul, Murali, Srinivas and Arul are seated around a square table. Rahul is sitting to the left of Murali. Srinivas is sitting to the right of Arul. Which of the following pairs…Think it through. Then check your answer.Question
Rahul, Murali, Srinivas and Arul are seated around a square table. Rahul is sitting to the left of Murali. Srinivas is sitting to the right of Arul. Which of the following pairs are seated opposite each other?Correct answer
(C) Srinivas and Murali
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the positions around the square table be 1, 2, 3, 4 in clockwise order.1.Rahul is sitting to the left of Murali.- If Murali is at position 1, Rahul is at position 2 (assuming facing the center, left is clockwise).
- Sequence: Murali Rahul.
- Right is anti-clockwise. If Arul is at position , Srinivas is at position .
- In clockwise terms, this means Arul is to the left of Srinivas, or Srinivas Arul.
- Position 1: Murali
- Position 2: Rahul
- Position 3: Srinivas
- Position 4: Arul
- Rahul (2) is left of Murali (1)? Yes.
- Srinivas (3) is right of Arul (4)? Yes (4's right is 3).
- Murali and Srinivas are opposite.
- Rahul and Arul are opposite.
59
Q59MCQ1 markEasyFind the smallest number such that is a perfect cube.Think it through. Then check your answer.Question
Find the smallest number such that is a perfect cube.Correct answer
(D) 36
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
First, find the prime factorization of 162:For a number to be a perfect cube, the exponent of every prime factor in its factorization must be a multiple of 3.
Currently, we have:- (needs 2 more to become )
- (needs 2 more to become , the next multiple of 3)
60
Q60MCQ1 markEasyThe probability that a -digit number does NOT contain the digits 0, 5, or 9 isThink it through. Then check your answer.Question
The probability that a -digit number does NOT contain the digits 0, 5, or 9 isCorrect answer
(C) 0.7^k
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The set of all possible digits is , which has 10 digits.
The digits to be excluded are .
The allowed digits are , which is a set of 7 digits.Assuming each digit position is independent and can be any of the 10 digits with equal probability (ignoring the leading zero constraint for 'number' vs 'string' distinction based on the options provided):The probability of choosing an allowed digit for one position is:For a -digit number, since the choice for each position is independent:61
Q61MCQ2 marksEasy"The hold of the nationalist imagination on our colonial past is such that anything inadequately or improperly nationalist is just not history." Which of the following statements…Think it through. Then check your answer.Question
"The hold of the nationalist imagination on our colonial past is such that anything inadequately or improperly nationalist is just not history."Which of the following statements best reflects the author's opinion?Correct answer
(B) History is viewed through the filter of nationalism.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The author states that the "nationalist imagination" has such a strong hold on the colonial past that anything not fitting the nationalist narrative ("inadequately or improperly nationalist") is dismissed as "not history". This implies that the perception of history is heavily biased or filtered by nationalism. Therefore, option (B) "History is viewed through the filter of nationalism" best reflects the author's opinion.62
Q62MCQ2 marksMediumSix people are seated around a circular table. There are at least two men and two women. There are at least three right-handed persons. Every woman has a left-handed person to her…Think it through. Then check your answer.Question
Six people are seated around a circular table. There are at least two men and two women. There are at least three right-handed persons. Every woman has a left-handed person to her immediate right. None of the women are right-handed. The number of women at the table isCorrect answer
(A) 2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the number of women and be the number of men. Total people = 6.
Given constraints:1. and .2.Number of right-handed people () .3.Every woman has a left-handed person to her immediate right.4.None of the women are right-handed (i.e., all women are left-handed).From constraint 4, all women are left-handed. Since , and women cannot be right-handed, all right-handed people must be men. Therefore, .Since and , the possible values for are 2, 3, or 4. However, since , can only be 2 or 3.Case 1:
Then . Since we need at least 3 right-handed people, all 3 men must be right-handed. All 3 women are left-handed.
Constraint 3 says every woman must have a left-handed person to her right. Since all men are right-handed, a woman cannot have a man to her right. She must have another woman to her right. This implies the 3 women must be seated consecutively: . The person to the right of must also be left-handed. But the remaining people are men (who are right-handed). This is a contradiction. Thus, .Case 2:
Then . We need right-handed people. Since women are left-handed, we have 2 left-handed women. The men can be right-handed or left-handed. To satisfy , at least 3 men must be right-handed. Let's assume 3 men are right-handed and 1 man is left-handed.
Let the two women be . Since needs a left-handed person to her right, and is left-handed, we can place them adjacent: . Now needs a left-handed person to her right. We can place the left-handed man () there. The sequence becomes .
This arrangement satisfies all constraints:- 2 Women, 4 Men (satisfies ).
- 3 Right-handed people (satisfies ).
- Every woman has a left-handed person to her right (, ).
- No woman is right-handed.
63
Q63MCQ2 marksEasyThe expression is equal toThink it through. Then check your answer.Question
The expression is equal toCorrect answer
(B) the minimum of x and y
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To determine what the expression represents, we consider two cases based on the relative values of and :1.Case 1:If , then .
Substituting this into the expression:
Since , is the minimum of and .2.Case 2:If , then .
Substituting this into the expression:
Since , is the minimum of and .In both cases, the expression simplifies to . Thus, the expression is equal to the minimum of and .Correct option is (B).64
Q64MCQ2 marksMediumArun, Gulab, Neel and Shweta must choose one shirt each from a pile of four shirts coloured red, pink, blue and white respectively. Arun dislikes the colour red and Shweta…Think it through. Then check your answer.Question
Arun, Gulab, Neel and Shweta must choose one shirt each from a pile of four shirts coloured red, pink, blue and white respectively. Arun dislikes the colour red and Shweta dislikes the colour white. Gulab and Neel like all the colours. In how many different ways can they choose the shirts so that no one has a shirt with a colour he or she dislikes?Correct answer
(D) 14
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Total number of ways to distribute 4 distinct shirts to 4 people is .Let the people be A, G, N, S and shirts be R, P, B, W.
Constraints:1.A cannot choose R.2.S cannot choose W.Let be the set of all permutations. .
Let be the set of permutations where A chooses R.
Let be the set of permutations where S chooses W.We want to find the number of valid permutations, which is .Using the Inclusion-Exclusion Principle:1.Calculate (A gets R):A is fixed to R. The remaining 3 people (G, N, S) can be arranged in ways.
.2.Calculate (S gets W):S is fixed to W. The remaining 3 people (A, G, N) can be arranged in ways.
.3.Calculate (A gets R AND S gets W):A is fixed to R, and S is fixed to W. The remaining 2 people (G, N) can be arranged in ways.
.Now, .The number of valid ways is .65
Q65MCQ2 marksMediumA contour line joins locations having the same height above the mean sea level. The following is a contour plot of a geographical region. Contour lines are shown at 25 m intervals…Think it through. Then check your answer.Question
A contour line joins locations having the same height above the mean sea level. The following is a contour plot of a geographical region. Contour lines are shown at 25 m intervals in this plot. If in a flood, the water level rises to 525 m, which of the villages P, Q, R, S, T get submerged?
Correct answer
(C) R, S, T
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The problem asks to identify villages with an elevation less than 525 m, as these will be submerged.1.Analyze the contour lines:- The lines are at 25 m intervals.
- We see labels for 425, 450, 500, and 550.
- Between the 500 m line and the 550 m line, there must be one intermediate line representing 525 m (since ).
- Similarly, between 450 m and 500 m, there is a line for 475 m.
- Village P: It is enclosed by the 550 m contour line. Since contour values increase towards the center of the peak (indicated by the progression 425 -> 450 -> ... -> 550), the elevation of P is m. P is safe.
- Village Q: It is inside a separate closed loop on the right. Given the topography, this is likely another peak or high ground similar to P. Assuming it follows the general rising trend or is a local peak above the surrounding 500+ m terrain, Q is likely m. If Q were in a depression (sinkhole), it would typically be marked with hachures, which are absent. Thus, Q is safe.
- Village R: It is located in the region between the 450 m and 500 m contours (specifically near the 475 m line). Its elevation is clearly m, so it is m. R will be submerged.
- Village S: It is located near the 450 m contour. Its elevation is m. S will be submerged.
- Village T: It is located near the 500 m contour line but outside the 525 m contour line (which is the line immediately surrounding the 550 m peak area). Its elevation is approximately 500 m, which is m. T will be submerged.
Computer Science and Information Technology
551
Q1MCQ1 markEasyThe statement is logically equivalent to which of the statements below? I. II. III. IV.…Think it through. Then check your answer.Question
The statement is logically equivalent to which of the statements below?I.
II.
III.
IV.Correct answer
(D) II and III only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The given statement is .1.Contrapositive: The contrapositive of an implication is , which is logically equivalent to the original statement.- Contrapositive of is , which simplifies to .
- This matches statement II.
- Applying this to , we get , which simplifies to .
- Since disjunction is commutative, is equivalent to .
- This matches statement III.
Statement IV () is equivalent to , not the original statement.Thus, statements II and III are logically equivalent to the given statement.2
Q2MCQ1 markMediumConsider the first-order logic sentence . Assuming non-empty logical domains, which of the sentences below are implied by ? I.…Think it through. Then check your answer.Question
Consider the first-order logic sentence . Assuming non-empty logical domains, which of the sentences below are implied by ?I.
II.
III.
IV.Correct answer
(B) I and IV only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The sentence is .- Statement IV:
So, IV becomes , which is exactly . Thus, IV is implied (equivalent).- Statement I:
- Statement II:
- Statement III:
3
Q3MCQ1 markMediumLet be scalars, not all zero, such that where are column vectors in . Consider the set of linear equations…Think it through. Then check your answer.Question
Let be scalars, not all zero, such that where are column vectors in .
Consider the set of linear equationswhere and . The set of equations hasCorrect answer
(C) infinitely many solutions
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Linear Dependence: We are given with not all zero. This implies that the columns of matrix are linearly dependent. Therefore, the matrix is singular (determinant is 0), and the homogeneous system has non-trivial solutions (infinitely many).2.Consistency: The vector is given as . This can be written as a linear combination of the columns of with coefficients all equal to 1. Specifically, if we let (denoted as ), then . Thus, the system is consistent and is a particular solution.3.Conclusion: Since the system is consistent and the matrix is singular (rank ), the general solution is given by , where is any solution to the homogeneous equation . Since there are infinitely many such , there are infinitely many solutions to .4
Q4MCQ1 markEasyConsider the following functions from positive integers to real numbers: The CORRECT arrangement of the above functions in increasing…Think it through. Then check your answer.Question
Consider the following functions from positive integers to real numbers:The CORRECT arrangement of the above functions in increasing order of asymptotic complexity is:Correct answer
(B) (100)/(n), 10, ₂ n, √(n), n
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To arrange the functions in increasing order of asymptotic complexity, we analyze their growth rates as :1.: As , this function approaches 0. Its growth rate is less than constant ().2.: This is a constant function, .3.: Logarithmic growth, . We know that .4.: Fractional power growth, . We know that .5.: Linear growth, . We know that .Combining these, the increasing order is:This matches option (B).5
Q5MCQ1 markEasyConsider the following table: | Algorithms | Design Paradigms | |---|---| | (P) Kruskal | (i) Divide and Conquer | | (Q) Quicksort | (ii) Greedy | | (R) Floyd-Warshall | (iii)…Think it through. Then check your answer.Question
Consider the following table:Match the algorithms to the design paradigms they are based on.Algorithms Design Paradigms (P) Kruskal (i) Divide and Conquer (Q) Quicksort (ii) Greedy (R) Floyd-Warshall (iii) Dynamic Programming Correct answer
(C) (P) rightarrow (ii), (Q) rightarrow (i), (R) rightarrow (iii)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The correct matching is based on the design paradigms of the algorithms:1.(P) Kruskal's Algorithm: This algorithm is used for finding the Minimum Spanning Tree (MST) of a graph. It works by sorting edges by weight and iteratively adding the smallest edge that doesn't form a cycle. This local optimal choice at each step characterizes the Greedy approach. Hence, (P) matches with (ii).2.(Q) Quicksort: This sorting algorithm works by selecting a pivot element and partitioning the array into two sub-arrays (elements less than the pivot and elements greater than the pivot), then recursively sorting the sub-arrays. This breaking down of a problem into sub-problems is the Divide and Conquer paradigm. Hence, (Q) matches with (i).3.(R) Floyd-Warshall Algorithm: This algorithm finds all-pairs shortest paths in a weighted graph. It constructs the solution bottom-up by considering shortest paths using an increasing set of intermediate vertices. This approach of solving sub-problems and storing their results is Dynamic Programming. Hence, (R) matches with (iii).Thus, the correct correspondence is (P) (ii), (Q) (i), (R) (iii).6
Q6MCQ1 markEasyLet be a binary search tree with 15 nodes. The minimum and maximum possible heights of are: Note: The height of a tree with a single node is 0.Think it through. Then check your answer.Question
Let be a binary search tree with 15 nodes. The minimum and maximum possible heights of are:
Note: The height of a tree with a single node is 0.Correct answer
(B) 3 and 14 respectively
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The height of a tree is defined as the number of edges on the longest path from the root to a leaf. For a single node, height is 0.Minimum Height:
A binary tree has minimum height when it is as complete as possible. The maximum number of nodes in a binary tree of height is given by .
We need
For , max nodes . Thus, a complete binary tree of height 3 has exactly 15 nodes.
Minimum height = 3.Maximum Height:
A binary tree has maximum height when it is a skewed tree (each node has only one child).
For nodes, the number of edges in a skewed tree is .
Maximum height .Therefore, the minimum and maximum heights are 3 and 14 respectively.7
Q7MCQ1 markEasyThe -bit fixed-point representation of an unsigned real number uses bits for the fraction part. Let . The range of decimal values for in this…Think it through. Then check your answer.Question
The -bit fixed-point representation of an unsigned real number uses bits for the fraction part. Let . The range of decimal values for in this representation isCorrect answer
(D) 0 to (2ⁱ - 2^(-f))
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In an unsigned fixed-point representation with bits total and fractional bits:- The smallest value is when all bits are 0, which represents .
- The largest value is when all bits are 1.
With integer bits and fractional bits:- The maximum integer part (all 1s) is .
- The maximum fractional part (all 1s) is (geometric series sum).
Max value = (Max integer value of bits) (weight of LSB)
Max integer value of bits = .
Weight of LSB = .
Max value = .Thus, the range is to .8
Q8MCQ1 markEasyConsider the C code fragment given below. [code] Assuming that m and n point to valid NULL-terminated linked lists, invocation of join willThink it through. Then check your answer.Question
Consider the C code fragment given below.Assuming that m and n point to valid NULL-terminated linked lists, invocation of join willtypedef struct node { int data; node* next; } node; void join(node* m, node* n) { node* p = n; while (p->next != NULL) { p = p->next; } p->next = m; }Correct answer
(B) either cause a null pointer dereference or append list m to the end of list n.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The functionjoinattempts to append listmto the end of listn.1.node* p = n;initializespto the head of listn.2.The loopwhile (p->next != NULL)is intended to traverse to the last node ofn.3.Scenario 1:p->next = m;links the last node ofnto the head ofm.nis not NULL (non-empty list)
The code works as intended.ptraverses to the last node, andmis appended. Result:mappended ton.Scenario 2:nis NULL (empty list)pbecomesNULL. The conditionp->nextin the while loop attempts to dereference a NULL pointer, causing a crash (segmentation fault).Sincenbeing NULL is a valid state for a "valid NULL-terminated linked list" (an empty list), the code is not safe for all inputs.Therefore, it will either cause a null pointer dereference (ifnis NULL) or append listmton(ifnis not NULL).9
Q9MCQ1 markEasyWhen two 8-bit numbers and in 2's complement representation (with and as the least significant bits) are added using a **ripple-carry…Think it through. Then check your answer.Question
When two 8-bit numbers and in 2's complement representation (with and as the least significant bits) are added using a ripple-carry adder, the sum bits obtained are and the carry bits are . An overflow is said to have occurred ifCorrect answer
(C) (A₇ · B₇ · S₇ + A₇ · B₇ · S₇) is 1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In 2's complement addition, overflow occurs when the result of adding two numbers with the same sign yields a result with the opposite sign.Let and be the sign bits of the operands, and be the sign bit of the sum.1.Positive + Positive = Negative: If and , but , overflow has occurred. This condition is represented as .2.Negative + Negative = Positive: If and , but , overflow has occurred. This condition is represented as .Combining these two cases, overflow occurs if:
.Alternatively, overflow is defined as for the MSB, i.e., , but the expression in option (C) is the standard logic expression derived from the sign bits.10
Q10MCQ1 markMediumConsider the following context-free grammar over the alphabet with as the start symbol: Which…Think it through. Then check your answer.Question
Consider the following context-free grammar over the alphabet with as the start symbol:
Which one of the following represents the language generated by the above grammar?Correct answer
(B) \(ab)ⁿ cb^(m₁) cb^(m₂) … cb^(mₙ) n, m₁, m₂, …, mₙ ≥ 1\
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The grammar is:
First, analyze . generates one or more 's, i.e., .Now analyze . The recursive production is . The base case is .
Expanding :
In general, after applications (where ), we get:
(with occurrences of ).Since each independently generates , let the number of 's generated by the -th be .
The string becomes:
where and each .This matches option (B): .11
Q11MCQ1 markMediumConsider the C struct defined below: [code] The base address ofstudentis available in register R1. The fieldstudent.gradecan be accessed efficiently usingThink it through. Then check your answer.Question
Consider the C struct defined below:struct data { int marks [100]; char grade; int cnumber; }; struct data student;
The base address ofstudentis available in register R1. The fieldstudent.gradecan be accessed efficiently usingCorrect answer
(D) Index addressing mode, X(R1), where X is an offset represented in 2's complement 16-bit representation.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The structurestudenthas the following layout (assumingintis 4 bytes andcharis 1 byte):marks: Array of 100 integers. Size = bytes. Offset 0.grade: Character. Offset 400.cnumber: Integer. Offset 401 (or 404 with padding).
studentis in R1. To accessstudent.grade, we need to access the memory location atR1 + 400.This corresponds to Index addressing mode (also known as Base-Displacement or Displacement addressing), denoted as X(R1), where X is the constant offset (400).12
Q12MCQ1 markEasyConsider the following intermediate program in three address code [code] Which one of the following corresponds to a static single assignment form of the above code?Think it through. Then check your answer.Question
Consider the following intermediate program in three address codeWhich one of the following corresponds to a static single assignment form of the above code?p = a - b q = p * c p = u * v q = p + qCorrect answer
(B) [code]
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Static Single Assignment (SSA) form is an intermediate representation used in compilers where each variable is assigned exactly once, and every variable is defined before it is used.Original code:1.2.3.4.To convert this to SSA, we must create a new version of a variable every time it is assigned. Let's trace the data flow:- Line 1: is assigned. Let's call this version . So, .
- Line 2: is assigned. Let's call this version . It uses the current value of , which is . So, .
- Line 3: is assigned again. We must use a new version, . So, .
- Line 4: is assigned again. We must use a new version, . It uses the current value of (from line 3, which is ) and the current value of (from line 2, which is ). So, .
- Option (A): and are assigned twice, which violates the fundamental rule of SSA.
- Option (B): Every assignment uses a unique variable name (). The data dependencies are correctly maintained: uses (the result of the first line), and uses (the result of the third line) and (the result of the second line). This is a valid SSA form.
- Option (C): Uses variables like and that are never defined in the code.
- Option (D): Uses unversioned variables and in the expressions, which is not allowed in SSA.
13
Q13MCQ1 markMediumConsider the following C code: [code] The code suffers from which one of the following problems:Think it through. Then check your answer.Question
Consider the following C code:The code suffers from which one of the following problems:#include <stdio.h> int *assignval(int *x, int val) { *x = val; return x; } void main () { int *x = malloc(sizeof(int)); if(NULL == x) return; x = assignval(x,0); if(x) { x = (int *)malloc(sizeof(int)); if (NULL == x) return; x = assignval(x, 10); } printf("%d\n", *x); free(x); }Correct answer
(D) compiles successfully but execution may result in memory leak
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The program allocates memory toxusingmalloc. Inside theif(x)block,xis reassigned to a new memory block allocated by a secondmalloccall. The address of the first allocated block is overwritten without being freed, causing a memory leak. Thefree(x)at the end only frees the second block.14
Q14MCQ1 markEasyConsider a TCP client and a TCP server running on two different machines. After completing data transfer, the TCP client callscloseto terminate the connection and a FIN…Think it through. Then check your answer.Question
Consider a TCP client and a TCP server running on two different machines. After completing data transfer, the TCP client callscloseto terminate the connection and a FIN segment is sent to the TCP server. Server-side TCP responds by sending an ACK, which is received by the client-side TCP. As per the TCP connection state diagram (RFC 793), in which state does the client-side TCP connection wait for the FIN from the server-side TCP?Correct answer
(D) FIN-WAIT-2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.The client sends a FIN segment and enters the FIN-WAIT-1 state.2.The server receives the FIN, sends an ACK, and enters the CLOSE-WAIT state.3.The client receives the ACK for its FIN and transitions to the FIN-WAIT-2 state.4.In FIN-WAIT-2, the client waits for the server to send its own FIN segment.15
Q15MCQ1 markMediumA sender S sends a message to receiver R, which is digitally signed by S with its private key. In this scenario, one or more of the following security violations can take…Think it through. Then check your answer.Question
A sender S sends a message to receiver R, which is digitally signed by S with its private key. In this scenario, one or more of the following security violations can take place.(I) S can launch a birthday attack to replace with a fraudulent message.
(II) A third party attacker can launch a birthday attack to replace with a fraudulent message.
(III) R can launch a birthday attack to replace with a fraudulent message.Which of the following are possible security violations?Correct answer
(B) (I) only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A birthday attack allows finding two distinct messages and such that .- (I) is possible: The sender S can generate a collision pair , sign , and later claim to have signed (since the signature on the hash is valid for both). This allows S to repudiate the original message.
- (II) and (III) are not possible via birthday attack: For a third party or R to replace with , they would need to find an that hashes to the same value as the specific already chosen and signed by S. This requires breaking second preimage resistance, which is computationally much harder than a birthday attack (finding any collision).
16
Q16MCQ1 markMediumThe following functional dependencies hold true for the relational schema :…Think it through. Then check your answer.Question
The following functional dependencies hold true for the relational schema :Which of the following is irreducible equivalent for this set of functional dependencies?Correct answer
(A) V arrow W, V arrow X, Y arrow V, Y arrow Z
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the irreducible (canonical) cover, we follow these steps:1.Right-hand side decomposition: Split FDs so each has a single attribute on the RHS.V → WVW → XY → VY → XY → Z
InVW → X, check if is extraneous. We compute using the other FDs. (usingV → W). Since is reachable from via the original set (V → WandVW → X), is extraneous inVW → X. The FD becomesV → X.
Current set: .3.Remove redundant functional dependencies:Check ifY → Xis redundant. Compute withoutY → X: (using ). Since is still reachable,Y → Xis redundant.
Final irreducible set: . This matches option (A).17
Q17MCQ1 markEasyConsider the following grammar: | | | |---|---| | | | | | | | | | | | | What is…Think it through. Then check your answer.Question
Consider the following grammar:What is ?Correct answer
(C) \w, y\
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
is the set of terminals that can appear immediately to the right of in a sentential form.
From the production , we have:
(because )Given:
Therefore:
.18
Q18MCQ1 markEasyThreads of a process shareThink it through. Then check your answer.Question
Threads of a process shareCorrect answer
(D) both heap and global variables.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Threads within the same process share the same address space. This shared space includes:1.Code segment: The executable instructions.2.Data segment: Global and static variables.3.Heap: Memory allocated dynamically during runtime.4.OS resources: Such as open files and signals.Each thread maintains its own private stack, registers, and program counter. Therefore, threads share both heap and global variables.19
Q19NAT1 markMediumLet be a Gaussian random variable with mean 0 and variance . Let where is the maximum of and . The median of is ________ .Think it through. Then check your answer.Question
Let be a Gaussian random variable with mean 0 and variance . Let where is the maximum of and . The median of is ________ .Correct answer
0 to 0
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Since is a Gaussian random variable with mean 0, its distribution is symmetric about 0, so .The random variable is defined as .- If , .
- If , .
For , both conditions are satisfied ( and ).
Thus, the median of is 0.20
Q20NAT1 markEasyLet be a tree with 10 vertices. The sum of the degrees of all the vertices in is ________ .Think it through. Then check your answer.Question
Let be a tree with 10 vertices. The sum of the degrees of all the vertices in is ________ .Correct answer
18 to 18
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
For any tree with vertices, the number of edges is .
Given , the number of edges is .According to the Handshaking Lemma, the sum of degrees of all vertices in a graph is equal to twice the number of edges:21
Q21NAT1 markMediumConsider the Karnaugh map given below, where X represents "don't care" and blank represents 0. [figure] Assume for all inputs , the respective complements…Think it through. Then check your answer.Question
Consider the Karnaugh map given below, where X represents "don't care" and blank represents 0.Assume for all inputs , the respective complements are also available. The above logic is implemented using 2-input NOR gates only. The minimum number of gates required 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
From the K-map:- Columns represent (00, 01, 11, 10).
- Rows represent (00, 01, 11, 10).
- Row 01 (), Col 00 ()
- Row 11 (), Col 00 ()
- Row 11 (), Col 10 ()
- Row 01 (), Col 10 ()
- Rows 01 and 11 correspond to .
- Columns 00 and 10 correspond to .
Using De Morgan's laws, .
Thus, .Since the complements are available, we can directly feed and into a single NOR gate.
Total gates required = 1.22
Q22NAT1 markEasyConsider the language given by the regular expression over the alphabet . The smallest number of states needed in a deterministic finite-state…Think it through. Then check your answer.Question
Consider the language given by the regular expression over the alphabet . The smallest number of states needed in a deterministic finite-state automaton (DFA) accepting 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 regular expression represents the set of all strings over where the second symbol from the right is 'b'.To construct the minimal DFA, we need to keep track of the recent history of inputs to determine if the condition is met. Specifically, we need to know if the last symbol read was 'b' (which would make the current symbol valid as the last symbol of an accepted string) or not.The states can be defined based on the relevant suffixes read so far:1.: Start state, or the last symbol was 'a' and the one before it was not 'b' (e.g., suffix or ).2.: The last symbol read was 'b' (e.g., suffix or ). This is a potential start of the pattern .3.: The last two symbols were . Since the second-to-last was 'b', this is an accepting state.4.: The last two symbols were . Since the second-to-last was 'b', this is an accepting state. Also, the last symbol is 'b', so we stay in a state indicating the last symbol is 'b'.Transitions:- From (suffix or ):
- Input (suffix , condition not met)
- Input (suffix , last is )
- From (suffix ):
- Input (suffix , accepted)
- Input (suffix , accepted)
- From (suffix , accepted):
- Input (suffix , 2nd last is , reject)
- Input (suffix , 2nd last is , reject; last is )
- From (suffix , accepted):
- Input (suffix , 2nd last is , accept)
- Input (suffix , 2nd last is , accept)
23
Q23NAT1 markMediumConsider a database that has the relation schema EMP (EmpId, EmpName, and DeptName). An instance of the schema EMP and a SQL query on it are given below. | EmpId | EmpName |…Think it through. Then check your answer.Question
Consider a database that has the relation schema EMP (EmpId, EmpName, and DeptName). An instance of the schema EMP and a SQL query on it are given below.EmpId EmpName DeptName 1 XYA AA 2 XYB AA 3 XYC AA 4 XYD AA 5 XYE AB 6 XYF AB 7 XYG AB 8 XYH AC 9 XYI AC 10 XYJ AC 11 XYK AD 12 XYL AD 13 XYM AE The output of executing the SQL query is _______.SELECT AVG(EC.Num) FROM EC WHERE (DeptName, Num) IN (SELECT DeptName, COUNT(EmpId) AS EC(DeptName, Num) FROM EMP GROUP BY DeptName)Correct answer
2.6 to 2.6
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The subquery calculates the count of employees for each department:- AA: 4 employees
- AB: 3 employees
- AC: 3 employees
- AD: 2 employees
- AE: 1 employee
Average = .24
Q24NAT1 markMediumConsider the following CPU processes with arrival times (in milliseconds) and length of CPU bursts (in milliseconds) as given below : | Process | Arrival time | Burst time |…Think it through. Then check your answer.Question
Consider the following CPU processes with arrival times (in milliseconds) and length of CPU bursts (in milliseconds) as given below :If the pre-emptive shortest remaining time first scheduling algorithm is used to schedule the processes, then the average waiting time across all processes is _______ milliseconds.Process Arrival time Burst time P1 0 7 P2 3 3 P3 5 5 P4 6 2 Correct answer
3 to 3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Using the Pre-emptive Shortest Remaining Time First (SRTF) algorithm:1.t=0 to 3: P1 arrives and starts. At , P1 has 4ms remaining.2.t=3 to 6: P2 arrives with burst 3ms. Since , P2 preempts P1. P2 finishes at .3.t=6 to 8: At , P4 arrives with burst 2ms. Remaining: P1(4), P3(5), P4(2). P4 is shortest. P4 finishes at .4.t=8 to 12: Remaining: P1(4), P3(5). P1 is shorter. P1 finishes at .5.t=12 to 17: P3 runs and finishes at .Waiting Times (WT = Completion Time - Arrival Time - Burst Time):- P1: ms
- P2: ms
- P3: ms
- P4: ms
25
Q25NAT1 markMediumConsider a two-level cache hierarchy with L1 and L2 caches. An application incurs 1.4 memory accesses per instruction on average. For this application, the miss rate of L1 cache…Think it through. Then check your answer.Question
Consider a two-level cache hierarchy with L1 and L2 caches. An application incurs 1.4 memory accesses per instruction on average. For this application, the miss rate of L1 cache is 0.1; the L2 cache experiences, on average, 7 misses per 1000 instructions. The miss rate of L2 expressed correct to two decimal places is ________.Correct answer
0.05 to 0.05
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the number of instructions be .
Total memory accesses = .L1 Cache:
Miss rate of L1 () = 0.1
Number of L1 misses = Total accesses .L2 Cache:
The misses from L1 are the accesses to L2.
Number of L2 accesses = Number of L1 misses = .Number of L2 misses is given as 7 per 1000 instructions.
Number of L2 misses = .L2 Miss Rate ():The miss rate of L2 is 0.05.26
Q26MCQ2 marksMediumLet be any connected undirected edge-weighted graph. The weights of the edges in are positive and distinct. Consider the following statements: (I) Minimum…Think it through. Then check your answer.Question
Let be any connected undirected edge-weighted graph. The weights of the edges in are positive and distinct. Consider the following statements:(I) Minimum Spanning Tree of is always unique.
(II) Shortest path between any two vertices of is always unique.Which of the above statements is/are necessarily true?Correct answer
(A) (I) only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement (I): If all edge weights in a connected undirected graph are distinct, then the Minimum Spanning Tree (MST) is unique. This is a standard theorem in graph theory. Thus, (I) is true.Statement (II): Distinct edge weights do not guarantee unique shortest paths. Consider a triangle graph with vertices A, B, C and edges:- with weight 5
- with weight 3
- with weight 2
The shortest path from A to B can be the direct edge with cost 5.
Alternatively, the path has cost .
Since there are two paths with the same minimum cost, the shortest path is not unique. Thus, (II) is false.Therefore, only statement (I) is necessarily true.27
Q27MCQ2 marksMediumA multithreaded program P executes with number of threads and uses number of locks for ensuring mutual exclusion while operating on shared memory locations. All locks in…Think it through. Then check your answer.Question
A multithreaded program P executes with number of threads and uses number of locks for ensuring mutual exclusion while operating on shared memory locations. All locks in the program are non-reentrant, i.e., if a thread holds a lock , then it cannot re-acquire lock without releasing it. If a thread is unable to acquire a lock, it blocks until the lock becomes available. The minimum value of and the minimum value of together for which execution of P can result in a deadlock are:Correct answer
(D) x = 1, y = 1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The problem specifies that the locks are non-reentrant. A non-reentrant lock cannot be acquired again by the thread that already holds it.Consider the case with (one thread) and (one lock ).1.Thread acquires lock .2.Thread attempts to acquire lock again (e.g., inside a recursive function or a nested critical section).3.Since the lock is non-reentrant, must wait for to be released.4.However, is held by itself, which is blocked waiting for . will never release .This results in a deadlock (specifically, a self-deadlock). Thus, the minimum values are and .28
Q28MCQ2 marksEasyThe value ofThink it through. Then check your answer.Question
The value ofCorrect answer
(C) is 1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let .
At , the numerator is and the denominator is . Since it is a form, we can apply L'Hopital's Rule.Differentiating numerator and denominator with respect to :
Numerator derivative:
Denominator derivative: Now, take the limit as :
Thus, the limit is 1.29
Q29MCQ2 marksMediumLet and be propositions and the expression be a contradiction. Then, the expression isThink it through. Then check your answer.Question
Let and be propositions and the expression be a contradiction. Then, the expression isCorrect answer
(D) always TRUE when q is TRUE.
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 contradiction, which means it evaluates to FALSE.
For an implicationA → Bto be FALSE, must be TRUE and must be FALSE.
Here, and .
So, we have:1.2.We need to evaluate the expression .
Substitute :
Since is always TRUE regardless of the value of , the expression simplifies to:
Since is logically equivalent to , the value of the expression depends entirely on .Checking the options:
(A) It is not a tautology because can be FALSE.
(B) It is not a contradiction because can be TRUE.
(C) If is FALSE, is TRUE (consistent with premise), but could still be FALSE. So the expression is not necessarily TRUE.
(D) If is TRUE, then the expression (which is equivalent to ) is TRUE. This holds.Thus, the expression is always TRUE when is TRUE.30
Q30MCQ2 marksMediumLet and be two vectors in whose Euclidean norms satisfy . What is the value of such that bisects the angle…Think it through. Then check your answer.Question
Let and be two vectors in whose Euclidean norms satisfy . What is the value of such that bisects the angle between and ?Correct answer
(A) 2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The angle bisector of two vectors and lies along the direction of the sum of the unit vectors of and . That is, the bisector is parallel to:
We are given that bisects the angle. Therefore, must be a scalar multiple of the vector above:
Given , let , then . Substituting these values:
Comparing the coefficients of and :
Coefficient of :
Coefficient of : Substitute into the equation for :
Thus, .31
Q31MCQ2 marksHardLet be real valued square symmetric matrix of rank 2 with . Consider the following statements. I. One eigenvalue must…Think it through. Then check your answer.Question
Let be real valued square symmetric matrix of rank 2 with . Consider the following statements.I. One eigenvalue must be in
II. The eigenvalue with the largest magnitude must be strictly greater than 5Which of the above statements about eigenvalues of is/are necessarily CORRECT?Correct answer
(B) (I) only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given that is a symmetric matrix, the sum of the squares of its elements is equal to the sum of the squares of its eigenvalues (Frobenius norm property for symmetric matrices):Since the rank of is 2, there are exactly 2 non-zero eigenvalues, say and . The remaining eigenvalues are 0.
Thus, .Statement I: One eigenvalue must be in .
If , then 0 is an eigenvalue, and .
If , we have . Suppose both eigenvalues are outside . Then and , which implies and . Summing these gives , a contradiction. Therefore, at least one eigenvalue must satisfy , i.e., . Statement I is TRUE.Statement II: The eigenvalue with the largest magnitude must be strictly greater than 5.
Consider the case where and . Then . The largest magnitude is 5, which is not strictly greater than 5. Thus, Statement II is NOT necessarily true.Therefore, only Statement I is necessarily correct.32
Q32MCQ2 marksMediumA computer network uses polynomials over for error checking with 8 bits as information bits and uses as the generator polynomial to generate the check bits.…Think it through. Then check your answer.Question
A computer network uses polynomials over for error checking with 8 bits as information bits and uses as the generator polynomial to generate the check bits. In this network, the message 01011011 is transmitted asCorrect answer
(C) 01011011101
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The message is . Ignoring the leading zero, the bit sequence is . The generator polynomial is , which corresponds to the bit sequence .To find the transmitted message (CRC), we append 3 zeros (degree of ) to the message: .
We perform modulo-2 division (XOR division) of by .Dividend:
Divisor:1.Take first 4 bits . .2.Bring down next bits until we have a leading 1. The sequence becomes . The first '1' is at the 6th position (from left). We align the divisor with this '1'.Current remainder part:
(1 time)
(shift divisor? No, align MSB)
Actually, let's do step-by-step:- vs -> 0
- Next significant block starts at the 2nd '1' in the original message? No, the result of XOR was 0. We bring down the rest: .
- Leading bit is 0, shift. .
- (Remainder )
- (Remainder )
- (Remainder )
Message polynomial (from 1011011).
Multiply by : .
Divisor .
Remainder:
Remainder:
Remainder: corresponds to binary .
So the check bits are .
The transmitted message is the original message appended with : .33
Q33MCQ2 marksMediumConsider a combination of T and D flip-flops connected as shown below. The output of the D flip-flop is connected to the input of the T flip-flop and the output of the T flip-flop…Think it through. Then check your answer.Question
Consider a combination of T and D flip-flops connected as shown below. The output of the D flip-flop is connected to the input of the T flip-flop and the output of the T flip-flop is connected to the input of the D flip-flop.Initially, both and are set to 1 (before the clock cycle). The outputs
Correct answer
(B) Q₁ Q₀ after the 3^(rd) cycle are 11 and after the 4^(th) cycle are 01 respectively
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
From the circuit diagram:- The input to the D flip-flop () is . So, .
- The input to the T flip-flop () is . So, .
State: Cycle 2:
State: Cycle 3:
State: (This matches the initial state)Cycle 4:
State: Result:
After 3rd cycle:
After 4th cycle:34
Q34MCQ2 marksMediumIf is a grammar with productions where is the start variable, then which one of the following strings is not…Think it through. Then check your answer.Question
If is a grammar with productionswhere is the start variable, then which one of the following strings is not generated by ?Correct answer
(D) babba
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The given grammar is:Let's analyze the number of 's () and 's () generated by each production:1.: . ()2.: Adds one . ( increases by 1, unchanged)3.: Adds one and one . ( increases by 1, increases by 1)4.: Adds one and one . ( increases by 1, increases by 1)5.From the base case (), we have . All recursive steps either add equal numbers of 's and 's (maintaining ) or add an extra (increasing relative to ).Thus, an invariant of this grammar is that for any string generated by , the number of 's must be greater than or equal to the number of 's ().Let's check the options:S → SS: Combines counts.
(A) : . (, possible)
(B) : . (, possible)
(C) : . (, possible)
(D) : . (, impossible)Since option (D) has more 's than 's, it cannot be generated by the grammar.35
Q35MCQ2 marksMediumConsider the following two functions. [code] The output printed whenfun1(5)is called isThink it through. Then check your answer.Question
Consider the following two functions.The output printed whenvoid fun1(int n) { if(n == 0) return; printf("%d", n); fun2(n - 2); printf("%d", n); } void fun2(int n) { if(n == 0) return; printf("%d", n); fun1(++n); printf("%d", n); }fun1(5)is called isCorrect answer
(A) 53423122233445
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's trace the execution offun1(5):1.fun1(5)called.- Prints 5.
- Calls
fun2(5 - 2)->fun2(3).
fun2(3)called.- Prints 3.
- Calls
fun1(++n)->fun1(4)(Note:nbecomes 4 infun2's scope before passing).
fun1(4)called.- Prints 4.
- Calls
fun2(4 - 2)->fun2(2).
fun2(2)called.- Prints 2.
- Calls
fun1(++n)->fun1(3)(Note:nbecomes 3).
fun1(3)called.- Prints 3.
- Calls
fun2(3 - 2)->fun2(1).
fun2(1)called.- Prints 1.
- Calls
fun1(++n)->fun1(2)(Note:nbecomes 2).
fun1(2)called.- Prints 2.
- Calls
fun2(2 - 2)->fun2(0). fun2(0)returns immediately.- Prints 2 (after return).
- Returns.
fun2(1):- Prints 1.
- Returns.
fun1(3):- Prints 3.
- Returns.
fun2(2):- Prints 2.
- Returns.
fun1(4):- Prints 4.
- Returns.
fun2(3):- Prints 3.
- Returns.
fun1(5):- Prints 5.
- Returns.
Result: 53423122132435.36
Q36MCQ2 marksMediumConsider the C functionsfooandbargiven below: [code] Invocations offoo(3)andbar(3)will result in :Think it through. Then check your answer.Question
Consider the C functionsfooandbargiven below:Invocations ofint foo(int val) { int x = 0; while(val > 0) { x = x + foo(val--); } return val; } int bar(int val) { int x = 0; while(val > 0) { x = x + bar(val-1); } return val; }foo(3)andbar(3)will result in :Correct answer
(C) Abnormal termination and infinite loop respectively.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Analysis offoo(3):
Insidefoo(3), the loop condition isval > 0(3 > 0). The body executesx = x + foo(val--);.
The argument to the recursive call isval--. The post-decrement operator returns the current value ofval(which is 3) and then decrementsvalto 2.
So,foo(3)callsfoo(3)recursively.
This creates an infinite recursion:foo(3) -> foo(3) -> foo(3) ...
Infinite recursion leads to a Stack Overflow, which causes Abnormal termination.Analysis ofbar(3):
Insidebar(3), the loop condition isval > 0(3 > 0). The body executesx = x + bar(val-1);.bar(3)callsbar(2).bar(2)callsbar(1).bar(1)callsbar(0).bar(0)checksval > 0(0 > 0), which is false, and returns 0.
Control returns tobar(1).xbecomesx + 0. The loop checksval > 0(1 > 0) again.
Note thatvalis never modified inside thebarfunction (it is passed by value, andval-1does not change the localval).
Sobar(1)stays in thewhile(1 > 0)loop forever, repeatedly callingbar(0)and adding 0 tox.
This is an Infinite loop.Thus,foo(3)results in abnormal termination, andbar(3)results in an infinite loop.37
Q37MCQ2 marksMediumConsider the context-free grammars over the alphabet given below. and are non-terminals. …Think it through. Then check your answer.Question
Consider the context-free grammars over the alphabet given below. and are non-terminals.
The language isCorrect answer
(B) Not finite but regular.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze the languages generated by and .For :
generates any number of 's, i.e., .
generates , which results in where .
So, .For :
generates .
generates , which results in where .
So, .Now consider the intersection . A string must belong to both languages.
From , must be of the form .
From , must be of the form .Case 1: If , starts with . However, strings in start with (if ) or (if ). Thus, a string starting with cannot be in . So, must be 0.
Case 2: If , starts with . However, strings in start with (if ) or (if ). Thus, a string starting with cannot be in . So, must be 0.Therefore, for a string to be in the intersection, we must have and .
If , becomes .
If , becomes .The intersection consists of strings consisting only of 's. i.e., .This language is a regular language. Since there is no upper bound on , it is an infinite language.
Thus, the language is not finite but regular.38
Q38MCQ2 marksMediumConsider the following languages over the alphabet . Let and . Which of…Think it through. Then check your answer.Question
Consider the following languages over the alphabet .
Let and .Which of the following are context-free languages?I.
II.Correct answer
(A) I only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
is a Deterministic Context-Free Language (DCFL). A PDA can push 's, pop for 's, and then ignore 's.
is also a DCFL. A PDA can ignore 's, push 's, and pop for 's.I. : The union of two Context-Free Languages (CFLs) is always a CFL. Therefore, is context-free.II. : The intersection of two CFLs is NOT necessarily a CFL.
.
For to be in , number of 's = number of 's.
For to be in , number of 's = number of 's.
Thus, .
This is the standard example of a language that is NOT context-free (can be proved using Pumping Lemma).Therefore, only I is context-free.39
Q39MCQ2 marksMediumLet and be finite alphabets and let be a symbol outside both and . Let be a total function from to . We say is computable if there exists…Think it through. Then check your answer.Question
Let and be finite alphabets and let be a symbol outside both and . Let be a total function from to . We say is computable if there exists a Turing machine which given an input in , always halts with on its tape. Let denote the language .
Which of the following statements is true:Correct answer
(A) f is computable if and only if L_f is recursive.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We need to establish the relationship between the computability of a total function and the recursiveness of the language .1.If is computable is recursive:Since is computable, there exists a Turing Machine that, given , halts with on the tape. To decide , we can construct a TM that takes input . first checks if is of the form . If not, reject. If yes, it runs on to compute . Then it compares the computed with . If they are identical, accept; otherwise, reject. Since is total, always halts, so always halts. Thus, is recursive.2.If is recursive is computable:Since is recursive, there is a decider TM for it. To compute , we can construct a TM that takes as input. enumerates all strings in (e.g., in lexicographical order). For each , it runs on the string . Since is a total function, there exists exactly one such that , so . Eventually, will accept for the correct . When accepts, outputs and halts. Thus, is computable.Therefore, is computable if and only if is recursive.40
Q40MCQ2 marksMediumRecall that Belady's anomaly is that the page-fault rate may increase as the number of allocated frames increases. Now, consider the following statements: S1: *Random page…Think it through. Then check your answer.Question
Recall that Belady's anomaly is that the page-fault rate may increase as the number of allocated frames increases. Now, consider the following statements:S1: Random page replacement algorithm (where a page chosen at random is replaced) suffers from Belady's anomaly
S2: LRU page replacement algorithm suffers from Belady's anomalyWhich of the following is CORRECT?Correct answer
(B) S1 is true, S2 is false
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Belady's anomaly is the phenomenon where increasing the number of page frames results in an increase in the number of page faults. This anomaly is experienced by algorithms that do not satisfy the stack property (also known as the inclusion property).- S1: The Random page replacement algorithm does not satisfy the stack property and can suffer from Belady's anomaly. Thus, S1 is True.
- S2: LRU (Least Recently Used) is a stack algorithm (the set of pages in memory with frames is always a subset of the pages in memory with frames). Therefore, it is free from Belady's anomaly. Thus, S2 is False.
41
Q41MCQ2 marksMediumConsider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that the DeptId can be permitted to be NULL in the relation EMP.…Think it through. Then check your answer.Question
Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that the DeptId can be permitted to be NULL in the relation EMP. Consider the following queries on the database expressed in tuple relational calculus.(I)
(II)
(III) Which of the above queries are safe?Correct answer
(D) (I), (II) and (III)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A query in Tuple Relational Calculus (TRC) is safe if it produces a finite number of tuples. In the context of database theory questions (like in GATE), safety is often evaluated under the Active Domain Assumption, meaning the domain of attributes is restricted to the finite set of values currently present in the database instance.- Query (I): Selects tuples where
DeptIdis not equal to anyDeptIdin DEPT. Under the active domain assumption, the set of values in the domain but not in DEPT is finite. Thus, it is safe. - Query (II): Selects tuples where
DeptIdis not equal to someDeptIdin DEPT. This is also finite under the active domain assumption. - Query (III): Selects tuples where
DeptIdis equal to someDeptIdin DEPT. This restrictsDeptIdto values in the relation, so it is definitely finite and safe.
- Query (I): Selects tuples where
42
Q42MCQ2 marksMediumIn a database system, unique timestamps are assigned to each transaction using Lamport's logical clock. Let and be the timestamps of transactions and…Think it through. Then check your answer.Question
In a database system, unique timestamps are assigned to each transaction using Lamport's logical clock. Let and be the timestamps of transactions and respectively. Besides, holds a lock on the resource R, and has requested a conflicting lock on the same resource R. The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp.if then
is killed
else waits.Assume any transaction that is not killed terminates eventually. Which of the following is TRUE about the database system that uses the above algorithm to prevent deadlocks?Correct answer
(A) The database system is both deadlock-free and starvation-free.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The algorithm described is the Wound-Wait scheme for deadlock prevention:- If the requesting transaction is older (smaller timestamp) than the holding transaction , is killed (wounded).
- If is younger, it waits.
43
Q43NAT2 marksMediumConsider the following grammar: [code] where relop is a relational operator (e.g., <, >, ...),òrefers to the empty statement, and if, then, else are terminals.…Think it through. Then check your answer.Question
Consider the following grammar:where relop is a relational operator (e.g., <, >, ...),stmt -> if expr then expr else expr; stmt | ò expr -> term relop term | term term -> id | number id -> a | b | c number -> [0-9]òrefers to the empty statement, and if, then, else are terminals.Consider a program following the above grammar containing ten if terminals. The number of control flow paths in is _______. For example, the programif e1 then e2 else e3has 2 control flow paths, and .Correct answer
1024 to 1024
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The grammar forstmtis defined recursively as:This structure represents a sequence ofif-then-elseblocks. Eachifconstruct introduces a branching point where the control flow splits into two paths (one for thethenclause and one for theelseclause) and then merges back to execute the subsequentstmt.Since the program contains ten if terminals, it consists of a sequence of 10 suchif-then-elseblocks. The total number of control flow paths in a sequence of independent branching blocks is the product of the number of paths in each block.For oneifblock, there are 2 paths.
For tenifblocks in sequence, the total number of paths is:44
Q44NAT2 marksMediumIn a RSA cryptosystem, a participant A uses two prime numbers and to generate her public and private keys. If the public key of A is 35, then the private key of…Think it through. Then check your answer.Question
In a RSA cryptosystem, a participant A uses two prime numbers and to generate her public and private keys. If the public key of A is 35, then the private key of A is _______.Correct answer
11 to 11
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In RSA, we have:
,
Euler's totient function Public key .
Private key must satisfy , i.e., .Using the Extended Euclidean Algorithm to find the multiplicative inverse of 35 modulo 192:
Substitute :
Thus, .
So, .45
Q45NAT2 marksMediumThe values of parameters for the Stop-and-Wait ARQ protocol are as given below: Bit rate of the transmission channel = 1 Mbps. Propagation delay from sender to receiver = 0.75 ms.…Think it through. Then check your answer.Question
The values of parameters for the Stop-and-Wait ARQ protocol are as given below:Bit rate of the transmission channel = 1 Mbps.
Propagation delay from sender to receiver = 0.75 ms.
Time to process a frame = 0.25 ms.
Number of bytes in the information frame = 1980.
Number of bytes in the acknowledge frame = 20.
Number of overhead bytes in the information frame = 20.Assume that there are no transmission errors. Then, the transmission efficiency (expressed in percentage) of the Stop-and-Wait ARQ protocol for the above parameters is ___________ (correct to 2 decimal places).Correct answer
86.5 to 89.5
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given parameters:- Bandwidth () = 1 Mbps = bits/sec
- Propagation delay () = 0.75 ms
- Processing time () = 0.25 ms
- Information frame size () = 1980 bytes
- Acknowledge frame size () = 20 bytes
- Overhead bytes () = 20 bytes
Payload size = bytes.Step 2: Calculate Transmission Times- Transmission time for Information frame ():
- Transmission time for Acknowledge frame ():
- Transmission time for Payload ():
The total time for one Stop-and-Wait cycle includes transmission of the frame, propagation to receiver, processing, transmission of ACK, and propagation of ACK back to sender.Step 4: Calculate Efficiency
Efficiency () is the ratio of time spent transmitting useful data to the total cycle time.Rounding to two decimal places, we get 88.34%.(Note: If efficiency is calculated based on the total frame size including overhead, . Both values fall within the accepted range of 86.5 to 89.5.)46
Q46NAT2 marksMediumConsider a database that has the relation schema CR(StudentName, CourseName). An instance of the schema CR is as given below. | StudentName | CourseName | | :--- |…Think it through. Then check your answer.Question
Consider a database that has the relation schema CR(StudentName, CourseName). An instance of the schema CR is as given below.The following query is made on the database.The number of rows in is ________.StudentName CourseName SA CA SA CB SA CC SB CB SB CC SC CA SC CB SC CC SD CA SD CB SD CC SD CD SE CD SE CA SE CB SF CA SF CB SF CC Correct answer
4 to 4
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Evaluate the subquery for :
From the given instance of the relation CR, the student 'SA' is enrolled in the courses {CA, CB, CC}. Therefore, the set contains these three courses:
2.Evaluate the division operation for :
The relational division operator returns all values of from that are associated with every value in . In this context, will contain the names of students who are enrolled in all courses listed in (i.e., CA, CB, and CC).3.Check each student's enrollment in CR:- SA: Enrolled in {CA, CB, CC}. (Matches all in )
- SB: Enrolled in {CB, CC}. (Missing CA)
- SC: Enrolled in {CA, CB, CC}. (Matches all in )
- SD: Enrolled in {CA, CB, CC, CD}. (Matches all in )
- SE: Enrolled in {CD, CA, CB}. (Missing CC)
- SF: Enrolled in {CA, CB, CC}. (Matches all in )
The students who satisfy the condition are {SA, SC, SD, SF}. Thus, there are 4 rows in the resulting relation .47
Q47NAT2 marksMediumThe number of integers between 1 and 500 (both inclusive) that are divisible by 3 or 5 or 7 is ______.Think it through. Then check your answer.Question
The number of integers between 1 and 500 (both inclusive) that are divisible by 3 or 5 or 7 is ______.Correct answer
271 to 271
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We use the Principle of Inclusion-Exclusion. Let , , and be the sets of integers between 1 and 500 divisible by 3, 5, and 7 respectively.- (divisible by ):
- (divisible by ):
- (divisible by ):
- (divisible by ):
48
Q48NAT2 marksMediumLet be an array of 31 numbers consisting of a sequence of 0's followed by a sequence of 1's. The problem is to find the smallest index such that is 1 by probing the…Think it through. Then check your answer.Question
Let be an array of 31 numbers consisting of a sequence of 0's followed by a sequence of 1's. The problem is to find the smallest index such that is 1 by probing the minimum number of locations in . The worst case number of probes performed by an optimal algorithm is ______.Correct answer
5 to 5
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The array is sorted (all 0s followed by all 1s). Finding the first occurrence of 1 in a sorted array is a search problem where binary search is optimal. For an array of size , the worst-case number of probes (comparisons) in binary search is .
Given :
Worst-case probes = .49
Q49NAT2 marksMediumConsider a RISC machine where each instruction is exactly 4 bytes long. Conditional and unconditional branch instructions use PC-relative addressing mode with Offset specified in…Think it through. Then check your answer.Question
Consider a RISC machine where each instruction is exactly 4 bytes long. Conditional and unconditional branch instructions use PC-relative addressing mode with Offset specified in bytes to the target location of the branch instruction. Further the Offset is always with respect to the address of the next instruction in the program sequence. Consider the following instruction sequenceIf the target of the branch instruction is i, then the decimal value of the Offset is _______.Instr. No. Instruction i : add R2, R3, R4 i+1 : sub R5, R6, R7 i+2 : cmp R1, R9, R10 i+3 : beq R1, OffsetCorrect answer
-16
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The branch instructionbeq R1, Offsetis at instruction number .
The target of the branch is instruction number .In PC-relative addressing, the target address is calculated as:The problem states that the Offset is with respect to the address of the next instruction.
The next instruction afterbeq(at ) would be at .Let be the address of instruction . Since each instruction is 4 bytes long:
Address of instruction is .So, .
The Target Address is .Substituting into the equation:Thus, the decimal value of the Offset is -16.50
Q50NAT2 marksMediumInstruction execution in a processor is divided into 5 stages, Instruction Fetch (IF), Instruction Decode (ID), Operand Fetch (OF), Execute (EX), and Write Back (WB). These stages…Think it through. Then check your answer.Question
Instruction execution in a processor is divided into 5 stages, Instruction Fetch (IF), Instruction Decode (ID), Operand Fetch (OF), Execute (EX), and Write Back (WB). These stages take 5, 4, 20, 10, and 3 nanoseconds (ns) respectively. A pipelined implementation of the processor requires buffering between each pair of consecutive stages with a delay of 2 ns. Two pipelined implementations of the processor are contemplated:
(i) a naive pipeline implementation (NP) with 5 stages and
(ii) an efficient pipeline (EP) where the OF stage is divided into stages OF1 and OF2 with execution times of 12 ns and 8 ns respectively.The speedup (correct to two decimal places) achieved by EP over NP in executing 20 independent instructions with no hazards is ________.Correct answer
1.49 to 1.52
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
For the Naive Pipeline (NP):
Number of stages .
Stage delays: 5, 4, 20, 10, 3 ns.
Buffer delay: 2 ns.
Clock cycle time ns.
Number of instructions .
Time taken by NP to execute 20 instructions:
ns.For the Efficient Pipeline (EP):
The OF stage (20 ns) is split into OF1 (12 ns) and OF2 (8 ns).
New stages: IF(5), ID(4), OF1(12), OF2(8), EX(10), WB(3).
Number of stages .
Clock cycle time ns.
Time taken by EP to execute 20 instructions:
ns.Speedup .
Rounding to two decimal places, the speedup is .51
Q51NAT2 marksHardConsider a 2-way set associative cache with 256 blocks and uses LRU replacement. Initially the cache is empty. Conflict misses are those misses which occur due to contention of…Think it through. Then check your answer.Question
Consider a 2-way set associative cache with 256 blocks and uses LRU replacement. Initially the cache is empty. Conflict misses are those misses which occur due to contention of multiple blocks for the same cache set. Compulsory misses occur due to first time access to the block. The following sequence of accesses to memory blocks(0, 128, 256, 128, 0, 128, 256, 128, 1, 129, 257, 129, 1, 129, 257, 129)is repeated 10 times. The number of conflict misses experienced by the cache is ________.Correct answer
76 to 76
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Cache parameters:
Total blocks = 256.
Associativity = 2-way.
Number of sets = sets.
Mapping function: Set index = Block Address .The sequence contains two distinct groups of addresses:
Group 1: 0, 128, 256. All map to Set .
Group 2: 1, 129, 257. All map to Set .Since the sets are independent, we calculate misses for Set 0 and multiply by 2 (as the pattern for Set 1 is identical).Analysis for Set 0 (Capacity 2 blocks, LRU):
Sequence per iteration: 0, 128, 256, 128, 0, 128, 256, 128.Iteration 1:1.Access 0: Miss (Compulsory). Cache: {0}. LRU: 0.2.Access 128: Miss (Compulsory). Cache: {0, 128}. LRU: 0.3.Access 256: Miss (Compulsory). Set full, evict LRU (0). Cache: {128, 256}. LRU: 128.4.Access 128: Hit. Cache: {256, 128}. LRU: 256.5.Access 0: Miss (Conflict). Evict LRU (256). Cache: {128, 0}. LRU: 128.6.Access 128: Hit. Cache: {0, 128}. LRU: 0.7.Access 256: Miss (Conflict). Evict LRU (0). Cache: {128, 256}. LRU: 128.8.Access 128: Hit. Cache: {256, 128}. LRU: 256.Misses in Iteration 1: 3 Compulsory, 2 Conflict.
State at end of Iteration 1: Cache contains {128, 256}, LRU is 256.Iteration 2 (and subsequent 3-10):
Start state: {128, 256}, LRU: 256.1.Access 0: Miss (Conflict). Evict 256. Cache: {128, 0}. LRU: 128.2.Access 128: Hit. Cache: {0, 128}. LRU: 0.3.Access 256: Miss (Conflict). Evict 0. Cache: {128, 256}. LRU: 128.4.Access 128: Hit. Cache: {256, 128}. LRU: 256.5.Access 0: Miss (Conflict). Evict 256. Cache: {128, 0}. LRU: 128.6.Access 128: Hit. Cache: {0, 128}. LRU: 0.7.Access 256: Miss (Conflict). Evict 0. Cache: {128, 256}. LRU: 128.8.Access 128: Hit. Cache: {256, 128}. LRU: 256.Misses in Iteration (): 0 Compulsory, 4 Conflict.Total Conflict Misses for Set 0:
Iteration 1: 2 conflict misses.
Iterations 2 to 10 (9 iterations): conflict misses.
Total for Set 0 = .Total Conflict Misses for Set 1:
Identical pattern. Total = 38.Grand Total:
.52
Q52NAT2 marksMediumConsider the expression . Let X be the minimum number of registers required by an optimal code generation (without any register spill) algorithm for a…Think it through. Then check your answer.Question
Consider the expression . Let X be the minimum number of registers required by an optimal code generation (without any register spill) algorithm for a load/store architecture, in which (i) only load and store instructions can have memory operands and (ii) arithmetic instructions can have only register or immediate operands. The value of X 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
To evaluate the expression , we can represent it as an expression tree and determine the register requirements using the Sethi-Ullman algorithm logic.Expression Tree Structure:1.Root:*2.Left Subtree:a - 1- Load
ainto a register (). - Subtract
1(immediate). Result in . - Registers needed: 1.
((b+c)/3) + d- Inner operation
b + c: - Load
b(). - Load
c(). - Add . Result in .
- Registers needed: 2.
- Division
/ 3: - Divide by
3(immediate). Result in . - Registers needed: 1 (reuse).
- Addition
+ d: - Load
d(). - Add . Result in .
- Registers needed: 2 (one for partial result, one for
d). - Total for Right Subtree: 2 registers.
- The algorithm evaluates the subtree with the higher register requirement first to minimize total registers.
- Right Subtree needs 2 registers.
- Left Subtree needs 1 register.
1.Evaluate Right Subtree (needs 2 regs). Result stored in .2.Evaluate Left Subtree (needs 1 reg). Use (since is occupied). Total concurrent registers: 2.3.Multiply and .The maximum number of registers required at any point is 2.- Load
53
Q53NAT2 marksMediumConsider the following C program. [code] Recall thatstrlenis defined instring.has returning a value of typesize_t, which is anunsigned int. The output of the program…Think it through. Then check your answer.Question
Consider the following C program.Recall that#include <stdio.h> #include <string.h> void printlength(char *s, char *t) { unsigned int c = 0; int len = ((strlen(s) - strlen(t)) > c) ? strlen(s) : strlen(t); printf("%d\n", len); } void main() { char *x = "abc"; char *y = "defgh"; printlength(x, y); }strlenis defined instring.has returning a value of typesize_t, which is anunsigned int. The output of the program 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
The program compares the lengths of two strings,x("abc") andy("defgh").1.strlen(x)is 3.2.strlen(y)is 5.3.The expression in the ternary operator is(strlen(s) - strlen(t)) > c.4.strlenreturnssize_t(unsigned int). The subtraction3 - 5is performed using unsigned arithmetic.5.In unsigned arithmetic,3 - 5wraps around to a very large positive integer (specifically or similar depending on word size, e.g.,UINT_MAX - 1).6.Sincecis 0, the comparison(large positive number) > 0is true.7.Consequently, the ternary operator selects the first branch:strlen(s), which is 3.8.The program prints3.54
Q54NAT2 marksMediumA cache memory unit with capacity of words and block size of words is to be designed. If it is designed as a direct mapped cache, the length of the TAG field is 10 bits.…Think it through. Then check your answer.Question
A cache memory unit with capacity of words and block size of words is to be designed. If it is designed as a direct mapped cache, the length of the TAG field is 10 bits. If the cache unit is now designed as a 16-way set-associative cache, the length of the TAG field is ________ bits.Correct answer
14 to 14
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the number of bits in the physical address.For Direct Mapped Cache:- Number of lines .
- Index bits = .
- Offset bits = .
- Tag bits = .
- Given: Tag bits = 10. So, .
- Number of sets .
- Index bits = .
- Offset bits = .
- Tag bits = .
- Tag bits = .
- New Tag bits = .
55
Q55NAT2 marksMediumThe output of executing the following C program is __________. [code]Think it through. Then check your answer.Question
The output of executing the following C program is __________.#include <stdio.h> int total(int v) { static int count = 0; while(v) { count += v&1; v >>= 1; } return count; } void main() { static int x = 0; int i = 5; for(; i > 0; i--) { x = x + total(i); } printf("%d\n", x); }Correct answer
23 to 23
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's trace the execution of the program. The key is to note that both thecountvariable in thetotalfunction and thexvariable in themainfunction are declared asstatic. This means they retain their values between function calls and iterations.countintotal: Initialized to 0 once. Its value is cumulative across all calls tototal.xinmain: Initialized to 0 once.
forloop inmainiterates fori = 5, 4, 3, 2, 1.1.i = 5:total(5)is called.v = 5(binary101).countis initially 0.- The
whileloop intotalcounts the set bits invand adds them to the staticcount. - Number of set bits in 5 is 2.
countbecomes0 + 2 = 2.totalreturns the new value ofcount, which is 2.- In
main,x = x + total(5)becomesx = 0 + 2 = 2.
total(4)is called.v = 4(binary100).countis currently 2.- Number of set bits in 4 is 1.
countbecomes2 + 1 = 3.totalreturns 3.- In
main,x = x + total(4)becomesx = 2 + 3 = 5.
total(3)is called.v = 3(binary11).countis currently 3.- Number of set bits in 3 is 2.
countbecomes3 + 2 = 5.totalreturns 5.- In
main,x = x + total(3)becomesx = 5 + 5 = 10.
total(2)is called.v = 2(binary10).countis currently 5.- Number of set bits in 2 is 1.
countbecomes5 + 1 = 6.totalreturns 6.- In
main,x = x + total(2)becomesx = 10 + 6 = 16.
total(1)is called.v = 1(binary1).countis currently 6.- Number of set bits in 1 is 1.
countbecomes6 + 1 = 7.totalreturns 7.- In
main,x = x + total(1)becomesx = 16 + 7 = 23.
printfstatement prints the final value ofx, which is 23.