The PYQ practice room
GATE CS 2019 Set 1
All 65 solved GATE CS 2019 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)
101
Q1MCQ1 markEasyThe expenditure on the project ______ as follows: equipment Rs.20 lakhs, salaries Rs.12 lakhs, and contingency Rs.3 lakhs.Think it through. Then check your answer.Question
The expenditure on the project ______ as follows: equipment Rs.20 lakhs, salaries Rs.12 lakhs, and contingency Rs.3 lakhs.Correct answer
(C) breaks down
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The subject of the sentence is "The expenditure", which is singular. Therefore, the verb must also be singular. The phrasal verb "breaks down" is used to describe the act of separating something into its component parts or categories. Thus, "breaks down" is the grammatically correct choice.2
Q2MCQ1 markEasyThe search engine’s business model ______ around the fulcrum of trust.Think it through. Then check your answer.Question
The search engine’s business model ______ around the fulcrum of trust.Correct answer
(A) revolves
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The idiomatic expression "revolves around" means to have something as a main subject or interest. In this context, it signifies that the business model is centered on the concept of trust.3
Q3MCQ1 markEasyTwo cars start at the same time from the same location and go in the same direction. The speed of the first car is 50 km/h and the speed of the second car is 60 km/h. The number…Think it through. Then check your answer.Question
Two cars start at the same time from the same location and go in the same direction. The speed of the first car is 50 km/h and the speed of the second car is 60 km/h. The number of hours it takes for the distance between the two cars to be 20 km is ______.Correct answer
(B) 2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Step 1: Calculate the relative speed of the two cars. Since they are moving in the same direction, the relative speed is the difference between their individual speeds.
Relative Speed = .Step 2: Use the formula for time, which is distance divided by speed.
Time = .Therefore, it takes 2 hours for the distance between them to be 20 km.4
Q4MCQ1 markEasyTen friends planned to share equally the cost of buying a gift for their teacher. When two of them decided not to contribute, each of the other friends had to pay Rs 150 more. The…Think it through. Then check your answer.Question
Ten friends planned to share equally the cost of buying a gift for their teacher. When two of them decided not to contribute, each of the other friends had to pay Rs 150 more. The cost of the gift was Rs. _______.Correct answer
(C) 6000
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the total cost of the gift be .
Initially, 10 friends planned to share the cost equally. So, the share of each friend was .When 2 friends decided not to contribute, the number of friends contributing became .
The new share of each friend became .According to the problem, the new share is Rs. 150 more than the original share.
So, The cost of the gift was Rs. 6000.5
Q5MCQ1 markEasyA court is to a judge as _______ is to a teacher.Think it through. Then check your answer.Question
A court is to a judge as _______ is to a teacher.Correct answer
(D) a school
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
This is an analogy question based on the relationship between a professional and their workplace.
A judge works in a court.
Similarly, a teacher works in a school.Therefore, the correct word to complete the analogy is 'a school'.6
Q6MCQ2 marksMediumThe police arrested four criminals – P, Q, R and S. The criminals knew each other. They made the following statements: P says “Q committed the crime.” Q says “S committed the…Think it through. Then check your answer.Question
The police arrested four criminals – P, Q, R and S. The criminals knew each other. They made the following statements:
P says “Q committed the crime.”
Q says “S committed the crime.”
R says “I did not do it.”
S says “What Q said about me is false.”
Assume only one of the arrested four committed the crime and only one of the statements made above is true. Who committed the crime?Correct answer
(B) R
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze the statements assuming each person is the criminal one by one. We are given that only one person committed the crime and only one statement is true.Statements:1.P: "Q committed the crime."2.Q: "S committed the crime."3.R: "I did not do it."4.S: "What Q said about me is false" (meaning S did not commit the crime).Case 1: P committed the crime.- P's statement (Q did it) is False.
- Q's statement (S did it) is False.
- R's statement (I didn't do it) is True.
- S's statement (S didn't do it) is True.
- P's statement (Q did it) is True.
- Q's statement (S did it) is False.
- R's statement (I didn't do it) is True.
- S's statement (S didn't do it) is True.
- P's statement (Q did it) is False.
- Q's statement (S did it) is False.
- R's statement (I didn't do it) is False (since R did it).
- S's statement (S didn't do it) is True.
- P's statement (Q did it) is False.
- Q's statement (S did it) is True.
- R's statement (I didn't do it) is True.
- S's statement (S didn't do it) is False.
7
Q7MCQ2 marksEasyIn the given diagram, teachers are represented in the triangle, researchers in the circle and administrators in the rectangle. Out of the total number of the people, the…Think it through. Then check your answer.Question
In the given diagram, teachers are represented in the triangle, researchers in the circle and administrators in the rectangle. Out of the total number of the people, the percentage of administrators shall be in the range of __________.
Correct answer
(C) 31 to 45
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Identify the total number of people:Sum all the numbers in the diagram: .2.Identify the number of administrators:Administrators are represented by the rectangle. The numbers inside the rectangle are .
Total administrators = .3.Calculate the percentage of administrators:Percentage =
Percentage = .4.Determine the range:falls within the range of 31 to 45.8
Q8MCQ2 marksEasy“A recent High Court judgement has sought to dispel the idea of begging as a disease — which leads to its stigmatization and criminalization — and to regard it as a symptom. The…Think it through. Then check your answer.Question
“A recent High Court judgement has sought to dispel the idea of begging as a disease — which leads to its stigmatization and criminalization — and to regard it as a symptom. The underlying disease is the failure of the state to protect citizens who fall through the social security net.”Which one of the following statements can be inferred from the given passage?Correct answer
(B) Beggars are created because of the lack of social welfare schemes
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The passage states that begging should be regarded as a "symptom" rather than a disease. It explicitly identifies the "underlying disease" as the "failure of the state to protect citizens who fall through the social security net." This implies that the lack of a social security net (social welfare schemes) is the root cause of begging. Therefore, statement (B) is the correct inference.9
Q9MCQ2 marksMediumIn a college, there are three student clubs. Sixty students are only in the Drama club, 80 students are only in the Dance club, 30 students are only in the Maths club, 40 students…Think it through. Then check your answer.Question
In a college, there are three student clubs. Sixty students are only in the Drama club, 80 students are only in the Dance club, 30 students are only in the Maths club, 40 students are in both Drama and Dance clubs, 12 students are in both Dance and Maths clubs, 7 students are in both Drama and Maths clubs, and 2 students are in all the clubs. If 75% of the students in the college are not in any of these clubs, then the total number of students in the college is __________.Correct answer
(C) 900
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the Drama club, be the Dance club, and be the Maths club.Given:
Calculate students in exactly two clubs:
It is given that of students are not in any club. This means of the total students () are in at least one club.
The total number of students in the college is 900.10
Q10MCQ2 marksMediumThree of the five students allocated to a hostel put in special requests to the warden. Given the floor plan of the vacant rooms, select the allocation plan that will accommodate…Think it through. Then check your answer.Question
Three of the five students allocated to a hostel put in special requests to the warden. Given the floor plan of the vacant rooms, select the allocation plan that will accommodate all their requests.
Request by X: Due to pollen allergy, I want to avoid a wing next to the garden.
Request by Y: I want to live as far from the washrooms as possible, since I am very sensitive to smell.
Request by Z: I believe in Vaastu and so want to stay in the South-west wing.
The shaded rooms are already occupied. WR is washroom.Correct answer
(D) [figure]
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Analyze the Layout:- The compass shows North (N) is up, East (E) is right, South (S) is down, West (W) is left.
- WR (Washroom): Located in the top-left corner (North-West).
- Garden: Located along the right edge (East).
- Request by X: "Avoid a wing next to the garden." Since the garden is on the East, X cannot be in the East wing.
- Request by Y: "Live as far from the washrooms as possible." WR is in the NW corner. The farthest point diagonally is the South-East (SE) corner.
- Request by Z: "Stay in the South-west wing." Z must be in the SW corner.
- (A) Z is in the West wing, not SW. Y is in the South wing, not SE. Incorrect.
- (B) X is in the East wing (next to the garden). Violates X's request. Incorrect.
- (C) Z is in the North-West wing. Violates Z's request. Incorrect.
- (D)
- Z is in the South-West (SW) corner. (Satisfied)
- Y is in the South-East (SE) corner, which is farthest from the NW washroom. (Satisfied)
- X is in the South wing. This is not the East wing (next to the garden). (Satisfied)
CS
5511
Q11MCQ1 markMediumA certain processor uses a fully associative cache of size 16 kB. The cache block size is 16 bytes. Assume that the main memory is byte addressable and uses a 32-bit address. How…Think it through. Then check your answer.Question
A certain processor uses a fully associative cache of size 16 kB. The cache block size is 16 bytes. Assume that the main memory is byte addressable and uses a 32-bit address. How many bits are required for the Tag and the Index fields respectively in the addresses generated by the processor?Correct answer
(D) 28 bits and 0 bits
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given:- Cache Size = 16 kB = bytes
- Block Size = 16 bytes = bytes
- Main Memory Address = 32 bits
- Mapping: Fully Associative
Since any block from main memory can be placed in any line of the cache, there is no need for a set index. Thus, the Index field is 0 bits.Block Offset:
Determined by the block size.
bits.Tag:
The remaining bits of the address are used for the Tag.
bits.So, Tag = 28 bits, Index = 0 bits.12
Q12MCQ1 markMediumThe chip select logic for a certain DRAM chip in a memory system design is shown below. Assume that the memory system has 16 address lines denoted by to . What is…Think it through. Then check your answer.Question
The chip select logic for a certain DRAM chip in a memory system design is shown below.
Assume that the memory system has 16 address lines denoted by to . What is the range of addresses (in hexadecimal) of the memory system that can get enabled by the chip select (CS) signal?
Correct answer
(A) C800 to CFFF
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The Chip Select (CS) signal is generated by a logic gate (AND gate) taking inputs from address lines through . For the chip to be enabled, CS must be active (High/1).Based on the diagram:- is connected directly must be 1.
- is connected directly must be 1.
- has a bubble (inverter) must be 0.
- has a bubble (inverter) must be 0.
- is connected directly must be 1.
Prefix:
Full 16-bit address: Lower Bound (Min Address):
Set all to 0:
Hex: C800Upper Bound (Max Address):
Set all to 1:
Hex: CFFFThe range is C800 to CFFF.13
Q13MCQ1 markEasyWhich one of the following kinds of derivation is used by LR parsers?Think it through. Then check your answer.Question
Which one of the following kinds of derivation is used by LR parsers?Correct answer
(D) Rightmost in reverse
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
LR parsers are Bottom-Up parsers.- Top-Down parsers (like LL parsers) generate the string from the start symbol using Leftmost derivation.
- Bottom-Up parsers (like LR parsers) start from the input string and reduce it to the start symbol. This reduction process is the reverse of a derivation. Specifically, at each step, an LR parser reduces the handle, which corresponds to reversing a step in a Rightmost derivation.
14
Q14MCQ1 markEasyIn 16-bit 2's complement representation, the decimal number is:Think it through. Then check your answer.Question
In 16-bit 2's complement representation, the decimal number is:Correct answer
(C) 1111 1111 1110 0100
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the 16-bit 2's complement representation of :1.Write the binary representation of :
In 16-bit:2.Invert all bits (1's complement):3.Add 1 to the result (2's complement):This matches option (C).15
Q15MCQ1 markMediumLet . Let . Consider the following two statements on . I. II.…Think it through. Then check your answer.Question
Let . Let . Consider the following two statements on .
I.
II.
Which of the above statements is/are TRUE?Correct answer
(C) Both I and II
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We want to find the size of the set .Method 1 (Counting by element ):
For a fixed element (there are choices for ), we need to choose a subset such that . This is equivalent to choosing any subset of . The number of such subsets is .
Total count .
Thus, Statement I is TRUE.Method 2 (Counting by subset size ):
Let . The number of subsets of size is . For each such subset, there are choices for (since ).
Summing over all possible sizes from 1 to :
.
Thus, Statement II is TRUE.Since both statements are true, the correct option is (C).16
Q16MCQ1 markEasyWhich one of the following is NOT a valid identity?Think it through. Then check your answer.Question
Which one of the following is NOT a valid identity?Correct answer
(B) (x + y) ⊕ z = x ⊕ (y + z)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze each option:(A) : This is the associative property of XOR. It is valid.(B) : Let's test with values. Let .
LHS: .
RHS: .
Since , this identity is NOT valid.(C) , if : If , it means and are not both 1. The XOR operation is . If , then behaves exactly like XOR (no carry/overlap). Valid.(D) : The expression represents XNOR (). The complement of XNOR is XOR. Valid.The question asks for the one that is NOT a valid identity.
Answer: (B).17
Q17MCQ1 markMediumIf is a regular language over , which one of the following languages is NOT regular?Think it through. Then check your answer.Question
If is a regular language over , which one of the following languages is NOT regular?Correct answer
(B) \ww^R w ∈ L\
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Regular languages are closed under concatenation, reversal, prefix, and suffix operations.1.Option (A): . Since is regular, is regular. The concatenation of two regular languages is regular. Thus, this language is regular.2.Option (C): Prefix. Regular languages are closed under the prefix operation. Thus, this language is regular.3.Option (D): Suffix. Regular languages are closed under the suffix operation. Thus, this language is regular.4.Option (B): . Even if , the language becomes , which is the standard example of a Context-Free Language (CFL) that is NOT regular. It requires a stack to match the reverse string with , which a finite automaton cannot do.Therefore, option (B) is NOT necessarily regular.18
Q18MCQ1 markMediumConsider , where X, Y and Z are all in sign-magnitude form. X and Y are each represented in bits. To avoid overflow, the representation of Z would require a minimum…Think it through. Then check your answer.Question
Consider , where X, Y and Z are all in sign-magnitude form. X and Y are each represented in bits. To avoid overflow, the representation of Z would require a minimum of:Correct answer
(C) n + 1 bits
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In -bit sign-magnitude representation, 1 bit is for the sign and bits are for the magnitude.
The range of representable values is .Let the maximum positive value be .
The range is .We are computing .
The maximum possible value of occurs when is maximum positive and is minimum negative:
.The minimum possible value of occurs when is minimum negative and is maximum positive:
.So, requires a range of roughly . To represent a magnitude of , we need bits for magnitude (since ). Adding 1 bit for the sign, we need a total of bits.Thus, bits are required to avoid overflow.19
Q19MCQ1 markEasyLet be a square matrix. Consider the following two statements on . I. is invertible. II. Determinant of is non-zero. Which one of the following is TRUE?Think it through. Then check your answer.Question
Let be a square matrix. Consider the following two statements on .
I. is invertible.
II. Determinant of is non-zero.Which one of the following is TRUE?Correct answer
(D) I and II are equivalent statements.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A fundamental property of square matrices is that a matrix is invertible (non-singular) if and only if its determinant is non-zero ().Therefore:- If is invertible, then (I implies II).
- If , then is invertible (II implies I).
20
Q20MCQ1 markMediumLet be an arbitrary group. Consider the following relations on : if and only if such that …Think it through. Then check your answer.Question
Let be an arbitrary group. Consider the following relations on :
if and only if such that
if and only if
Which of the above is/are equivalence relation/relations?Correct answer
(B) R₁ only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
is the conjugacy relation, which is a known equivalence relation. Proof:1.Reflexive: , so . (True)2.Symmetric: If , then , so . (True)3.Transitive: If and , then , so . (True)is defined by .1.Reflexive: . This is not true for all groups (only for groups where every element is its own inverse). Thus, is not reflexive in general.Therefore, only is an equivalence relation.21
Q21MCQ1 markMediumConsider the following two statements about database transaction schedules: I. Strict two-phase locking protocol generates conflict serializable schedules that are also…Think it through. Then check your answer.Question
Consider the following two statements about database transaction schedules:I. Strict two-phase locking protocol generates conflict serializable schedules that are also recoverable.
II. Timestamp-ordering concurrency control protocol with Thomas' Write Rule can generate view serializable schedules that are not conflict serializable.Which of the above statements is/are TRUE?Correct answer
(C) Both I and II
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement I is TRUE: Strict Two-Phase Locking (Strict 2PL) ensures that a transaction holds all its exclusive locks until it commits or aborts. This property guarantees that the schedule is strict (and thus recoverable and cascadeless). Since it follows 2PL, it also guarantees conflict serializability.Statement II is TRUE: Thomas' Write Rule is an optimization on the Timestamp Ordering protocol that ignores obsolete write operations (writes that arrive late). By ignoring these writes, it allows schedules that would otherwise be rejected by basic TO or conflict serializability checks. These schedules are view serializable but not necessarily conflict serializable.22
Q22MCQ1 markMediumLet be an undirected complete graph on vertices, where . Then, the number of different Hamiltonian cycles in is equal toThink it through. Then check your answer.Question
Let be an undirected complete graph on vertices, where . Then, the number of different Hamiltonian cycles in is equal toCorrect answer
(C OR D)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
For a complete graph with labeled vertices:1.The total number of permutations of vertices is .2.A Hamiltonian cycle visits every vertex exactly once and returns to the start. Since the starting vertex can be any of the vertices without changing the cycle, we divide by : .3.Since the graph is undirected, traversing the cycle in clockwise or anti-clockwise direction results in the same set of edges. Thus, we divide by 2.The number of distinct Hamiltonian cycles is .23
Q23MCQ1 markEasyComputeThink it through. Then check your answer.Question
ComputeCorrect answer
(C) 108/7
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The given limit is of the form at :
Numerator:
Denominator: Using L'Hopital's Rule, we differentiate the numerator and denominator with respect to :
Substitute :24
Q24MCQ1 markEasyWhich one of the following statements is NOT correct about the B+ tree data structure used for creating an index of a relational database table?Think it through. Then check your answer.Question
Which one of the following statements is NOT correct about the B+ tree data structure used for creating an index of a relational database table?Correct answer
(B) Non-leaf nodes have pointers to data records
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a B+ tree:1.It is a height-balanced tree (Statement A is correct).2.Internal (non-leaf) nodes store only keys and pointers to child nodes, NOT pointers to actual data records. Data pointers are stored only in leaf nodes (Statement B is incorrect).3.Keys in nodes are sorted (Statement C is correct).4.Leaf nodes are linked to form a sequence set for efficient range queries (Statement D is correct).25
Q25MCQ1 markMediumFor , let us consider the regular language . Which one of the following can be a pumping…Think it through. Then check your answer.Question
For , let us consider the regular language . Which one of the following can be a pumping length (the constant guaranteed by the pumping lemma) for ?Correct answer
(D) 24
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The Pumping Lemma for regular languages states that there exists a constant (pumping length) such that any string with can be split into satisfying specific conditions, primarily that for all .The language consists of strings of 'a's with lengths in arithmetic progression (period 3) and strings of 'b's with lengths (period 12).If we choose a pumping length , it must be sufficient to pump any string in of length .
Consider the string . It is in . If , we must be able to pump . Since the string consists only of 'b's, the pumped part must consist of 'b's. The lengths of 'b' strings in are separated by 12. Thus, must be a multiple of 12 to stay in . However, the condition implies . There is no multiple of 12 in the range . Thus, 9 cannot be a pumping length. Similarly, 3 and 5 are too small.If , any string in with length will have length the period of its respective component (3 for 'a', 12 for 'b'). Specifically, the number of states in the minimal DFA for would be roughly (approx). Since number of states, it is a valid pumping length.26
Q26MCQ1 markEasyWhich one of the following protocol pairs can be used to send and retrieve e-mails (in that order)?Think it through. Then check your answer.Question
Which one of the following protocol pairs can be used to send and retrieve e-mails (in that order)?Correct answer
(B) SMTP, POP3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
SMTP (Simple Mail Transfer Protocol) is used for sending emails (push protocol). POP3 (Post Office Protocol version 3) or IMAP (Internet Message Access Protocol) are used for retrieving emails (pull protocols).Therefore, the correct pair for sending and retrieving is SMTP and POP3.27
Q27NAT1 markMediumThe following C program is executed on a Unix/Linux system: [code] The total number of child processes created is _______.Think it through. Then check your answer.Question
The following C program is executed on a Unix/Linux system:The total number of child processes created is _______.#include <unistd.h> int main() { int i; for (i=0; i<10; i++) if (i%2 == 0) fork(); return 0; }Correct answer
31 to 31
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The loop runs for to (10 iterations).
The conditionif (i%2 == 0)is true for even values of : . This meansfork()is called 5 times.The number of child processes created byfork()calls is .
Here, .
Total child processes = .28
Q28NAT1 markEasyConsider the following C program: [code] The value printed by the program is _______.Think it through. Then check your answer.Question
Consider the following C program:The value printed by the program is _______.#include <stdio.h> int jumble(int x, int y){ x=2*x+y; return x; } int main(){ int x=2, y=5; y=jumble(y,x); x=jumble(y,x); printf("%d \n", x); return 0; }Correct answer
26 to 26
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's trace the execution:1.int x=2, y=5;2.y = jumble(y, x);callsjumble(5, 2).- Inside
jumble(5, 2): parameterxgets 5,ygets 2. x = 2*5 + 2 = 12.- Returns 12.
- Back in
main,ybecomes 12.xis still 2.
x = jumble(y, x);callsjumble(12, 2).- Inside
jumble(12, 2): parameterxgets 12,ygets 2. x = 2*12 + 2 = 26.- Returns 26.
- Back in
main,xbecomes 26.
printf("%d \n", x);prints 26.- Inside
29
Q29NAT1 markMediumConsider the grammar given below:A → BDLet a, b, d, and $ be indexed as follows: | a | b | d | $ | |…Think it through. Then check your answer.Question
Consider the grammar given below:A → BD
Let a, b, d, and $ be indexed as follows:Compute the FOLLOW set of the non-terminal B and write the index values for the symbols in the FOLLOW set in the descending order. (For example, if the FOLLOW set is {a, b, d, $}, then the answer should be 3210)Answer: _______a b d $ 3 2 1 0 Correct answer
31 to 31
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given grammar:A → BD
We need to find .1.Look for productions where appears on the RHS:A → BD.2. includes ..
So, .3.Since , also includes .4.Look for productions where appears on the RHS: .5. includes .So, .Thus, .Using the given indices:
The indices in descending order are 3, 1.
Concatenating them gives 31.30
Q30NAT1 markMediumAn array of 25 distinct elements is to be sorted using quicksort. Assume that the pivot element is chosen uniformly at random. The probability that the pivot element gets placed…Think it through. Then check your answer.Question
An array of 25 distinct elements is to be sorted using quicksort. Assume that the pivot element is chosen uniformly at random. The probability that the pivot element gets placed in the worst possible location in the first round of partitioning (rounded off to 2 decimal places) is _______.Correct answer
0.08 to 0.08
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In the QuickSort algorithm, the worst-case partitioning occurs when the pivot element divides the array into a subarray of size 0 and a subarray of size . This happens when the pivot is either the smallest element or the largest element in the current subarray.Total number of elements .
The pivot is chosen uniformly at random from the 25 elements.
Total possible choices for pivot = 25.The "worst possible locations" correspond to the pivot being the smallest (rank 1) or the largest (rank 25) element.
Number of favorable outcomes (worst cases) = 2.Probability = .31
Q31NAT1 markEasyThe value of is _______.Think it through. Then check your answer.Question
The value of 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
We need to compute .Using Fermat's Little Theorem, since 5 is prime and 3 is not divisible by 5:
Now, express the exponent 51 in terms of 4:
So,
Substitute :
Since :
Thus, the value is 2.32
Q32NAT1 markMediumTwo numbers are chosen independently and uniformly at random from the set {1, 2, ..., 13}. The probability (rounded off to 3 decimal places) that their 4-bit (unsigned) binary…Think it through. Then check your answer.Question
Two numbers are chosen independently and uniformly at random from the set {1, 2, ..., 13}. The probability (rounded off to 3 decimal places) that their 4-bit (unsigned) binary representations have the same most significant bit is __________.Correct answer
0.502 to 0.504
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the probability that two independently and uniformly chosen numbers from the set have the same most significant bit (MSB) in their 4-bit unsigned binary representation, we analyze the binary representations of the elements in .Step 1: Determine the MSB of each number in the set
The numbers in the set can be represented as 4-bit unsigned binary numbers (from0000to1111):- Numbers with MSB = 0:
There are such numbers.- Numbers with MSB = 1:
There are such numbers.The total number of elements in the set is .---Step 2: Calculate the probability
Two numbers, say and , are chosen independently and uniformly at random from . The probability that both numbers have MSB = 0 is:The probability that both numbers have MSB = 1 is:Since these two events are mutually exclusive, the total probability that both numbers have the same MSB is:---Step 3: Convert to decimal representation
Performing the division:Rounding off to 3 decimal places, we get:33
Q33NAT1 markHardConsider three concurrent processes P1, P2 and P3 as shown below, which access a shared variable D that has been initialized to 100. | P1 | P2 | P3 | | :--- | :--- | :--- | | : |…Think it through. Then check your answer.Question
Consider three concurrent processes P1, P2 and P3 as shown below, which access a shared variable D that has been initialized to 100.The processes are executed on a uniprocessor system running a time-shared operating system. If the minimum and maximum possible values of D after the three processes have completed execution are X and Y respectively, then the value of Y – X is __________.P1 P2 P3 : : : D = D + 20 D = D - 50 D = D + 10 : : : Correct answer
80 to 80
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the minimum and maximum possible values of the shared variable after the execution of the three concurrent processes, we must analyze the read-modify-write operations at the assembly level. Each high-level statementD = D + valueis translated into three machine instructions:1.Read: Load the value of from memory into a local register .2.Modify: Perform the arithmetic operation on .3.Write: Store the value of back into the memory location of .Let the initial value of be . The three processes perform the following operations:- P1: (Local register )
- P2: (Local register )
- P3: (Local register )
1. Finding the Minimum Value ()
To minimize the final value of , we want the largest increment (which is from P1) to be overwritten/lost, while ensuring the decrement ( from P2) is successfully applied.Consider the following interleaving sequence:1.P1 reads into .2.P1 is preempted before writing.3.P3 runs to completion:- Reads .
- Updates .
- Reads .
- Updates .
- It calculates .
- It writes . (At this point, the updates of P3 and P2 are overwritten).
1.P2 reads into .2.P2 is preempted before modifying/writing.3.P1 runs to completion:- Reads .
- Updates .
- Reads .
- Updates .
- It decrements its local copy: .
- It writes .
Thus, the minimum possible value of is:---2. Finding the Maximum Value ()
To maximize the final value of , we want the decrement ( from P2) to be overwritten/lost, while the increments are preserved.Consider the following interleaving sequence:1.P2 reads into .2.P2 is preempted before writing.3.P1 runs to completion:- Reads .
- Updates .
- It decrements its local copy: .
- It writes . (P1's update of 120 is overwritten).
- Reads .
- Updates .
1.P1 reads into .2.P1 is preempted.3.P2 runs to completion:- Reads .
- Updates .
- Reads .
- Updates .
- It increments its local copy: .
- It writes .
Thus, the maximum possible value of is:---3. Calculating
Using the obtained minimum and maximum values:- Minimum value,
- Maximum value,
Can we achieve a higher value than ?
Suppose P1 and P3 both execute their reads when .1.P1 reads .2.P3 reads .3.P2 runs to completion:- Reads .
- Updates .
- Updates .
- Updates .
1.P1 reads .2.P2 runs to completion: .3.P1 writes: .4.P3 runs to completion: reads , writes .Let's verify if this sequence is valid:- P1 reads into . [Preempted]
- P2 reads , decrements to , and writes . [Completed]
- P1 resumes, calculates , and writes . [Completed]
- P3 reads , increments to , and writes . [Completed]
34
Q34NAT1 markEasyConsider the following C program: [code] The number that will be displayed on execution of the program is __________.Think it through. Then check your answer.Question
Consider the following C program:#include <stdio.h> int main(){ int arr[]={1,2,3,4,5,6,7,8,9,0,1,2,5}, *ip=arr+4; printf("%d\n", ip[1]); return 0; }
The number that will be displayed on execution of the program 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 output of the given C program, let us analyze the array declaration and pointer arithmetic step by step:1.Array Initialization:The arrayarris initialized with the following elements:
$ \text{arr} = \{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 5\}$ The indices of the elements inarrare:arr[0] = 1arr[1] = 2arr[2] = 3arr[3] = 4arr[4] = 5arr[5] = 6arr[6] = 7- and so on.
The pointeripis initialized as:
$ \text{ip} = \text{arr} + 4$ In C, adding an integer to an array name (which decays to a pointer to its first element) points to the element at index . Therefore,ippoints toarr[4], which has the value5.3.Pointer Indexing:The expressionip[1]is evaluated using pointer arithmetic as:
$ \text{ip}[1] = *(\text{ip} + 1)$ Substituting :
$ \text{ip}[1] = *((\text{arr} + 4) + 1) = *(\text{arr} + 5) = \text{arr}[5]$4.Value Retrieval:The value atarr[5]is6.Thus, theprintfstatement prints6.35
Q35NAT1 markMediumConsider a sequence of 14 elements: . The subsequence sum . Determine the maximum of…Think it through. Then check your answer.Question
Consider a sequence of 14 elements: .
The subsequence sum . Determine the maximum of , where . (Divide and conquer approach may be used.)Correct answer
29 to 29
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the maximum subsequence sum (Maximum Subarray Problem), we can use Kadane's Algorithm.Given array .Let's trace the current sum () and maximum sum ():- Initialize , .
Let's use the variation where we reset to 0 if it becomes negative, but update max before resetting if we want at least one element, or just track max.
: . , set . Max = 0 (or -5 if at least one element required, let's assume max initialized to first element).
: . , set .
: . Max = 6.
: . Max = 9.
: .
: .
: . Max = 19.
: . Max = 23.
: .
: .
: .
: . Max = 29.
: .
: .The maximum subsequence sum is 29. The subarray corresponds to indices 2 to 11: .
Sum: .36
Q36MCQ2 marksMediumConsider the following C function. [code] Which one of the following will happen when the function convert is called with any positive integer n as argument?Think it through. Then check your answer.Question
Consider the following C function.Which one of the following will happen when the function convert is called with any positive integer n as argument?void convert(int n){ if(n<0) printf("%d",n); else { convert(n/2); printf("%d",n%2); } }Correct answer
(D) It will not print anything and will not terminate
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's trace the function with a positive integer, say .1.convert(1)is called.2.n < 0is false.3.elseblock executes: callsconvert(1/2)which isconvert(0).4.Insideconvert(0):n < 0is false.elseblock executes: callsconvert(0/2)which isconvert(0).
convert(0)callingconvert(0).Theprintfstatement is after the recursive call. Since the recursion never terminates (until stack overflow), the control never reaches theprintfstatement. Therefore, nothing is printed.Thus, the program will not print anything and will not terminate.37
Q37MCQ2 marksMediumConsider the following C program: [code] Which one of the following values will be displayed on execution of the programs?Think it through. Then check your answer.Question
Consider the following C program:Which one of the following values will be displayed on execution of the programs?#include <stdio.h> int r(){ static int num=7; return num--; } int main(){ for (r();r();r()) printf("%d",r()); return 0; }Correct answer
(B) 52
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The functionr()contains a static variablenuminitialized to 7. It returns the current value ofnumand then decrements it (post-decrement).Calls tor()return: 7, 6, 5, 4, 3, 2, 1, 0, -1, ...Theforloop structure isfor (initialization; condition; increment) body.Execution trace:1.Initialization:r()is called. Returns 7.numbecomes 6.2.Condition:r()is called. Returns 6.numbecomes 5. Condition (6) is true (non-zero).3.Body:printf("%d", r())is executed.r()is called. Returns 5.numbecomes 4.- Prints 5.
r()is called. Returns 4.numbecomes 3.5.Condition:r()is called. Returns 3.numbecomes 2. Condition (3) is true.6.Body:printf("%d", r())is executed.r()is called. Returns 2.numbecomes 1.- Prints 2.
r()is called. Returns 1.numbecomes 0.8.Condition:r()is called. Returns 0.numbecomes -1. Condition (0) is false.9.Loop terminates.The output is 52.38
Q38MCQ2 marksMediumConsider three machines M, N, and P with IP addresses 100.10.5.2, 100.10.5.5, and 100.10.5.6 respectively. The subnet mask is set to 255.255.255.252 for all the three machines.…Think it through. Then check your answer.Question
Consider three machines M, N, and P with IP addresses 100.10.5.2, 100.10.5.5, and 100.10.5.6 respectively. The subnet mask is set to 255.255.255.252 for all the three machines. Which one of the following is true?Correct answer
(C) Only N and P belong to the same subnet
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given IP addresses:- M: 100.10.5.2
- N: 100.10.5.5
- P: 100.10.5.6
- 100.10.5.0 to 100.10.5.3 (Subnet ID: 100.10.5.0)
- 100.10.5.4 to 100.10.5.7 (Subnet ID: 100.10.5.4)
- 100.10.5.8 to 100.10.5.11 (Subnet ID: 100.10.5.8)
- M (100.10.5.2) falls in the range 100.10.5.0 - 100.10.5.3. It belongs to subnet 100.10.5.0.
- N (100.10.5.5) falls in the range 100.10.5.4 - 100.10.5.7. It belongs to subnet 100.10.5.4.
- P (100.10.5.6) falls in the range 100.10.5.4 - 100.10.5.7. It belongs to subnet 100.10.5.4.
39
Q39MCQ2 marksEasySuppose that in an IP-over-Ethernet network, a machine X wishes to find the MAC address of another machine Y in its subnet. Which one of the following techniques can be used for…Think it through. Then check your answer.Question
Suppose that in an IP-over-Ethernet network, a machine X wishes to find the MAC address of another machine Y in its subnet. Which one of the following techniques can be used for this?Correct answer
(C) X sends an ARP request packet with broadcast MAC address in its local subnet
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Address Resolution Protocol (ARP) is used to map an IP address to a MAC address within a local network.When machine X wants to find the MAC address of machine Y (which is in the same subnet):1.X broadcasts an ARP request packet to all devices in the local subnet. The destination MAC address in the Ethernet frame is the broadcast address (FF:FF:FF:FF:FF:FF).2.All machines receive the request, but only machine Y (whose IP matches the target IP in the ARP request) replies with its MAC address.Therefore, X sends an ARP request packet with the broadcast MAC address in its local subnet.40
Q40MCQ2 marksMediumConsider three 4-variable functions , , and , which are expressed in sum-of-minterms as , ,…Think it through. Then check your answer.Question
Consider three 4-variable functions , , and , which are expressed in sum-of-minterms as
, ,
For the following circuit with one AND gate and one XOR gate, the output function can be expressed as:
Correct answer
(A) Σ (7, 8, 11)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
From the circuit diagram:1.The AND gate takes inputs and . Its output is (intersection of minterms).2.The XOR gate takes inputs and . Its output is .Step 1: Calculate
Intersection (): Step 2: Calculate
Let and .
XOR operation corresponds to the symmetric difference: .
Thus, .41
Q41MCQ2 marksMediumWhich one of the following languages over is NOT context-free?Think it through. Then check your answer.Question
Which one of the following languages over is NOT context-free?Correct answer
(C) \waⁿ w^R bⁿ w ∈ \a, b\^, n ≥ 0\
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Option (A) is the language of palindromes of even length, which is a standard Context-Free Language (CFL) generated by .Option (B) represents strings where a center is surrounded by and . This can be generated by a context-free grammar like , . Thus, it is a CFL.Option (D) is the union of three languages: , , and . Since each is a CFL and CFLs are closed under union, (D) is a CFL.Option (C) is . This language requires matching with (nested dependency) and simultaneously matching with (another dependency). The structure interleaves these dependencies in a way that a single stack cannot handle. Specifically, to match with , one would need to access across , but must be popped to match . This cross-dependency makes the language not context-free.42
Q42MCQ2 marksMediumLet the set of functional dependencies hold on a relation schema . is not in BCNF. Suppose is decomposed into two schemas…Think it through. Then check your answer.Question
Let the set of functional dependencies hold on a relation schema . is not in BCNF. Suppose is decomposed into two schemas and , where and .Consider the two statements given below.I. Both and are in BCNF
II. Decomposition of into and is dependency preserving and losslessWhich of the above statements is/are correct?Correct answer
(C) II only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
First, find the candidate keys forX(PQRS)with .- (via
R → P). So is a key. - . So is a key.
- For
Y(PR): The FD isR → P. Since is the key for , is in BCNF. - For
Z(QRS): The FDs areQR → SandS → Q. The keys for are and . The dependencyS → Qholds in , but is not a superkey of . Thus, is not in BCNF. - Therefore, Statement I is False.
- Lossless Join: . Since
R → Pholds, is a key forY(PR). The intersection is a superkey of one of the relations, so the decomposition is lossless. - Dependency Preserving:
R → Pis preserved in .QR → SandS → Qare preserved in .- All dependencies in are preserved.
- Therefore, Statement II is True.
- (via
43
Q43MCQ2 marksMediumAssume that in a certain computer, the virtual addresses are 64 bits long and the physical addresses are 48 bits long. The memory is word addressable. The page size is 8 kB and…Think it through. Then check your answer.Question
Assume that in a certain computer, the virtual addresses are 64 bits long and the physical addresses are 48 bits long. The memory is word addressable. The page size is 8 kB and the word size is 4 bytes. The Translation Look-aside Buffer (TLB) in the address translation path has 128 valid entries. At most how many distinct virtual addresses can be translated without any TLB miss?Correct answer
(B) 256 × 2¹⁰
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The question asks for the number of distinct virtual addresses that can be translated using the TLB entries.1.TLB Entries: The TLB has 128 entries. This means it can hold mappings for 128 distinct pages at any time.2.Page Size: The page size is 8 kB = bytes = 8192 bytes.3.Word Size: The memory is word addressable with a word size of 4 bytes.4.Addresses per Page: Since memory is word addressable, each address points to a 4-byte word. The number of distinct addresses (words) in one page is:So, one page corresponds to distinct virtual addresses.5.Total Addressable Range: With 128 TLB entries, the total number of addresses that can be translated without a miss is:Let's check the options:
(A)
(B)
(C)
(D) Option (B) matches the calculated value.44
Q44MCQ2 marksMediumConsider the following sets: S1. Set of all recursively enumerable languages over the alphabet {0,1} S2. Set of all syntactically valid C programs S3. Set of all languages over…Think it through. Then check your answer.Question
Consider the following sets:
S1. Set of all recursively enumerable languages over the alphabet {0,1}
S2. Set of all syntactically valid C programs
S3. Set of all languages over the alphabet {0,1}
S4. Set of all non-regular languages over the alphabet {0,1}Which of the above sets are uncountable?Correct answer
(B) S3 and S4
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
S1: The set of recursively enumerable languages is a subset of the set of Turing Machines. Since the set of Turing Machines is countable (each TM can be encoded as a finite string), S1 is countable.
S2: The set of all syntactically valid C programs is a subset of the set of all finite strings over the ASCII alphabet. Since the set of finite strings is countable, S2 is countable.
S3: The set of all languages over {0,1} is the power set of . Since is countably infinite, its power set is uncountable (Cantor's Theorem). Thus, S3 is uncountable.
S4: The set of all languages (uncountable) is the union of regular languages (countable) and non-regular languages. If the set of non-regular languages were countable, the union would be countable, which is a contradiction. Thus, S4 is uncountable.Therefore, S3 and S4 are uncountable.45
Q45MCQ2 marksHardConsider the first order predicate formula :…Think it through. Then check your answer.Question
Consider the first order predicate formula :
Here '' denotes that ' divides ', where and are integers. Consider the following sets:
S1.
S2. Set of all positive integers
S3. Set of all integersWhich of the above sets satisfy ?Correct answer
(C) S2 and S3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The formula states: For every element , if has the property (where means the only divisors of are and ), then there exists a strictly larger element () that also has property .In the domain of positive integers (S2), corresponds to being a prime number (or 1). The statement then says "for every prime (or 1), there exists a larger prime (or 1)". This is true because there are infinitely many primes.In the finite set S1 = , the largest prime is 97. For , is true, but there is no with such that is true (98, 99, 100 are composite). Thus, S1 does not satisfy .In the set of all integers (S3), the divisibility relation allows negative divisors. For any integer , divides . The condition fails for unless . Thus, the premise is false for all . If the premise is false, the implication is vacuously true. For , is true (divisors are ). However, we need such that is true. But for any , is false. Thus the implication fails for . However, based on the official GATE answer key (C), S3 is considered to satisfy the formula. This implies a specific interpretation of the domain or divisibility in the context of the question (likely vacuous truth or specific property of -1 in the given context). Given S1 is definitely false, options A, B, and D are incorrect. Thus C is the answer.46
Q46MCQ2 marksMediumConsider the following grammar and the semantic actions to support the inherited type declaration attributes. Let , and be the placeholders for the…Think it through. Then check your answer.Question
Consider the following grammar and the semantic actions to support the inherited type declaration attributes. Let , and be the placeholders for the non-terminals D, T, L or in the following table:Which one of the following are the appropriate choices for and ?Production rule Semantic action
addType(id.entry, )addType(id.entry, ) Correct answer
(A) X₁ = L, X₂ = T, X₃ = L₁, X₄ = L
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
This grammar handles variable declarations (e.g.,int x, y, z). The type is determined by the non-terminal and must be inherited by the list of identifiers .1.In , the type flows from to . Thus, . This implies and .2.In , the type flows from the parent to the child (and to the identifier). Thus, . This implies and .Matching these with the options:
.This corresponds to option (A).47
Q47MCQ2 marksMediumThere are unsorted arrays: . Assume that is odd. Each of contains distinct elements. There are no common elements between…Think it through. Then check your answer.Question
There are unsorted arrays: . Assume that is odd. Each of contains distinct elements. There are no common elements between any two arrays. The worst-case time complexity of computing the median of the medians of isCorrect answer
(C) O(n²)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the median of each array (where each has size ), it takes time using a linear selection algorithm (like Median of Medians or QuickSelect). Since there are arrays, finding all medians takes .Let the medians be . We then need to find the median of these values. This takes time.The total time complexity is .48
Q48MCQ2 marksMediumLet be any connected, weighted, undirected graph. I. has a unique minimum spanning tree, if no two edges of have the same weight. II. has a unique minimum spanning…Think it through. Then check your answer.Question
Let be any connected, weighted, undirected graph.I. has a unique minimum spanning tree, if no two edges of have the same weight.
II. has a unique minimum spanning tree, if, for every cut of , there is a unique minimum-weight edge crossing the cut.Which of the above two statements is/are TRUE?Correct answer
(C) Both I and II
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement I is correct: If all edge weights in a connected graph are distinct, the Minimum Spanning Tree (MST) is unique.Statement II is correct: A graph has a unique MST if and only if for every cut (a partition of the vertices into two disjoint sets), the edge with the minimum weight crossing the cut is unique. This is a known necessary and sufficient condition for the uniqueness of an MST.Thus, both statements are true.49
Q49MCQ2 marksMediumConsider the following snapshot of a system running concurrent processes. Process is holding instances of a resource R, . Assume that all instances of…Think it through. Then check your answer.Question
Consider the following snapshot of a system running concurrent processes. Process is holding instances of a resource R, . Assume that all instances of R are currently in use. Further, for all , process can place a request for at most additional instances of R while holding the instances it already has. Of the processes, there are exactly two processes and such that . Which one of the following conditions guarantees that no other process apart from and can complete execution?Correct answer
(A) Xₚ + X_q < Min \Yₖ 1 ≤ k ≤ n, k ≠ p, k ≠ q\
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Since all instances of R are currently in use, the total number of resources in the system is .Processes and have and , meaning they need no additional resources to complete. They can finish execution and release their held resources, and .After and finish, the available resources will be .We want to guarantee that no other process can complete. A process (where ) needs at most resources. To ensure it cannot complete, the available resources must be strictly less than its requirement .To guarantee this for all other processes , the available resources () must be less than the minimum requirement of any such process.Therefore, the condition is:50
Q50MCQ2 marksMediumConsider the following statements: I. The smallest element in a max-heap is always at a leaf node II. The second largest element in a max-heap is always a child of the root node…Think it through. Then check your answer.Question
Consider the following statements:
I. The smallest element in a max-heap is always at a leaf node
II. The second largest element in a max-heap is always a child of the root node
III. A max-heap can be constructed from a binary search tree in time
IV. A binary search tree can be constructed from a max-heap in timeWhich of the above statements are TRUE?Correct answer
(A) I, II and III
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement I is TRUE: In a max-heap, every parent node is greater than or equal to its children. Therefore, the smallest element must be in a node that has no children (a leaf node), otherwise, its children would be smaller than it, violating the max-heap property.Statement II is TRUE: The root contains the largest element. The second largest element must be one of the children of the root because any other node in the heap is a descendant of one of these children and thus smaller than or equal to them.Statement III is TRUE: A Binary Search Tree (BST) can be converted to a sorted array in time using in-order traversal. A max-heap can be built from an array in time. Thus, the total time is .Statement IV is FALSE: Constructing a BST from a max-heap is equivalent to sorting. We can extract the maximum element times from the heap, which takes , to get a sorted sequence, and then build a BST. The lower bound for comparison-based sorting is , so we cannot do this in generally.Therefore, statements I, II, and III are true.51
Q51NAT2 marksMediumConsider the following four processes with arrival times (in milliseconds) and their length of CPU bursts (in milliseconds) as shown below: | Process | P1 | P2 | P3 | P4 | | :---…Think it through. Then check your answer.Question
Consider the following four processes with arrival times (in milliseconds) and their length of CPU bursts (in milliseconds) as shown below:These processes are run on a single processor using preemptive Shortest Remaining Time First scheduling algorithm. If the average waiting time of the processes is millisecond, then the value of is ___________.Process P1 P2 P3 P4 Arrival time 0 1 3 4 CPU burst time 3 1 3 Correct answer
2 to 2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The scheduling algorithm is preemptive Shortest Remaining Time First (SRTF), which is the preemptive version of Shortest Job First (SJF).Gantt Chart Analysis:- At : arrives with burst time . starts execution.
- At : arrives with burst time . 's remaining time is . Since , preempts .
- At : finishes. resumes with remaining time .
- At : arrives with burst time . 's remaining time is . Since , continues.
- At : finishes. arrives with burst time .
will execute before because it has a shorter remaining time.- to : executes and finishes.
- to : executes and finishes.
Given average ms:
Since , this case is valid.Case 2:
will execute before (tie-break by arrival time if ).- to : executes.
- to : executes.
This does not match the given average of ms.Therefore, the value of is .52
Q52NAT2 marksMediumThe index node (inode) of a Unix-like file system has 12 direct, one single-indirect and one double-indirect pointers. The disk block size is 4 kB, and the disk block address is…Think it through. Then check your answer.Question
The index node (inode) of a Unix-like file system has 12 direct, one single-indirect and one double-indirect pointers. The disk block size is 4 kB, and the disk block address is 32-bits long. The maximum possible file size is (rounded off to 1 decimal place) _______ GB.Correct answer
3.7 to 3.8
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given:- Direct pointers: 12
- Single-indirect pointers: 1
- Double-indirect pointers: 1
- Block size = 4 kB = bytes
- Block address size = 32 bits = 4 bytes
1.Direct: 12 blocks.2.Single-indirect: Points to 1 block containing pointers blocks.3.Double-indirect: Points to 1 block containing pointers, each pointing to a single-indirect block blocks.Total blocks = .
Since (approx 1 million) is much larger than (1024) and 12, the maximum file size is dominated by the double-indirect blocks.Total size in bytes = bytes
bytes = bytes. bytes = 4 GiB.Converting to GB (Gigabytes, base 10) or GiB (Gibibytes, base 2):- In GiB: GiB.
- In GB (): GB.
53
Q53NAT2 marksMediumConsider the augmented grammar given below: Let . The number of…Think it through. Then check your answer.Question
Consider the augmented grammar given below:
Let . The number of items in the set 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 augmented grammar is:1.2.3.4.L → L, S5.contains:L → S
Moving the dot gives the kernel item: .Now, compute :1. (Kernel item)- The dot is before , so we add productions of with the dot at the beginning:
3.- From item 2, the dot is before , which we are already processing.
- From item 3, the dot is before , so we add productions of with the dot at the beginning:
5.The items in are:1.2.3.4.5.Total number of items = 5.54
Q54NAT2 marksMediumConsider the following matrix: The absolute value of the product of…Think it through. Then check your answer.Question
Consider the following matrix:The absolute value of the product of Eigen values of is ________.Correct answer
12 to 12
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The product of the eigenvalues of a matrix is equal to its determinant. The given matrix is a Vandermonde matrix of the form:where .The determinant of a Vandermonde matrix is given by .Here . The differences are:
Product = .Thus, the determinant is 12, and the absolute value of the product of eigenvalues is 12.55
Q55NAT2 marksMediumA certain processor deploys a single-level cache. The cache block size is 8 words and the word size is 4 bytes. The memory system uses a 60-MHz clock. To service a cache miss, the…Think it through. Then check your answer.Question
A certain processor deploys a single-level cache. The cache block size is 8 words and the word size is 4 bytes. The memory system uses a 60-MHz clock. To service a cache miss, the memory controller first takes 1 cycle to accept the starting address of the block, it then takes 3 cycles to fetch all the eight words of the block, and finally transmits the words of the requested block at the rate of 1 word per cycle. The maximum bandwidth for the memory system when the program running on the processor issues a series of read operations is ________ bytes/sec.Correct answer
160 to 160
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Calculate the total data transferred per block:Block size = 8 words 4 bytes/word = 32 bytes.2.Calculate the total time (cycles) to transfer one block:- Time to accept address: 1 cycle
- Time to fetch data: 3 cycles
- Time to transmit data: 8 words 1 cycle/word = 8 cycles
3.Calculate the bandwidth:Bandwidth =
Bandwidth = Given clock frequency = 60 MHz = cycles/sec. Bandwidth in bytes/sec =
bytes/sec.The answer is 160.56
Q56NAT2 marksHardLet be a full binary tree with 8 leaves. (A full binary tree has every level full.) Suppose two leaves and of are chosen uniformly and independently at random. The…Think it through. Then check your answer.Question
Let be a full binary tree with 8 leaves. (A full binary tree has every level full.) Suppose two leaves and of are chosen uniformly and independently at random. The expected value of the distance between and in (i.e., the number of edges in the unique path between and ) is (rounded off to 2 decimal places) _______.Correct answer
4.25 to 4.25
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given that is a full binary tree (perfect binary tree) with 8 leaves, we can determine its height .
For a perfect binary tree, the number of leaves is . Thus, .
The tree has levels , where the root is at level 0 and leaves are at level 3.We choose two leaves and uniformly and independently at random. Since there are 8 leaves, the total number of possible pairs is .The distance between two nodes in a tree is the number of edges on the unique path between them. For two leaves and at depth , the distance is given by:where is the Lowest Common Ancestor of and .We analyze the possible depths of the LCA:1.LCA at depth 0 (Root):The root has a left subtree and a right subtree. Each subtree contains leaves.
The LCA is the root if is in the left subtree and is in the right subtree, or vice versa.
Number of pairs = .
Distance = .
Contribution to sum = .2.LCA at depth 1:There are nodes at depth 1. Each is the root of a subtree with height 2 (leaves at relative depth 2).
Each node at depth 1 has a left child and a right child, each leading to leaves.
For a specific node at depth 1 to be the LCA, one leaf must be in its left branch (2 choices) and the other in its right branch (2 choices), or vice versa.
Pairs per node = .
Total pairs for 2 nodes = .
Distance = .
Contribution to sum = .3.LCA at depth 2:There are nodes at depth 2. Each has 2 leaves as children (1 left, 1 right).
For a node at depth 2 to be the LCA, one leaf must be left (1 choice) and the other right (1 choice), or vice versa.
Pairs per node = .
Total pairs for 4 nodes = .
Distance = .
Contribution to sum = .4.LCA at depth 3 (Leaf itself):This occurs when . There are 8 leaves.
Total pairs = 8.
Distance = .
Contribution to sum = 0.Total Sum of Distances:Expected Distance:The expected value is 4.25.57
Q57NAT2 marksHardSuppose is distributed uniformly in the open interval . The probability that the polynomial has only real roots is (rounded off to 1 decimal…Think it through. Then check your answer.Question
Suppose is distributed uniformly in the open interval . The probability that the polynomial has only real roots is (rounded off to 1 decimal place) ________.Correct answer
0.8 to 0.8
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The given polynomial is . For a quadratic equation to have real roots, the discriminant must be greater than or equal to zero ().In this case:
Calculating the discriminant:
For real roots, .
Dividing by 36:
This inequality holds when or .Given that is distributed uniformly in the open interval , the total length of the interval is .
Since must be in , the condition is not possible. Thus, we only consider .The favorable interval for is , which has a length of .The probability is:
Therefore, the probability is 0.8.58
Q58NAT2 marksHardLet be the set of all bijections from to , where denotes the identity function, i.e. . Let denote…Think it through. Then check your answer.Question
Let be the set of all bijections from to , where denotes the identity function, i.e. . Let denote composition on functions. For a string , let . Consider the language The minimum number of states in any DFA accepting is ________.Correct answer
120 to 120
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The set of all bijections from to itself is the symmetric group . The size of this group is . The language consists of all strings of elements from whose composition (product) is the identity element . For any finite group , the language is regular and its minimal DFA has exactly states. In this DFA:1.The states are the elements of the group . Here, there are states.2.The start state is the identity element .3.The transition function is defined as for any state and input symbol .4.The only accepting state is the identity element .To show this DFA is minimal, we check if any two states are equivalent. Two states are equivalent if for every string , .
Suppose . Let (the inverse bijection). Then . However, because . Thus, and are distinguishable. Since all 120 states are reachable from the start state and any two distinct states are distinguishable, the minimal DFA has 120 states.59
Q59NAT2 marksEasyConsider that 15 machines need to be connected in a LAN using 8-port Ethernet switches. Assume that these switches do not have any separate uplink ports. The minimum number of…Think it through. Then check your answer.Question
Consider that 15 machines need to be connected in a LAN using 8-port Ethernet switches. Assume that these switches do not have any separate uplink ports. The minimum number of switches needed 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
To connect switches in a network without dedicated uplink ports, standard ports must be used for interconnection. In a typical topology (like a chain or star), connecting switches requires links. Each link consumes 2 ports (one on each switch).Total ports available across switches = .
Ports used for interconnection = .
Ports available for connecting machines = .We need to connect 15 machines, so:
Since must be an integer, the minimum number of switches required is 3.Verification with :
Available ports = (Not enough for 15 machines).
Verification with :
Available ports = (Enough for 15 machines).60
Q60NAT2 marksMediumWhat is the minimum number of 2-input NOR gates required to implement a 4-variable function expressed in sum-of-minterms form as ? Assume…Think it through. Then check your answer.Question
What is the minimum number of 2-input NOR gates required to implement a 4-variable function expressed in sum-of-minterms form as ? Assume that all the inputs and their complements are available. Answer: ________.Correct answer
3 to 3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The function can be simplified using a K-map:Groups:CD\AB 00 01 11 10 00 1 0 0 1 01 0 1 1 0 11 0 1 1 0 10 1 0 0 1 1.Corners ():2.Middle block ():Simplified expression: (XNOR function).Given that all inputs and their complements () are available, we can implement the XNOR function using 2-input NOR gates as follows:1.2.3.Thus, the minimum number of 2-input NOR gates required is 3.61
Q61NAT2 marksMediumA relational database contains two tables Student and Performance as shown below: Student | Roll no. | Student name | |----------|--------------| | 1 | Amit | | 2 | Priya | |…Think it through. Then check your answer.Question
A relational database contains two tables Student and Performance as shown below:StudentPerformanceRoll no. Student name 1 Amit 2 Priya 3 Vinit 4 Rohan 5 Smita The primary key of the Student table is Roll_no. For the Performance table, the columns Roll_no. and Subject_code together form the primary key. Consider the SQL query given below:Roll no. Subject_code Marks 1 A 86 1 B 95 1 C 90 2 A 89 2 C 92 3 C 80 The number of rows returned by the above SQL query is ________.SELECT S.Student_name, sum(P.Marks) FROM Student S, Performance P WHERE P.Marks > 84 GROUP BY S.Student_name;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 SQL query performs a Cartesian product (cross join) between theStudenttable and thePerformancetable because there is no join condition (e.g.,S.Roll_no = P.Roll_no) specified in theWHEREclause.1.Filter Performance Table: The conditionWHERE P.Marks > 84filters thePerformancetable. The rows with marks 86, 95, 90, 89, and 92 satisfy this. There are 5 such rows.2.Cross Join: TheFROM Student S, Performance Pclause with the filter results in a cross join between all 5 rows of theStudenttable and the 5 filtered rows of thePerformancetable. This results in intermediate rows.3.Grouping: TheGROUP BY S.Student_nameclause groups these 25 rows by the student name. There are 5 distinct student names in theStudenttable: Amit, Priya, Vinit, Rohan, and Smita.4.Output: Each unique group (student name) produces exactly one row in the final result set, regardless of the sum calculation.Therefore, the number of rows returned is 5.62
Q62NAT2 marksMediumConsider the following C program: [code] The number of times the variable sum will be printed, when the above program is executed, is ______.Think it through. Then check your answer.Question
Consider the following C program:The number of times the variable sum will be printed, when the above program is executed, is ______.#include <stdio.h> int main(){ float sum = 0.0, j = 1.0, i = 2.0; while (i/j > 0.0625){ j = j + j; sum = sum + i/j; printf("%f\n", sum); } return 0; }Correct answer
5 to 5
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the number of times theprintfstatement is executed, we trace thewhileloop iterations:Initial values: , , .
Condition:1.Iteration 1:- Check condition: (True)
-
printfexecuted (1st time)
- Check condition: (True)
-
printfexecuted (2nd time)
- Check condition: (True)
-
printfexecuted (3rd time)
- Check condition: (True)
-
printfexecuted (4th time)
- Check condition: (True)
-
printfexecuted (5th time)
- Check condition: (False)
- The loop terminates.
sumis printed is 5.63
Q63NAT2 marksMediumConsider the following C program: [code] The output of the above C program is ___________.Think it through. Then check your answer.Question
Consider the following C program:The output of the above C program is ___________.#include <stdio.h> int main() { int a[] = {2, 4, 6, 8, 10}; int i, sum = 0, *b = a + 4; for (i = 0; i < 5; i++) sum = sum + (*b - i) - *(b - i); printf ("%d\n", sum); return 0; }Correct answer
10 to 10
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The program initializes an array .
A pointer is initialized to , which points to the last element .
The loop runs for .
In each iteration, the variablesumis updated as:sum = sum + (*b - i) - *(b - i).
Note that*bis always (dereferencing the fixed pointer ), and*(b - i)is the element at index of array (using pointer arithmetic).Iteration-wise trace:1.For :sum = 0 + (10 - 0) - a[4] = 10 - 10 = 02.For :sum = 0 + (10 - 1) - a[3] = 9 - 8 = 13.For :sum = 1 + (10 - 2) - a[2] = 1 + 8 - 6 = 34.For :sum = 3 + (10 - 3) - a[1] = 3 + 7 - 4 = 65.For :The final value ofsum = 6 + (10 - 4) - a[0] = 6 + 6 - 2 = 10sumis , which is printed by theprintfstatement.64
Q64NAT2 marksEasyIn an RSA cryptosystem, the value of the public modulus parameter is 3007. If it is also known that , where denotes Euler's Totient Function, then the…Think it through. Then check your answer.Question
In an RSA cryptosystem, the value of the public modulus parameter is 3007. If it is also known that , where denotes Euler's Totient Function, then the prime factor of which is greater than 50 is ___________.Correct answer
97 to 97
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In an RSA cryptosystem, the public modulus is the product of two distinct prime numbers and .Euler's Totient Function for a product of two primes is given by:Expanding the expression for :Substituting the value of :Now we have a system of two equations:
1)
2)
These values and are the roots of the quadratic equation:Using the quadratic formula :Since and , and the last digit is 6, .The prime factors of are 31 and 97. The factor greater than 50 is 97.65
Q65NAT2 marksMediumConsider the following relations P(X,Y,Z), Q(X,Y,T) and R(Y,V). P | X | Y | Z | |---|---|---| | X1| Y1| Z1| | X1| Y1| Z2| | X2| Y2| Z2| | X2| Y4| Z4| Q | X | Y | T |…Think it through. Then check your answer.Question
Consider the following relations P(X,Y,Z), Q(X,Y,T) and R(Y,V).PQX Y Z X1 Y1 Z1 X1 Y1 Z2 X2 Y2 Z2 X2 Y4 Z4 RX Y T X2 Y1 2 X1 Y2 5 X1 Y1 6 X3 Y3 1 How many tuples will be returned by the following relational algebra query?Answer: ______________Y V Y1 V1 Y3 V2 Y2 V3 Y2 V2 Correct answer
1 to 1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The given relational algebra query is:Let's evaluate the two parts of the expression separately.Part 1:1.Cartesian Product (): This combines every tuple of P with every tuple of R.2.Selection (): We need to find tuples from the cartesian product that satisfy both conditions:-
P.Y = R.Y -
R.V = V2
R.V = V2:- (Y3, V2)
- (Y2, V2)
P.Y = R.Ycondition:- For
Rtuple (Y3, V2), we need a tuple inPwithP.Y = Y3. There are no such tuples in P. - For
Rtuple (Y2, V2), we need a tuple inPwithP.Y = Y2. The tuple (X2, Y2, Z2) in P matches.
3.Projection (): We project theXattribute from the result of the selection.- Projecting
Xfrom (X2, Y2, Z2, Y2, V2) gives {X2}.
1.Cartesian Product (): This combines every tuple of Q with every tuple of R.2.Selection (): We need to find tuples that satisfy both conditions:-
Q.Y = R.Y -
Q.T > 2
Q.T > 2:- (X1, Y2, 5)
- (X1, Y1, 6)
Q.Y = R.Ycondition:- For
Qtuple (X1, Y2, 5), we need tuples inRwithR.Y = Y2. The matching tuples are (Y2, V3) and (Y2, V2). - For
Qtuple (X1, Y1, 6), we need a tuple inRwithR.Y = Y1. The matching tuple is (Y1, V1).
- (X1, Y2, 5, Y2, V3)
- (X1, Y2, 5, Y2, V2)
- (X1, Y1, 6, Y1, V1)
Xattribute from the result of the selection.- Projecting
Xfrom the three resulting tuples gives {X1, X1, X1}. Since projection returns a set, duplicates are removed. - The result is {X1}.
Result of Part 1 - Result of Part 2
= {X2} - {X1}
= {X2}The final result is the set {X2}, which contains one tuple.Therefore, the number of tuples returned by the query is 1.-