The PYQ practice room
GATE CS 2026 Set 1
All 65 solved GATE CS 2026 Set 1 questions in exam order. Open a question, commit to an answer, and learn from the step-by-step solution. One question at a time.
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.Questions
65
Paper marks
100
Question formats
3
MCQ · MSQ · NAT
Revision mode
Self-paced
No timer. Focus on understanding.
Explore the questions
General Aptitude (GA)
101
Q1MCQ1 markEasyThe antonym of the word protagonist is ________.Think it through. Then check your answer.Question
The antonym of the word protagonist is ________.Correct answer
(B) antagonist
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The word protagonist refers to the leading character or one of the major characters in a drama, movie, novel, or other fictional text. The antagonist is a person who actively opposes or is hostile to someone or something; an adversary.Therefore, the antonym of protagonist is antagonist.2
Q2MCQ1 markMediumThe figure shows two 4-tile patterns. [figure] Either one or both of the patterns can be used any number of times and in any orientation to construct a new pattern. Which one of…Think it through. Then check your answer.Question
The figure shows two 4-tile patterns.
Either one or both of the patterns can be used any number of times and in any orientation to construct a new pattern. Which one of the options below cannot be constructed by using only these two 4-tile patterns assuming there are no overlaps among them?Correct answer
(C) [figure]
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The problem asks which pattern cannot be constructed using the given 4-tile patterns (a square and a strip). Since each basic pattern consists of exactly 4 tiles, any constructed pattern must have a total number of tiles that is a multiple of 4.Let's analyze the number of tiles in each option:- (A) A grid has tiles. Since 12 is divisible by 4, it is possible (e.g., using three strips horizontally).
- (B) A grid (or ) has tiles. Divisible by 4.
- (C) A grid has tiles. Since 15 is not divisible by 4, it is impossible to construct this pattern using only 4-tile shapes without overlap or gaps.
- (D) A grid has tiles. Divisible by 4.
3
Q3MCQ1 markEasyConsider a knock-out women’s badminton singles tournament where there are no ties. The loser in each game is eliminated from the tournament. Every player plays until she is…Think it through. Then check your answer.Question
Consider a knock-out women’s badminton singles tournament where there are no ties. The loser in each game is eliminated from the tournament. Every player plays until she is defeated or remains the last undefeated player. The last undefeated player is declared the winner of the tournament. If there are 64 players in the beginning of the tournament, how many games should be played in total to declare the winner of the tournament?Correct answer
(C) 63
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a knock-out tournament, every match eliminates exactly one player. To find a single winner from participants, players must be eliminated.Since each game eliminates 1 player:
Total games = Total players to be eliminated = .Alternatively, in each round:- Round 1: 64 players 32 games
- Round 2: 32 players 16 games
- Round 3: 16 players 8 games
- Round 4: 8 players 4 games
- Round 5: 4 players 2 games
- Round 6: 2 players 1 game
4
Q4MCQ1 markEasyA student needs to enroll for a minimum of 60 credits. A student cannot enroll for more than 70 credits. The credits are divided amongst project and three distinct sets of courses…Think it through. Then check your answer.Question
A student needs to enroll for a minimum of 60 credits. A student cannot enroll for more than 70 credits. The credits are divided amongst project and three distinct sets of courses namely, core courses, specialization courses, and elective courses. It is compulsory for a student to enroll for exactly 15 credits of core courses and exactly 20 credits of project. In addition, a student has to enroll for a minimum of 10 credits of specialization courses. The maximum credits of elective courses that a student can enroll for is ______Correct answer
(D) 25
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the total credits, be core credits, be project credits, be specialization credits, and be elective credits.Given constraints:1.2.3.4.We know that .
Substituting the fixed values: .We want to find the maximum value of .
Rearranging the equation for : .To maximize , we should maximize and minimize .- Maximum .
- Minimum .
.Thus, the maximum credits of elective courses a student can enroll for is 25.5
Q5MCQ1 markEasy‘When the teacher is in the room, all students stand silently.’ If the above statement is true, which one of the following statements is not necessarily true?Think it through. Then check your answer.Question
‘When the teacher is in the room, all students stand silently.’If the above statement is true, which one of the following statements is not necessarily true?Correct answer
(C) If all students are standing, then the teacher is in the room.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the proposition "The teacher is in the room" and be the proposition "All students stand silently".
The given statement is .Let's analyze the options:
(A) "If any student is not standing silently, then the teacher is not in the room." This is , which is the contrapositive of the original statement. The contrapositive is logically equivalent to the original statement, so it is necessarily true.
(B) "When the teacher is in the room, all students are silent." Since standing silently implies being silent, this follows from . Necessarily true.
(C) "If all students are standing, then the teacher is in the room." This is (assuming "standing" is the condition , or a part of it). This is the converse of the original statement. The converse is not necessarily true. Students could be standing for other reasons even if the teacher is not present.
(D) "When the teacher is in the room, all students are standing." Since standing silently implies standing, this follows from . Necessarily true.Therefore, option (C) is not necessarily true.6
Q6MCQ2 marksEasyCombinatorics deals with problems involving counting. For example, “How many distinct arrangements of N distinct objects in M spaces on a circle are possible?” is a typical…Think it through. Then check your answer.Question
Combinatorics deals with problems involving counting. For example, “How many distinct arrangements of N distinct objects in M spaces on a circle are possible?” is a typical problem in combinatorics. This kind of counting is sometimes used in the modeling of several physical phenomena. Often, in such models, the different combinatorial possibilities are assigned probability values. Assigning probabilities enables the computation of the average values of physical quantities.Consider the following statements:P: Combinatorics is always invoked in the modeling of physical phenomena.Q: Modeling some physical phenomena involves assigning probabilities to combinatorial possibilities in order to compute average values of physical quantities.Based on the passage above, what can be inferred about statements P and Q?Correct answer
(B) P is False and Q is True
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze the statements based on the text:Statement P: "Combinatorics is always invoked in the modeling of physical phenomena."
The passage states: "This kind of counting is sometimes used in the modeling of several physical phenomena." The word "sometimes" contradicts "always". Therefore, P is False.Statement Q: "Modeling some physical phenomena involves assigning probabilities to combinatorial possibilities in order to compute average values of physical quantities."
The passage states: "Often, in such models [modeling of several physical phenomena], the different combinatorial possibilities are assigned probability values. Assigning probabilities enables the computation of the average values of physical quantities." This directly supports statement Q. Therefore, Q is True.Conclusion: P is False and Q is True.7
Q7MCQ2 marksMediumIn Panel I of the figure below, the front view and top view of a structure are shown. Which one of the 3D structures shown in Panel II possesses the views shown in Panel I?…Think it through. Then check your answer.Question
In Panel I of the figure below, the front view and top view of a structure are shown. Which one of the 3D structures shown in Panel II possesses the views shown in Panel I?
Correct answer
(D) (iv)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The problem asks to identify the 3D structure corresponding to the given Front and Top views.1. Analyze the Top View:
The Top View in Panel I shows an L-shape made of three squares: two vertical on the left and one horizontal extending to the right from the bottom. Assuming standard orthographic projection where the bottom of the Top View corresponds to the front of the object, the structure occupies the Front-Left, Back-Left, and Front-Right positions on a grid.2. Analyze the Front View:
The Front View shows a column of height 2 on the left and a column of height 1 on the right. Crucially, there is a horizontal line separating the top and bottom squares of the left column. In engineering drawing, a solid line inside a view represents an edge, often caused by a change in depth (surface discontinuity).3. Evaluate the Options:- Structure (i): Occupies only 2 positions (vertical stack + 1 side). Top view would be 2 squares. Incorrect.
- Structure (ii): Top view would not match the specific L-shape orientation. Incorrect.
- Structure (iii): Has a tall block (height 2) at the Front-Left and a short block (height 1) at the Front-Right. The Front View of the left column would show the continuous front face of the tall block. There would be no horizontal line dividing the bottom and top halves because they are on the same plane. Incorrect.
- Structure (iv): Has a short block (height 1) at the Front-Left and a tall block (height 2) at the Back-Left. When viewed from the front, the short front block covers the bottom half of the back block. The top edge of the front block is visible as a horizontal line, and the top half of the back block is visible above it. This matches the Front View in Panel I exactly, including the dividing line.
8
Q8MCQ2 marksMediumFor positive real numbers and , the function is defined as: The max function is defined as:…Think it through. Then check your answer.Question
For positive real numbers and , the function is defined as:The max function is defined as:The graph below shows the plot of a functionN(S)versus .N(S)can be expressed as _____.
Correct answer
(A) H₁₀(S) - H₂₀(S)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The function represents a ramp function that is 0 for and increases with a slope of 1 for .The graph ofN(S)shows:- For , .
- For ,
N(S)increases linearly from 0 to 10. The slope is . - For , (constant).
(A) :- If : .
- If : . This is a line with slope 1 starting at 0. At , value is 10.
- If : . This is a constant value of 10.
9
Q9MCQ2 marksMediumIn the 2020 summer Olympics’ Javelin throw finals, Neeraj Chopra exhibited a spectacular performance to win the gold medal. The silver medal was won by Jakub Vadlejch and the…Think it through. Then check your answer.Question
In the 2020 summer Olympics’ Javelin throw finals, Neeraj Chopra exhibited a spectacular performance to win the gold medal. The silver medal was won by Jakub Vadlejch and the bronze medal was won by Vitezlav Vesely. There were six rounds of throws with each athlete having one throw per round. The best of all the throws of each athlete is considered for the medal. Following were the observations about the throws:i. The first and second rounds were dominated by Neeraj Chopra with a gold medal performance in his second throw, while the other two athletes did not have any medal winning throws in these rounds.
ii. The throws in the last round by both Jakub Vadlejch and Vitezlav Vesely were fouls and were not considered for scoring.
iii. After four rounds, Vitezlav Vesely was in the second position and could not improve upon his best throw in the succeeding rounds.
iv. In the fourth round, the throw by Jakub Vadlejch was the best in that round.In which round did Vitezlav Vesely have his best throw?Correct answer
(A) Third
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze the information for Vitezlav Vesely:1.Statement (i): Vitezlav did not have a medal-winning throw in Round 1 or Round 2.2.Statement (ii): Round 6 was a foul for Vitezlav.3.Statement (iii): After Round 4, Vitezlav was in 2nd position and did not improve later. This implies his best throw occurred in Rounds 1, 2, 3, or 4. Since he didn't improve later, Round 5 is also ruled out as a best throw.4.Combining (1) and (3), Vitezlav's best throw must be in Round 3 or Round 4.5.Statement (iv): In Round 4, Jakub Vadlejch had the best throw of that round. This means Jakub's Round 4 throw > Vitezlav's Round 4 throw.6.Statement (iii) again: After Round 4, Vitezlav was in 2nd position (behind Neeraj, ahead of Jakub). This means Vitezlav's Best Throw (so far) > Jakub's Best Throw (so far).- If Vitezlav's best throw was in Round 4, then Vitezlav's Best = Vitezlav's R4.
- From (5), Jakub's R4 > Vitezlav's R4.
- Therefore, Jakub's R4 > Vitezlav's Best.
- If Jakub's R4 > Vitezlav's Best, then Jakub would be ahead of Vitezlav in the standings after Round 4.
- However, we know Vitezlav was 2nd (ahead of Jakub) after Round 4.
- This creates a contradiction if Vitezlav's best was in Round 4.
10
Q10MCQ2 marksEasyAn unbiased six-faced dice whose faces are marked with numbers 1, 2, 3, 4, 5, and 6 is rolled twice in succession and the number on the top face is recorded each time. The…Think it through. Then check your answer.Question
An unbiased six-faced dice whose faces are marked with numbers 1, 2, 3, 4, 5, and 6 is rolled twice in succession and the number on the top face is recorded each time. The probability that the number appearing in the second roll is an integer multiple of the number appearing in the first roll is __________Correct answer
(C) (7)/(18)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the outcome of the two rolls be , where . The total number of outcomes is .The condition is that is an integer multiple of (i.e., is divisible by ). Let's list the favorable outcomes for each possible value of :- If , (6 outcomes)
- If , (3 outcomes)
- If , (2 outcomes)
- If , (1 outcome)
- If , (1 outcome)
- If , (1 outcome)
Computer Science & Information Technology (CS1)
5511
Q11MCQ1 markMediumAn urn contains one red ball and one blue ball. At each step, a ball is picked uniformly at random from the urn, and this ball together with another ball of the same color is put…Think it through. Then check your answer.Question
An urn contains one red ball and one blue ball. At each step, a ball is picked uniformly at random from the urn, and this ball together with another ball of the same color is put back in the urn. The probability that there are equal number of red and blue balls after two steps isCorrect answer
(B) 1/3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let denote the number of red and blue balls in the urn. Initially, the state is . Total balls = 2.Step 1:- Probability of picking Red () = . New state: . Total balls = 3.
- Probability of picking Blue () = . New state: . Total balls = 3.
We want the final state to have an equal number of red and blue balls. Since we start with 2 balls and add 1 ball in each of the 2 steps, the final total is 4 balls. Thus, we need the final state to be .- Case 1: From state (after picking Red in Step 1):
Probability of this path = .- Case 2: From state (after picking Blue in Step 1):
Probability of this path = .Total probability = .12
Q12MCQ1 markHardConsider matrices with their elements from . The number of such matrices with even number of 1s in every row and every column isThink it through. Then check your answer.Question
Consider matrices with their elements from . The number of such matrices with even number of 1s in every row and every column isCorrect answer
(A) 512
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We are looking for the number of binary matrices (where ) such that every row sum and every column sum is even (i.e., ).Let the matrix be . The condition implies that for each row , , and for each column , .Consider the submatrix of size formed by the first rows and columns. We can fill this submatrix arbitrarily with s and s. There are entries, so there are ways to do this.Once the submatrix is fixed:1.The last element of each of the first rows is uniquely determined to satisfy the row parity constraint.2.The last element of each of the first columns is uniquely determined to satisfy the column parity constraint.3.The element at position is determined by the parity of the last row. We must check if this choice also satisfies the parity of the last column.- Sum of all elements in the matrix = .
- Since the first row sums are even, and the last row sum is forced to be even by the choice of , the total sum is even.
- Since the first col sums are even, the last col sum must be (Total Sum - sum of first cols) = Even - Even = Even. Thus, the constraint is automatically satisfied.
For , the number is .13
Q13MCQ1 markEasyFor , the maximum multiplicity of any eigenvalue of an matrix with elements from isThink it through. Then check your answer.Question
For , the maximum multiplicity of any eigenvalue of an matrix with elements from isCorrect answer
(A) n
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The characteristic polynomial of an matrix is a polynomial of degree . The sum of the algebraic multiplicities of all eigenvalues is exactly (over the complex field, and if all eigenvalues are real, over ). Therefore, it is possible for a single eigenvalue to have an algebraic multiplicity of up to . For example, the identity matrix has the eigenvalue 1 with multiplicity . Thus, the maximum multiplicity is .14
Q14MCQ1 markEasyMatch each addressing mode in List I with a data element or an element of a data structure (in a high-level language) in List II: | List I | List II | | :--- | :--- | | P.…Think it through. Then check your answer.Question
Match each addressing mode in List I with a data element or an element of a data structure (in a high-level language) in List II:List I List II P. Immediate 1. Element of an array Q. Indirect 2. Pointer R. Base with index 3. Element of a record S. Base with offset/displacement 4. Constant Correct answer
(B) P–4, Q–2, R–1, S–3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
P. Immediate: The operand is part of the instruction itself, typically used for constants. (Matches 4)
Q. Indirect: The instruction specifies a memory location that contains the address of the operand, typically used for pointers. (Matches 2)
R. Base with index: The effective address is calculated by adding a base register and an index register, typically used for accessing elements of an array. (Matches 1)
S. Base with offset/displacement: The effective address is the sum of a base register and a constant offset, typically used for accessing fields (elements) of a record/structure. (Matches 3)Therefore, the correct matching is P-4, Q-2, R-1, S-3.15
Q15MCQ1 markEasyConsider a processor P whose instruction set architecture is the load-store architecture. The instruction format is such that the first operand of any instruction is the…Think it through. Then check your answer.Question
Consider a processor P whose instruction set architecture is the load-store architecture. The instruction format is such that the first operand of any instruction is the destination operand.Which one of the following sequences of instructions corresponds to the high-level language statement Z = X + Y ?Note: X, Y, and Z are memory operands. R0, R1, and R2 are registers.Correct answer
(D) LOAD R0, X LOAD R1, Y ADD R2, R0, R1 STORE Z, R2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a load-store architecture, arithmetic operations (like ADD) can only be performed on values present in registers. Memory operands cannot be used directly in ALU instructions.1.LOAD R0, X: Load the value from memory location X into register R0.2.LOAD R1, Y: Load the value from memory location Y into register R1.3.ADD R2, R0, R1: Add the values in R0 and R1, storing the result in register R2.4.STORE Z, R2: Store the value from register R2 into memory location Z.Option (A) uses memory operands directly in ADD.
Option (B) uses a memory operand (Y) and destination (Z) in ADD.
Option (C) uses memory operands (X, Y) in ADD.
Option (D) correctly follows the load-store constraint.16
Q16MCQ1 markEasyWhich one of the following dependencies among the register operands of different instructions can cause a data hazard in a pipelined processor?Think it through. Then check your answer.Question
Which one of the following dependencies among the register operands of different instructions can cause a data hazard in a pipelined processor?Correct answer
(B) Read-after-write
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a standard pipelined processor (like the classic 5-stage MIPS pipeline), instructions are executed in overlapping stages. A Read-after-Write (RAW) dependency occurs when an instruction tries to read a register before a previous instruction has written to it. Since the read stage (ID) occurs before the write-back stage (WB), would read an old value unless forwarding or stalling is used. This is a true data dependency and constitutes a data hazard.- Read-after-read (RAR): Not a hazard; multiple instructions can read the same register simultaneously.
- Write-after-read (WAR): An anti-dependency. In simple in-order pipelines, reads happen early (ID) and writes happen late (WB), so the read completes before the write, avoiding a hazard.
- Write-after-write (WAW): An output dependency. In simple in-order pipelines, writes happen in order in the WB stage, avoiding a hazard.
17
Q17MCQ1 markMediumConsider the following recurrence relations: For all , …Think it through. Then check your answer.Question
Consider the following recurrence relations:
For all ,Assume that for all and .
Which one of the following options is correct?Correct answer
(A) T₁(n) = Θ(n²)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
First, solve for using the Master Theorem:Here, . We compare with .
Since , .
By Case 1 of the Master Theorem, .Next, substitute into the recurrence for :Here, . We compare with .
Since , we have .
By Case 1 of the Master Theorem, the solution is dominated by the recursive part:18
Q18MCQ1 markEasyWith respect to a TCP connection between a client and a server, which one of the following statements is true?Think it through. Then check your answer.Question
With respect to a TCP connection between a client and a server, which one of the following statements is true?Correct answer
(D) The client and server can initiate closing of the connection at the same time
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
- Option A: Incorrect. TCP uses a three-way handshake (SYN, SYN-ACK, ACK) to establish a connection.
- Option B: Incorrect. Either the client or the server can initiate the connection termination (sending the first FIN segment).
- Option C: Incorrect. TCP connections are full-duplex, meaning data can flow in both directions simultaneously.
- Option D: Correct. TCP supports a simultaneous close scenario where both sides send FIN segments at approximately the same time. The state transitions handle this gracefully (moving from FIN-WAIT-1 to CLOSING to TIME-WAIT).
19
Q19MSQ1 markMediumWhich of the following statements is/are true with respect to the interaction of a web browser with a web server using HTTP 1.1?Think it through. Then check your answer.Question
Which of the following statements is/are true with respect to the interaction of a web browser with a web server using HTTP 1.1?Correct answer
(A) HTTP 1.1 facilitates downloading multiple objects of the same webpage over the same TCP connection, if the objects are stored in the same server; (C) HTTP 1.1 facilitates sending a request for downloading one object without waiting for a previously requested object to be downloaded completely; (D) HTTP 1.1 facilitates downloading multiple webpages on the same server to be downloaded over a single TCP connection
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
HTTP 1.1 introduced persistent connections and pipelining.- Option (A) is True: Persistent connections allow multiple requests and responses (objects) to be sent over the same TCP connection, provided they reside on the same server.
- Option (B) is False: A TCP connection is established between a client and a specific server (IP address and port). Objects stored on different servers require different TCP connections.
- Option (C) is True: This describes HTTP Pipelining, where multiple requests can be sent without waiting for the corresponding responses.
- Option (D) is True: Persistent connections are not limited to a single webpage's resources. If a user navigates to another webpage hosted on the same server, the existing TCP connection can be reused.
20
Q20MSQ1 markMediumLet . Consider an matrix with its elements from . Let the vector be in the null space of . Which…Think it through. Then check your answer.Question
Let . Consider an matrix with its elements from . Let the vector be in the null space of .Which of the following options is/are always correct?Correct answer
(B) Determinant of M is 0; (D) There are at least two non-zero vectors in the null space of M
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let . Since is in the null space of , we have . This implies that the second column of is a zero vector (since is a linear combination of columns of with coefficients from ).- Option (A) is False: Since one column is zero, the determinant is 0, not 1.
- Option (B) is True: A matrix with a zero column has a determinant of 0.
- Option (C) is False: The rank is at most , but it is not necessarily 1. For example, if is the zero matrix, rank is 0. If has linearly independent columns, rank is .
- Option (D) is True: The null space contains the vector . Since the field is , the null space is a subspace containing the span of , i.e., . This set contains infinite distinct non-zero vectors (e.g., ). Thus, there are at least two non-zero vectors.
21
Q21MSQ1 markMediumConsider the following Boolean expression of a function : Which of the following expressions is/are equivalent to ?Think it through. Then check your answer.Question
Consider the following Boolean expression of a function :Which of the following expressions is/are equivalent to ?Correct answer
(A) P ⊕ Q; (C) P ⊕ Q
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let and .
The function is .Calculate terms:
Substitute back:
This is the XNOR function, denoted as or .Check options:
(A) is XNOR. Correct.
(B) is XOR. Incorrect.
(C) . This is XNOR. Correct.
(D) . Incorrect.22
Q22MSQ1 markMediumConsider the 8-bit signed integers and represented using the sign-magnitude form. The binary representations of and are as follows:…Think it through. Then check your answer.Question
Consider the 8-bit signed integers and represented using the sign-magnitude form. The binary representations of and are as follows:Which of the following operations to compute result(s) in an arithmetic overflow?Correct answer
(B) Z = X - Y; (C) Z = -X + Y
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In 8-bit sign-magnitude representation, the Most Significant Bit (MSB) is the sign bit ( for positive, for negative), and the remaining 7 bits represent the magnitude. The range of representable values is to , i.e., .Given:
. Sign bit is (negative). Magnitude is . So, .
. Sign bit is (positive). Magnitude is . So, .Let's evaluate the options:
(A) . This is within . No overflow.
(B) . The minimum representable value is . Since , this causes an overflow.
(C) . The maximum representable value is . Since , this causes an overflow.
(D) . This is within . No overflow.Thus, operations (B) and (C) result in arithmetic overflow.23
Q23MSQ1 markMediumLet be an odd number greater than 100. Consider a binary minheap with elements stored in an array whose index starts from 1. Which of the following indices of …Think it through. Then check your answer.Question
Let be an odd number greater than 100. Consider a binary minheap with elements stored in an array whose index starts from 1.Which of the following indices of do/does NOT correspond to any leaf node of the minheap?Correct answer
(B) (n-1)/(2); (C) (n-3)/(2)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a binary heap with nodes stored in a 1-indexed array:- The internal nodes are located at indices .
- The leaf nodes are located at indices .
So, the internal nodes are at indices to .
The leaf nodes are at indices to .Let's check the options:
(A) : This is the first leaf node index. It corresponds to a leaf.
(B) : This is the last internal node index. It does NOT correspond to a leaf.
(C) : Since , this index is valid and less than . Thus, it is an internal node. It does NOT correspond to a leaf.
(D) : This is the last leaf node index. It corresponds to a leaf.The question asks for indices that do NOT correspond to any leaf node. Therefore, (B) and (C) are correct.24
Q24MSQ1 markMediumConsider a hash table that is initially empty. The hash table is maintained using open addressing with linear probing. The hash function used is…Think it through. Then check your answer.Question
Consider a hash table that is initially empty. The hash table is maintained using open addressing with linear probing. The hash function used is .Consider the following sequence of insertions performed on :Which of the following positions in the hash table is/are empty after these insertions are performed?Correct answer
(C) 2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We insert the keys into the hash table of size 11 (indices 0 to 10) using and linear probing.1.Insert 1: . is empty. Place 1 at .2.Insert 13: . is empty. Place 13 at .3.Insert 22: . is empty. Place 22 at .4.Insert 15: . is empty. Place 15 at .5.Insert 11: . is occupied (22). Probe next:- Index 8: Occupied (1).
- Index 9: Occupied (13).
- Index 10: Empty. Place 11 at .
- Index 10: Occupied (11).
- Index 0: Occupied (15).
- Index 1: Empty. Place 24 at .
- Occupied indices: .
- Empty indices: .
(A) 0 is occupied.
(B) 10 is occupied.
(C) 2 is empty.
(D) 1 is occupied.Only option (C) corresponds to an empty position.25
Q25MSQ1 markMediumConsider the following grammar where is the start symbol, and and are terminal symbols. Which of the following statements…Think it through. Then check your answer.Question
Consider the following grammar where is the start symbol, and and are terminal symbols.Which of the following statements is/are true?Correct answer
(A) The grammar is ambiguous; (B) The string abb has two distinct derivations in this grammar; (C) The string abab has only one rightmost derivation
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To determine the properties of the grammar , let's analyze the given statements.Statement (A) and (B): Ambiguity and derivations of
We check if the string has more than one distinct derivation (parse tree).Derivation 1:(Here, the first becomes , and the second becomes )Derivation 2:(Here, the first becomes , and the second becomes )Since there are two distinct leftmost derivations (and thus two distinct parse trees) for the string , the grammar is ambiguous. Therefore, statement (A) is true and statement (B) is true.Statement (C): Derivation of
We need to generate starting from . Since the string starts with , we must use the production .We need , which implies .
Possible splits for and based on the position of in :1. and . (Using the first as the separator)2. and . (Using the second as the separator)Let's check validity:- Case 1 (): is valid. Does ? Yes, . This gives one valid derivation.
- Case 2 (): Does ? The productions are (starts with ), (starts with ), . To generate , we must start with . Then we need . However, any derivation from starting with must use , which introduces a . Thus, cannot generate the string . Consequently, cannot generate . This case is invalid.
The language generated by any Context-Free Grammar (CFG) is a Context-Free Language (CFL). The membership problem for CFLs is decidable (e.g., using the CYK algorithm). Therefore, the language is decidable. Statement (D) is false.Conclusion: Statements (A), (B), and (C) are true.26
Q26MSQ1 markMediumLet be a nondeterministic finite automaton (NFA) with 6 states over a finite alphabet. Which of the following options CANNOT be the number of states in the minimal…Think it through. Then check your answer.Question
Let be a nondeterministic finite automaton (NFA) with 6 states over a finite alphabet.Which of the following options CANNOT be the number of states in the minimal deterministic finite automaton (DFA) that is equivalent to ?Correct answer
(B) 65; (D) 128
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The number of states in the given NFA is .The subset construction algorithm converts an NFA with states into an equivalent DFA with at most states. The minimal DFA is unique and has a number of states less than or equal to any other equivalent DFA. Therefore, the number of states in the minimal DFA, denoted as , is bounded by:Substituting :We analyze the given options:
(A) (Possible)
(B) (Impossible)
(C) (Possible, e.g., for a language accepting all strings or no strings)
(D) (Impossible)The question asks for the number of states that CANNOT be in the minimal DFA. Both 65 and 128 exceed the maximum possible states (64).27
Q27MSQ1 markMediumConsider the following C statements: Which of the following options is/are correct? [figure]Think it through. Then check your answer.Question
Consider the following C statements:Which of the following options is/are correct?
Correct answer
(C) S1 has a lexical error and S3 has a semantic error
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Step-by-step analysis of the statements:1.Statement S1:char *str1 = "Hello; /* Statement S1 */contains an unterminated string literal. The opening double quote is not matched by a closing double quote on the same line. In compiler design, an unterminated string literal is a failure to form a valid token, which is categorized as a lexical error.2.Statement S2:char *str2 = "Hello;"; /* Statement S2 */is a valid C statement. It correctly declares a character pointer and initializes it with a properly terminated string literal.3.Statement S3:Conclusion:int *str3 = "Hello"; /* Statement S3 */is syntactically correct as it follows the grammar for variable declaration and initialization. However, it attempts to assign a value of typechar *(the decayed type of the string literal) to a variable of typeint *. This type mismatch is a violation of the language's type rules, which is caught during the semantic analysis phase. Thus, it is a semantic error.- S1 has a lexical error.
- S2 is correct.
- S3 has a semantic error.
28
Q28MSQ1 markMediumWhich of the following statements is/are true?Think it through. Then check your answer.Question
Which of the following statements is/are true?Correct answer
(C) For a grammar to be LL(1), it must be left-factored
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement (A) is false because LL(1) parsers are predictive parsers that use a lookahead of 1 symbol to determine the production to apply, without backtracking.
Statement (B) is false because left-recursion causes an infinite loop in LL(1) parsers. A grammar must be free of left-recursion to be LL(1).
Statement (C) is true. A grammar must be left-factored (i.e., have no common prefixes in the right-hand sides of productions for the same non-terminal) to be LL(1), otherwise the parser cannot deterministically choose a production based on a single lookahead.
Statement (D) is false. SLR parsers (which are bottom-up) are generally more powerful than LL(1) parsers (which are top-down).29
Q29MSQ1 markMediumWith respect to deadlocks in an operating system, which of the following statements is/are FALSE?Think it through. Then check your answer.Question
With respect to deadlocks in an operating system, which of the following statements is/are FALSE?Correct answer
(A) Banker’s algorithm is used to prevent deadlocks; (C) An assignment edge in a resource allocation graph is marked from a process to a resource
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The question asks for FALSE statements.
(A) False. Banker's algorithm is a deadlock avoidance algorithm, not prevention.
(B) True. Disallowing the 'hold and wait' condition is a valid deadlock prevention technique.
(C) False. In a resource allocation graph, an assignment edge is directed from a resource to a process (R → P). An edge from a process to a resource (P → R) represents a request edge.
(D) True. By definition, a safe state is one where there exists a sequence of processes such that each can satisfy its resource requests and terminate, thus guaranteeing no deadlock.30
Q30MSQ1 markEasyLet and be the attributes of a relation in a relational schema. Let indicate functional dependency in the context of a relational database,…Think it through. Then check your answer.Question
Let and be the attributes of a relation in a relational schema. Let indicate functional dependency in the context of a relational database, where . Which of the following options is/are always true?Correct answer
(C) If (\P\ \R\ and \Q\ \S\), then \P, Q\ \R, S\; (D) If \P\ \R\, then \P, Q\ \R\
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To determine which options are always true, we apply Armstrong's Axioms and derived rules for functional dependencies (FDs):1.Option (C) is true by the Composition Rule: IfX → YandW → Z, thenXW → YZ.- Given
P → RandQ → S, applying the composition rule directly gives .
X → Y, thenXZ → YZfor any .- Given
P → R, augmenting with givesPQ → RQ. - By the Decomposition Rule (or reflexivity
RQ → Rand transitivity), ifPQ → RQ, thenPQ → Rmust hold.
P → Rholds, and by augmentationPQ → Ralso holds. However,Q → Rdoes not necessarily hold as might not determine .4.Option (B) is false. This describes a partial dependency. In a normalized relation, an attribute might depend on a composite key without depending on either or individually (e.g., ).Therefore, options (C) and (D) are always true.- Given
31
Q31MSQ1 markMediumIn the context of relational database normalization, which of the following statements is/are true?Think it through. Then check your answer.Question
In the context of relational database normalization, which of the following statements is/are true?Correct answer
(A) It is always possible to obtain a dependency-preserving 3NF decomposition of a relation; (B) It is always possible to obtain a dependency-preserving 1NF decomposition of a relation; (C) It is not always possible to obtain a dependency-preserving BCNF decomposition of a relation
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement (A) is true: There exists a standard algorithm (Bernstein's synthesis algorithm) to decompose any relation schema into 3NF which is both lossless-join and dependency-preserving.Statement (B) is true: Since 3NF is a stricter form of normalization than 1NF (i.e., every relation in 3NF is also in 1NF), and we can always obtain a dependency-preserving 3NF decomposition, it follows that we can always obtain a dependency-preserving 1NF decomposition.Statement (C) is true: It is a known property of BCNF that a dependency-preserving decomposition is not always possible. For example, consider a relationR(A, B, C)with functional dependencies . The decomposition into BCNF requires splitting based onC → B, which results in relations where the dependencyAB → Ccannot be preserved.Statement (D) is false: Since 3NF implies 2NF, and a dependency-preserving 3NF decomposition is always possible, a dependency-preserving 2NF decomposition is also always possible.32
Q32NAT1 markMediumConsider the function defined as follows:…Think it through. Then check your answer.Question
Consider the function defined as follows:where .If is continuous at , then . (answer in integer)Correct answer
3 to 3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
For the function to be continuous at , the limit as must exist and equal .
Given .Evaluate the limit for :Using the property :Now take the limit:As , and .For this limit to be finite (specifically equal to 3), the term involving infinity must vanish. This implies must be . If , the limit would be .So, .
Then the limit becomes:Since the function is continuous, this limit must equal :We need to find :33
Q33NAT1 markMediumThe height of a binary tree is the number of edges in the longest path from the root to a leaf in the tree. The maximum possible height of a full binary tree with 23 nodes is…Think it through. Then check your answer.Question
The height of a binary tree is the number of edges in the longest path from the root to a leaf in the tree. The maximum possible height of a full binary tree with 23 nodes is _________. (answer in integer)Correct answer
11 to 11
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A full binary tree (also known as a strict or proper binary tree) is a binary tree where every node has either 0 or 2 children.
Let be the number of nodes and be the height (number of edges on the longest path).To maximize the height of a full binary tree with a fixed number of nodes, we should minimize the number of nodes at each level. This results in a skewed structure where each internal node has exactly one leaf child and one internal child (except for the deepest internal node which has two leaf children).For a full binary tree, the relationship between the number of nodes and the maximum height is given by:Given :Thus, the maximum possible height is 11.34
Q34NAT1 markMediumConsider the following program in C: [code] The output of the program is _________. (answer in integer) Note: Assume that the program compiles and runs successfully.Think it through. Then check your answer.Question
Consider the following program in C:The output of the program is _________. (answer in integer)Note: Assume that the program compiles and runs successfully.#include <stdio.h> void func(int i, int j) { if(i < j) { int i = 0; while (i < 10) { j += 2; i++; } } printf("%d", i); } int main() { int i = 9, j = 10; func(i, j); return 0; }Correct answer
9 to 9
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.In themainfunction, the variables and are initialized to 9 and 10, respectively. These values are passed to the functionfunc(i, j).2.Insidefunc(int i, int j), the parameters and are local to the function and receive the values 9 and 10.3.The conditionif(i < j)(i.e., ) evaluates to true.4.Inside theifblock, a new local variableint i = 0is declared. This variable shadows the parameter within the scope of theifblock.5.Thewhileloop increments this shadowed local variable from 0 to 10. The parameter is also updated within this loop, but since it is passed by value, it does not affect the caller's .6.Once theifblock is exited, the shadowed variable goes out of scope and is destroyed.7.Theprintf("%d", i)statement is located outside theifblock but inside the functionfunc. It refers to the parameter , which was never modified and still holds its original value of 9.8.Therefore, the program prints 9.35
Q35NAT1 markMediumConsider a system consisting of instances of a resource , being shared by 5 processes. Assume that each process requires a maximum of two instances of resource and a…Think it through. Then check your answer.Question
Consider a system consisting of instances of a resource , being shared by 5 processes. Assume that each process requires a maximum of two instances of resource and a process can request or release only one instance at a time. Further, a process can request the second instance of the resource only after acquiring the first instance.The minimum value of for the system to be deadlock-free is ________. (answer in integer)Correct answer
6 to 6
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the number of processes and be the maximum requirement of resources for each process.
Given:
The condition for a system to be deadlock-free is that the total number of resources must be at least one greater than the sum of the maximum resources each process can hold without completing.The worst-case scenario for deadlock is when every process holds resources and needs 1 more to proceed.
Maximum resources held in deadlock state = .If the system has 5 resources, each of the 5 processes can hold 1 resource, and none can proceed (deadlock).
To avoid deadlock, we need at least one more resource so that one process can acquire its required 2 instances, finish, and release resources.Minimum
.36
Q36MCQ2 marksMediumConsider the real valued variables and represented using the IEEE 754 single-precision floating-point format. The binary representations of and in hexadecimal…Think it through. Then check your answer.Question
Consider the real valued variables and represented using the IEEE 754 single-precision floating-point format. The binary representations of and in hexadecimal notation are as follows:Let .Which one of the following is the binary representation of , in hexadecimal notation?Correct answer
(C) 35E80000
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the value of , we first decode the IEEE 754 single-precision representations of and .1. Decode (35C00000):- Hexadecimal:
3 5 C 0 0 0 0 0 - Binary:
0011 0101 1100 0000 ... - Sign bit (): (Positive)
- Exponent ():
01101011 - Decimal value:
- Actual exponent ():
- Mantissa ():
1000... - Significand:
- Value of :
- Hexadecimal:
3 4 A 0 0 0 0 0 - Binary:
0011 0100 1010 0000 ... - Sign bit (): (Positive)
- Exponent ():
01101001 - Decimal value:
- Actual exponent ():
- Mantissa ():
0100... - Significand:
- Value of :
- Align the exponents to the larger one ().
- (Shift right by 2 positions)
- Add the significands:
- Result:
- Sign:
- Exponent: Same as (), so biased exponent is (
01101011). - Mantissa:
1101000...(drop the leading 1) - Construct the 32-bit string:
- Sign:
0 - Exponent:
01101011 - Mantissa:
11010000000000000000000 - Combined:
0011 0101 1110 1000 0000 ...
00113010151110E10008- Remaining zeros 0000
- Result: 35E80000
- Hexadecimal:
37
Q37MCQ2 marksMediumConsider a 2-bit saturating up/down counter that performs the saturating up count when the input is 0, and the saturating down count when is 1. The Next State table of the…Think it through. Then check your answer.Question
Consider a 2-bit saturating up/down counter that performs the saturating up count when the input is 0, and the saturating down count when is 1. The Next State table of the counter is as shown. The counter is built as a synchronous sequential circuit using D flip-flops.Which one of the following options corresponds to the expressions for the inputs of the D flip-flops, and ?Input Current State Next State 0 0 0 0 1 0 0 1 1 0 0 1 0 1 1 0 1 1 1 1 1 0 0 0 0 1 0 1 0 0 1 1 0 0 1 1 1 1 1 0 Correct answer
(B) D₁ = P Q₁ + P Q₀ + Q₁ Q₀ D₀ = P Q₀ + P Q₁ + Q₁ Q₀
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the expressions for and , we treat the Next State bits and as the outputs of the combinational logic, with inputs . Since D flip-flops are used, and .For ():
From the table, is 1 for the following input combinations :- Combine and :
- Combine and :
- Combine and :
From the table, is 1 for the following input combinations :- Combine and :
- Combine and :
- Combine and :
38
Q38MCQ2 marksMediumThe size of the physical address space of a processor is bytes. The capacity of a cache memory unit is bytes. The cache block size is 128 bytes. The cache memory…Think it through. Then check your answer.Question
The size of the physical address space of a processor is bytes. The capacity of a cache memory unit is bytes. The cache block size is 128 bytes. The cache memory unit can be built as a direct mapped cache or as a -way set-associative cache, where and . Let the length of the TAG field be bits for the direct mapped cache, and bits for the set-associative cache.Which one of the following options is true?Correct answer
(A) N = M + L
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given:- Physical address space size = bytes Physical Address (PA) = 32 bits.
- Cache capacity = bytes.
- Block size = 128 bytes = bytes Block Offset = 7 bits.
Number of lines (blocks) in cache = .
For Direct Mapped, Number of Sets = Number of Lines = .
Index bits = bits.
Tag bits () = PA - Index - Block Offset
bits.Case 2: -way Set-Associative Cache
.
Number of sets = .
Index bits = bits.
Tag bits () = PA - Index - Block Offset
Relationship between and
Since and , substituting into the equation for gives:
Thus, option (A) is correct.39
Q39MCQ2 marksEasyConsider the following code snippet in C language that computes the number of nodes in a non-empty singly linked list pointed to by the pointer variablehead. [code] Which one…Think it through. Then check your answer.Question
Consider the following code snippet in C language that computes the number of nodes in a non-empty singly linked list pointed to by the pointer variablehead.Which one of the following options gives the correct replacements for the expressions E1 and E2?struct node{ int elt; struct node *next; }; int getListSize (struct node *head) { if( **E1** ) return 1; return **E2**; }Correct answer
(B) E1: head- next == NULL E2: 1 + getListSize(head- next)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The functiongetListSizeis designed to recursively count the number of nodes in a non-empty singly linked list.1.Base Case (E1): For a recursive function counting nodes in a non-empty list, the base case should identify the simplest possible scenario, which is a list with exactly one node. A node is the last node if itsnextpointer isNULL. Thus, the condition E1 should behead->next == NULL. When this is true, the function returns 1, which is the correct count for a single-node list.2.Recursive Step (E2): If the current node is not the last node, the total number of nodes is 1 (for the current node) plus the number of nodes in the remainder of the list. The remainder of the list starts atEvaluating the options:head->next. Therefore, E2 must be1 + getListSize(head->next).- Option (A):
E1: head == NULLwould return 1 for an empty list (incorrect) andE2: 1 + getListSize(head)would cause infinite recursion. - Option (B): Correctly identifies both the base case for a single node and the proper recursive call.
- Option (C):
E1: head == NULLwould return 1 for an empty list. For a 1-node list, it would return , which is incorrect. - Option (D):
E2: 1 + getListSize(head)would cause infinite recursion as it keeps calling itself with the sameheadpointer.
- Option (A):
40
Q40MCQ2 marksHardLet be the set of all integers from 1 to 15. Consider any order of insertion of the elements of into a binary search tree that creates a complete binary tree. Which one of…Think it through. Then check your answer.Question
Let be the set of all integers from 1 to 15. Consider any order of insertion of the elements of into a binary search tree that creates a complete binary tree.Which one of the following elements can NEVER be the third element that is inserted?Correct answer
(D) 5
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A complete binary tree with 15 nodes (values 1 to 15) is a perfect binary tree. The structure and values of the nodes are fixed:- The root is the median, 8.
- The left child of 8 is 4, and the right child of 8 is 12.
- The children of 4 are 2 and 6. The children of 12 are 10 and 14.
- The leaves are 1, 3, 5, 7, 9, 11, 13, 15.
- If the 2nd element is 4, the 3rd element can be 12 (the other child of 8) or a child of 4 (2 or 6).
- If the 2nd element is 12, the 3rd element can be 4 (the other child of 8) or a child of 12 (10 or 14).
(A) 4: Possible (Sequence: 8, 12, 4)
(B) 2: Possible (Sequence: 8, 4, 2)
(C) 10: Possible (Sequence: 8, 12, 10)
(D) 5: 5 is a child of 6 in the perfect tree. To insert 5, 6 must already be present or 5 must be inserted in a way that leads to its correct position. If 5 is the 3rd element (Sequence: 8, , 5):- If : , so 5 goes to the right of 4. In the perfect tree, the right child of 4 is 6. So 5 would occupy 6's spot, which is incorrect.
- If : , so 5 goes to the left of 8. The left child of 8 is 4. So 5 would occupy 4's spot, which is incorrect.
41
Q41MCQ2 marksHardLetG(V, E)be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of a path is the…Think it through. Then check your answer.Question
LetG(V, E)be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of a path is the number of edges in that path.Let be a vertex in . For every and for every , let denote the weight of a shortest path (in terms of weight) from to of length at most . If there is no path from to of length at most , then .Consider the statements:S1: For every and , .S2: For every , if is part of a shortest path (in terms of weight) from to , then for every , .Which one of the following options is correct?Correct answer
(A) Only S1 is true
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement S1: is the minimum weight among all paths from to with length . is the minimum weight among all paths with length . Since the set of paths of length is a subset of the set of paths of length , the minimum over the larger set must be less than or equal to the minimum over the subset. Thus, is always true.Statement S2: This statement claims that if is on a shortest path to , then for all . This is false. Consider a graph where the shortest path from to is . It is possible that is reached via a long path (many edges) with low weight, while has a direct high-weight edge from or a short path with high weight. Counter-example:- Edges: (length 5, weight 10), (length 1, weight 100), (weight 1).
- Shortest path to is (weight ). So is on the shortest path.
- Consider .
- (assuming the path to has length 5).
- (direct edge).
- . Thus S2 is false.
42
Q42MCQ2 marksMediumConsider the control flow graph shown in the figure. [figure] Which one of the following options correctly lists the set of redundant expressions (common subexpressions) in the…Think it through. Then check your answer.Question
Consider the control flow graph shown in the figure.Which one of the following options correctly lists the set of redundant expressions (common subexpressions) in the basic blocks B4 and B5?Note: All the variables are integers.
Correct answer
(D) B4: \ g k \ B5: \ \
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
An expression is redundant (available) at a point if it has been computed on every path reaching that point and its operands have not been modified since the computation.For Block B4:- Predecessors are B2 and B3.
- Expression :
- Computed in B2 (). Operands not modified.
- Computed in B3 (). Operands not modified.
- Available on all paths to B4. Redundant.
- Expression :
- Computed in B1 ().
- Path B1 B2 B4: not modified in B2. Available.
- Path B1 B3 B4: B3 contains . This modifies . Not available.
- Not available on all paths. Not redundant.
- Predecessor is B4.
- Expression :
- Computed in B3 ().
- Path B1 B3 B4 B5: Available.
- Path B1 B2 B4 B5: B2 does not compute . Not available.
- Not available on all paths. Not redundant.
43
Q43MCQ2 marksMediumConsider a relational database schema with two relationsR(P, Q)andS(X, Y). Let…Think it through. Then check your answer.Question
Consider a relational database schema with two relationsR(P, Q)andS(X, Y).Let be a tuple relational calculus expression.Which one of the following relational algebraic expressions is equivalent to ?Correct answer
(B) _P (S _(S.X=R.Q) R)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The tuple relational calculus expression is given by:This expression selects tuples such that there exists a where is in and there exists a where is in .In relationR(P, Q), the tuple is , so and .
In relationS(X, Y), the tuple is , so and .The join condition is on the common value , which corresponds to and . Thus, the join condition is (or ).The result requires the attribute corresponding to , which is (or just since the schema isR(P,Q)).Translating to relational algebra:1.Perform a natural join or equijoin between and on the condition .2.Project the attribute from the result.Expression: or equivalently .Option (B) matches this exactly: .44
Q44MCQ2 marksHardA TCP sender successfully establishes a connection with a TCP receiver and starts the transmission of segments. The TCP congestion control mechanism's slow-start threshold is set…Think it through. Then check your answer.Question
A TCP sender successfully establishes a connection with a TCP receiver and starts the transmission of segments. The TCP congestion control mechanism's slow-start threshold is set to 10000 segments. Assume that the round-trip time is fixed at 1 millisecond. Assume that the sender always has data to send, the segments are numbered from 1, and no segment is lost. Let denote the time (in milliseconds) at which the transmission of segment number 2000 starts.Which one of the following options is correct?Correct answer
(B) 10 ≤ t < 11
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In TCP slow start, the congestion window (cwnd) starts at 1 MSS and doubles every Round Trip Time (RTT) as long as acknowledgments are received and cwnd < ssthresh.Given:- RTT = 1 ms
- ssthresh = 10000
- No losses
- Round 1 ( to ): cwnd = 1. Segments sent: 1. Total sent = 1.
- Round 2 ( to ): cwnd = 2. Segments sent: 2, 3. Total sent = .
- Round 3 ( to ): cwnd = 4. Segments sent: 4 to 7. Total sent = .
- ...
- Round ( to ): cwnd = . Total sent by end of round = .
Let's find the round where the total segments sent reaches or exceeds 2000.Total sent after Round is .- For ( to ): Total sent = .
- For ( to ): Total sent = .
Thus, the transmission of segment 2000 starts at a time such that .45
Q45MCQ2 marksMediumConsider the implementation of sliding window protocol over a lossless link, with a window size of frames, where each frame is of size 1000 bits (including header). The…Think it through. Then check your answer.Question
Consider the implementation of sliding window protocol over a lossless link, with a window size of frames, where each frame is of size 1000 bits (including header). The bandwidth of the link is 100 kbps () and the one-way propagation delay is 100 milliseconds. Assume that processing times at the sender and receiver are zero and the transmission time of acknowledgements is also zero. Which one of the following options gives the minimum size of (in number of frames) required to achieve 100% link utilization?Correct answer
(B) 21
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To achieve 100% link utilization in a sliding window protocol, the sender must be able to transmit frames continuously during the entire Round Trip Time (RTT).Given:- Frame size bits
- Bandwidth
- Propagation delay
2.Calculate Round Trip Time (RTT):Since processing and ACK transmission times are zero:3.Condition for 100% Utilization:The window size must be large enough to fill the pipe during one RTT cycle.Let .The minimum window size required is 21 frames.46
Q46MSQ2 marksHardLet be defined as follows: Which of the following statements is/are…Think it through. Then check your answer.Question
Let be defined as follows:Which of the following statements is/are true?Correct answer
(A) f has a local maximum; (C) f' is continuous over R; (D) f' is not differentiable over R
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We are given the function:Let's analyze the function for and :Case 1:
Case 2:
Continuity of :
At :Since LHS = RHS = , is continuous at and thus over . (Option C is true)Differentiability of :
We check the second derivative :
For , .
For , .
At , the left-hand derivative of is and the right-hand derivative is . Since they are not equal, is not differentiable at . (Option D is true)Local Max/Min:
. For any , . Thus, is a global maximum (and hence a local maximum). (Option A is true, Option B is false)47
Q47MSQ2 marksMediumLetG(V, E)be a simple, undirected graph. A vertex cover of is a subset such that for every , or . Let the size of the…Think it through. Then check your answer.Question
LetG(V, E)be a simple, undirected graph. A vertex cover of is a subset such that for every , or . Let the size of the smallest vertex cover in be . Let be any vertex cover of size .For a vertex , which of the following constraints will always ensure that ?Correct answer
(A) The degree of v is at least k+1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We are given that is the size of the minimum vertex cover of . We want to find a condition on vertex that guarantees belongs to every minimum vertex cover .Consider Option (A): The degree of is at least .
Let be the set of neighbors of . We have .
Suppose, for the sake of contradiction, that there exists a minimum vertex cover (where ) such that .
Since is a vertex cover, for every edge incident to , the other endpoint must be in . That is, all neighbors of must be in .
Therefore, .
This implies .
But we are given that . This is a contradiction ( is false).
Thus, our assumption that must be false. So, must be in .Option (A) is correct.48
Q48MSQ2 marksMediumConsider a Boolean function with the following minterm expression: Which of the following options is/are the…Think it through. Then check your answer.Question
Consider a Boolean function with the following minterm expression:Which of the following options is/are the minimal sum-of-products expression(s) of ?Correct answer
(B) PS + QR + PQR + PRS; (D) PS + QR + PQS + QRS
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We map the minterms to a K-map:Prime Implicants:00 01 11 10 00 0 1 (m1) 1 (m3) 1 (m2) 01 1 (m4) 1 (m5) 1 (m7) 0 11 1 (m12) 1 (m13) 0 1 (m14) 10 0 0 0 1 (m10) 1.Essential: Quad (1, 3, 5, 7)2.Essential: Quad (4, 5, 12, 13)Remaining minterms to cover: m2, m10, m14.Covering remaining minterms:
We need to cover m2 (0010), m10 (1010), and m14 (1110).Option 1 (Matches D):- Group (2, 10)
- Group (12, 14)
- Group (2, 3)
- Group (10, 14)
49
Q49MSQ2 marksMediumLetG(V, E)be a simple, undirected, edge-weighted graph with unique edge weights. Which of the following statements about the minimum spanning trees (MST) of is/are true?Think it through. Then check your answer.Question
LetG(V, E)be a simple, undirected, edge-weighted graph with unique edge weights. Which of the following statements about the minimum spanning trees (MST) of is/are true?Correct answer
(A) In every cycle C of G, the edge with the largest weight in C is not in any MST; (D) For every vertex v ∈ V, the edge with the smallest weight incident on v is in every MST
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
For a simple undirected graph with unique edge weights, the Minimum Spanning Tree (MST) is unique.Statement (A) is True: This is known as the Cycle Property of MSTs. For any cycle in the graph, the edge with the strictly largest weight in cannot be part of any MST. If it were, we could remove it and replace it with any other edge from the cycle to create a spanning tree with a smaller total weight, contradicting the definition of an MST.Statement (B) is False: There is no general property that the smallest edge in a cycle must be in the MST. For example, if the vertices of a cycle are connected by even smaller edges outside of that cycle, the smallest edge within the cycle might still be redundant and excluded from the MST.Statement (C) is False: Consider a graph with only two vertices and connected by a single edge . For vertex , this edge is the largest (and only) incident edge, and it must be in the MST to ensure connectivity.Statement (D) is True: This follows from the Cut Property. For any vertex , the set of edges incident on forms a cut separating from the rest of the graph (). The minimum weight edge crossing any cut must be part of every MST. Here, the minimum weight edge crossing this specific cut is the edge with the smallest weight incident on .50
Q50MSQ2 marksHardConsider the following pseudocode for depth-first search (DFS) algorithm which takes a directed graphG(V, E)as input, where and are the discovery time and…Think it through. Then check your answer.Question
Consider the following pseudocode for depth-first search (DFS) algorithm which takes a directed graphG(V, E)as input, where and are the discovery time and finishing time, respectively, of the vertex .Suppose that the input directed graphDFS(G): unmark all v ∈ V t ← 0 for each v ∈ V if v is unmarked t ← Explore(G, v, t) end if end for Explore(G, v, t): mark v t ← t + 1 d[v] ← t for each (v, w) ∈ E if w is unmarked t ← Explore(G, w, t) end if end for t ← t + 1 f[v] ← t return tG(V, E)is a directed acyclic graph (DAG).
For an edge , which of the following options will NEVER be correct?Correct answer
(B) d[v] < d[u] < f[u] < f[v]; (D) d[u] < d[v] < f[u] < f[v]
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a Depth-First Search (DFS) traversal of a directed graphG(V, E), for any edge , the discovery and finishing times and satisfy the Parenthesis Theorem. This theorem states that for any two vertices and , the intervals and are either entirely disjoint or one is contained within the other. They can never overlap.Let's analyze the options for an edge :1.Tree or Forward Edge: is an ancestor of in the DFS tree. This corresponds to . This is possible in any directed graph, including a DAG. (Option A is possible)2.Back Edge: is an ancestor of in the DFS tree. This corresponds to . A directed graph is a Directed Acyclic Graph (DAG) if and only if it contains no back edges. Since is a DAG, this condition can NEVER be correct for any edge . (Option B is never correct)3.Cross Edge: is finished before is discovered. This corresponds to . This is possible in a DAG. (Option C is possible)4.Overlapping Intervals: implies that was discovered while was active, but finished before . This violates the Parenthesis Theorem and is impossible for any graph traversal by DFS. Thus, it can NEVER be correct. (Option D is never correct)Therefore, both options (B) and (D) will never be correct for a DAG.51
Q51MSQ2 marksHardLet and be two languages over a finite alphabet, such that and are regular languages. Which of the following statements is/are always true?Think it through. Then check your answer.Question
Let and be two languages over a finite alphabet, such that and are regular languages.Which of the following statements is/are always true?Correct answer
(C) L₂ is context-free
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given that is a regular language. The class of regular languages is closed under the complement operation. Therefore, is also a regular language. Since every regular language is a context-free language (Regular CFL), is necessarily context-free. Thus, statement (C) is always true.To see why the other statements are not necessarily true, consider the following counter-example:
Let , which is a regular language.
Let , which is a known non-context-free language (and hence non-regular).
Then:1., which is a regular language. Both conditions of the question are satisfied.2.(A) is regular: False, as is not regular in this case.3.(B) is regular: False, as , which is not regular.4.(D) is context-free: False, as is not context-free.Therefore, only statement (C) is always true.52
Q52MSQ2 marksHardConsider the following context-free grammar . In…Think it through. Then check your answer.Question
Consider the following context-free grammar .In the above grammar, is the start symbol, and are terminal symbols, and and are non-terminal symbols.LetL(G)be the language generated by the grammar . For a string , let be the number of ’s in and be the number of ’s in .Which of the following statements is/are true?Correct answer
(B) For every string s ∈ L(G), n₁(s) ≥ n₂(s); (D) For every string s ∈ L(G), n₁(s) ≤ 2n₂(s)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Analyze : The productions generate the language . For any string , the number of 's () equals the number of 's (). Thus, for some .2.Analyze :- Base case: . For , and . Here, .
- Recursive case: . and . The difference .
- By induction, for any string , . Specifically, , where is the number of recursive steps plus 1.
- .
- .
- Since , it follows that for all . Thus, statement (B) is true.
- . Let . We need .
- . Since grows significantly with each recursive step (adding 's), while only increases by 1, the inequality holds for all derivations. Thus, statement (D) is true.
53
Q53MSQ2 marksMediumConsider the following two syntax-directed definitions SDD1 and SDD2 for type declarations. is the start symbol, and , and are the three terminals. The…Think it through. Then check your answer.Question
Consider the following two syntax-directed definitions SDD1 and SDD2 for type declarations. is the start symbol, and , and are the three terminals. The non-terminal is the same as and the non-terminal is the same as . Here, the subscript is used to differentiate the grammar symbols on the two sides of a production. The function updates the symbol table with the type information for an identifier.Let P and Q be the languages specified by grammars G1 and G2, respectively.Which of the following statements is/are true?SDD1
Grammar (G1) Semantic Rules D → T V
SDD2
Grammar (G2) Semantic Rules
Correct answer
(A) The languages P and Q are the same; (B) SDD2 is S-attributed and contains only synthesized attributes; (D) The specifications of SDD1 and SDD2 are such that the same entries get added to the symbol table
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Language Analysis:- Grammar :
D → T V, . This generates a type followed by a comma-separated list of identifiers: . - Grammar : . This also generates a type followed by a comma-separated list of identifiers: .
- Thus, . Statement (A) is true.
- In SDD2, all attributes (, ) are synthesized. There are no inherited attributes. Therefore, SDD2 is S-attributed. Statement (B) is true.
- In SDD1, is an inherited attribute (passed from to and from to ). However, and are synthesized attributes. Since it contains both synthesized and inherited attributes, statement (C) is false because it claims it contains only inherited attributes.
- For any valid string like
int id1, id2, both SDDs will associate the typeintwith bothid1andid2and call theputfunction accordingly. Thus, the same entries are added to the symbol table. Statement (D) is true.
- Grammar :
54
Q54MSQ2 marksMediumConsider a system that has a cache memory unit and a memory management unit (MMU). The address input to the cache memory is a physical address. The MMU has a translation lookaside…Think it through. Then check your answer.Question
Consider a system that has a cache memory unit and a memory management unit (MMU). The address input to the cache memory is a physical address. The MMU has a translation lookaside buffer (TLB). Assume that when a page is evicted from the main memory, the corresponding blocks in the cache are marked as invalid.For a given memory reference, which of the following sequences of events can NEVER happen?Correct answer
(B) TLB hit, Page table miss, Cache hit; (C) TLB miss, Page table miss, Cache hit
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a system with a physically addressed cache and a TLB, we analyze the sequences based on the given assumptions:1.A TLB hit implies that the virtual-to-physical address translation is found in the TLB. This mapping can only exist if the page is currently resident in main memory (i.e., a Page table hit). Therefore, a TLB hit always implies a Page table hit.2.The problem states: "when a page is evicted from the main memory, the corresponding blocks in the cache are marked as invalid." This means if a page is not in main memory (a Page table miss), then any data belonging to that page cannot be found in the cache in a valid state (i.e., a Cache miss is guaranteed for that data).Let's evaluate each sequence:- A. TLB miss, Page table hit, Cache hit:
- Possible. The virtual-to-physical mapping is not in the TLB (TLB miss), but the page is found in main memory (Page table hit). Since the page is in main memory, its data can be in the cache (Cache hit). This is a common scenario for the first access to a page after a context switch or TLB flush, where the page is already in main memory and its data is in the cache.
- B. TLB hit, Page table miss, Cache hit:
- NEVER happens. A TLB hit implies that the page is in main memory (Page table hit). This directly contradicts the "Page table miss" event in the sequence. Therefore, this sequence is impossible.
- C. TLB miss, Page table miss, Cache hit:
- NEVER happens. A "Page table miss" means the page is not in main memory. According to the problem's assumption, if a page is not in main memory, its corresponding blocks in the cache are marked as invalid. Therefore, a "Cache hit" for data from a page that is not in main memory is impossible.
- D. TLB miss, Page table miss, Cache miss:
- Possible. The virtual-to-physical mapping is not in the TLB (TLB miss). The page is not in main memory (Page table miss), leading to a page fault. Consistent with the page not being in main memory, the data is also not found in the cache (Cache miss). This is a standard scenario for accessing a page that is not currently resident in main memory.
55
Q55MSQ2 marksMediumAn undirected, unweighted, simple graphG(V, E)is said to be 2-colorable if there exists a function such that for every .…Think it through. Then check your answer.Question
An undirected, unweighted, simple graphG(V, E)is said to be 2-colorable if there exists a function such that for every .Which of the following statements about 2-colorable graphs is/are true?Correct answer
(B) If G is 2-colorable, then G may contain cycles of even length; (C) An optimal algorithm for testing whether G is 2-colorable runs in time Θ(V + E), if G is represented as an adjacency list
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A graph is 2-colorable if and only if it is bipartite.1.Statement (A): A fundamental theorem in graph theory states that a graph is bipartite if and only if it contains no odd cycles. Therefore, a 2-colorable graph cannot contain cycles of odd length. Statement (A) is false.2.Statement (B): Bipartite graphs can certainly contain even cycles (for example, a cycle of length 4 is bipartite). Statement (B) is true.3.Statement (C): Testing whether a graph is 2-colorable (bipartite) can be done using a graph traversal algorithm like Breadth-First Search (BFS) or Depth-First Search (DFS). In an adjacency list representation, these algorithms visit every vertex and edge once, leading to a time complexity of . This is optimal because any algorithm must at least inspect every vertex and edge. Statement (C) is true.4.Statement (D): While an algorithm with complexity might exist, it is not the optimal time complexity because a linear time algorithm exists. Statement (D) is false.56
Q56MSQ2 marksMediumAn ISP having an address block assigns a block of 6000 IP addresses to a client, using the classless internet domain routing (CIDR) super-netting approach. Which…Think it through. Then check your answer.Question
An ISP having an address block assigns a block of 6000 IP addresses to a client, using the classless internet domain routing (CIDR) super-netting approach. Which of the following address blocks can be assigned by the ISP?Correct answer
(A) 202.16.0.0/19; (B) 202.17.64.0/19; (C) 202.16.32.0/19
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Determine the ISP's address range:The ISP has the block .- The prefix length is 15 bits.
- The second octet (16) in binary is .
- The first 15 bits are fixed:
- The 16th bit can be 0 or 1, meaning the second octet can be () or ().
- The range of addresses is from to .
The client needs 6000 IP addresses.- The smallest power of 2 that can accommodate 6000 addresses is .
- A block of addresses has a prefix length of .
- Therefore, the client must be assigned a block.
For a block, the starting address must have the last 13 bits as zero.- Last 13 bits = 8 bits of the 4th octet + 5 bits of the 3rd octet.
- This implies the 3rd octet must be a multiple of (i.e., 0, 32, 64, 96, 128, 160, 192, 224).
- The 2nd octet must be either 16 or 17 to stay within the ISP's range.
- (A) : 2nd octet is 16, 3rd octet is 0 (multiple of 32). Valid.
- (B) : 2nd octet is 17, 3rd octet is 64 (multiple of 32). Valid.
- (C) : 2nd octet is 16, 3rd octet is 32 (multiple of 32). Valid.
- (D) : 3rd octet is 24, which is not a multiple of 32. Invalid.
57
Q57NAT2 marksMediumLet be an undirected graph, which is a path on 8 vertices. The number of matchings in is ______. (answer in integer)Think it through. Then check your answer.Question
Let be an undirected graph, which is a path on 8 vertices. The number of matchings in is ______. (answer in integer)Correct answer
34 to 34
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The number of matchings in a path graph (a graph with vertices and edges) can be determined using a recurrence relation. Let be the number of matchings in a path with vertices.Step 1: Base Cases- For (1 vertex, 0 edges): The only matching is the empty set . Thus, .
- For (2 vertices, 1 edge ): The matchings are and . Thus, .
Consider a path with vertices and edges where . A matching either contains the last edge or it does not.- Case 1: . In this case, must be a matching of the path formed by the first vertices. There are such matchings.
- Case 2: . If is in the matching, then the edge cannot be in because it shares vertex with . The remaining edges must form a matching of the path formed by the first vertices. There are such matchings.
Starting from the base cases, we compute the sequence (which is the Fibonacci sequence shifted):58
Q58NAT2 marksEasyLet be a random variable which takes values in the set . Further, and…Think it through. Then check your answer.Question
Let be a random variable which takes values in the set .
Further, and
.The expected value of , denoted by , is equal to ___________. (rounded off to two decimal places)Correct answer
4.24 to 4.26
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The expected value of a discrete random variable is calculated as the weighted average of all possible values, where the weights are the probabilities of those values:Given the values and their probabilities:- For ,
- For ,
59
Q59NAT2 marksHardConsider a hard disk with a rotational speed of rpm. The time to move the read/write head from a track to its adjacent track is millisecond. Initially, the head is on…Think it through. Then check your answer.Question
Consider a hard disk with a rotational speed of rpm. The time to move the read/write head from a track to its adjacent track is millisecond. Initially, the head is on track . The number of sectors per track is . The sector size is bytes. It is necessary to transfer data from randomly located sectors in each of the following tracks in the order: and .The total time for the data transfer (in milliseconds) from the hard disk is _________.
(rounded off to one decimal place)Correct answer
77.3 to 77.3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To calculate the total time for data transfer, we need to sum the seek time, rotational latency, and transfer time for all requested sectors.1. Rotational Parameters:- Rotational speed () = rpm = rotations per second.
- Time for one full rotation () = s = ms.
- Average rotational latency () = ms.
- Transfer time for one sector () = ms.
The head moves in the order: Track .- Seek to : ms = ms.
- Seek to : ms = ms.
- Seek to : ms = ms.
- Total Seek Time () = ms.
There are sectors in each of the tracks, totaling sectors. Since they are "randomly located", each sector access is treated as an independent request requiring an average rotational latency.- Total sectors = .
- Time per sector access = ms.
- Total access time = ms.
Total Time = ms.60
Q60NAT2 marksHardThe EX stage of a pipelined processor performs the memory read operations for LOAD instructions, and the operations for the arithmetic and logic instructions. Let denote…Think it through. Then check your answer.Question
The EX stage of a pipelined processor performs the memory read operations for LOAD instructions, and the operations for the arithmetic and logic instructions. Let denote the time taken by the EX stage to perform the operation for an instruction. For each instruction type, the values of and (the number of instructions of that type in a sequence of 100 instructions for a program P), are given in the table below.The duration of the pipeline clock cycle is 1 nanosecond. Assume that the latch time for the interstage buffers in the pipeline is negligible. When program P is executed, the number of clock cycles for which the pipeline is stalled due to structural hazards in the EX stage is ______. (answer in integer)Instruction in nanoseconds LOAD 1.8 15 IMUL 1.5 10 IDIV 2.5 5 FADD 1.7 10 FSUB 1.7 5 FMUL 2.8 15 FDIV 3.2 5 All other instructions Less than 1.0 35 Correct answer
95 to 95
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given:- Clock cycle time () = 1 ns.
- An instruction with execution time will occupy the EX stage for clock cycles.
- If an instruction occupies the EX stage for cycles, it causes stall cycles for subsequent instructions due to the structural hazard in the EX stage (assuming a single non-pipelined execution unit for the EX stage).
1.LOAD: ns, . Cycles = . Stalls = .2.IMUL: ns, . Cycles = . Stalls = .3.IDIV: ns, . Cycles = . Stalls = .4.FADD: ns, . Cycles = . Stalls = .5.FSUB: ns, . Cycles = . Stalls = .6.FMUL: ns, . Cycles = . Stalls = .7.FDIV: ns, . Cycles = . Stalls = .8.All other instructions: ns, . Cycles = 1. Stalls = .Total stall cycles = .61
Q61NAT2 marksHardConsider the recursive functions represented by the following code segment: [code] The smallest positive integer for whichfoo(n)returns 5 is ______. (answer in integer)…Think it through. Then check your answer.Question
Consider the recursive functions represented by the following code segment:The smallest positive integer for whichint bar(int n){ if (n == 1) return 0; else return 1 + bar(n/2); } int foo(int n){ if (n == 1) return 1; else return 1 + foo(bar(n)); }foo(n)returns 5 is ______. (answer in integer)Note: Ignore syntax errors (if any) in the function.Correct answer
65536 to 65536
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The functionbar(n)calculates the floor of the base-2 logarithm of , i.e., .The functionfoo(n)is defined recursively as:- for
1.2.Let .3.Let .4.Let .Since , we need .To find the smallest , we find the smallest possible value at each step:- Smallest such that .
- Smallest such that .
- Smallest such that .
- Smallest such that .
62
Q62NAT2 marksMediumThe following sequence corresponds to the preorder traversal of a binary search tree : 50, 25, 13, 40, 30, 47, 75, 60, 70, 80, 77 The position of the element 60 in the…Think it through. Then check your answer.Question
The following sequence corresponds to the preorder traversal of a binary search tree :50, 25, 13, 40, 30, 47, 75, 60, 70, 80, 77The position of the element 60 in the postorder traversal of is ______. (answer in integer)Note: The position begins with 1.Correct answer
7 to 7
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the postorder traversal from the preorder traversal of a Binary Search Tree (BST):1.Identify the Inorder Traversal: The inorder traversal of a BST is the elements of the preorder traversal sorted in ascending order.Preorder:
Inorder:2.Construct the BST:- The first element in preorder is the root: 50.
- Elements smaller than 50 are in the left subtree: .
- Elements larger than 50 are in the right subtree: .
- Left of 25:
- Right of 25: (Root 40)
- Left of 40:
- Right of 40:
- Left of 75: (Root 60)
- Right of 60:
- Right of 75: (Root 80)
- Left of 80:
- Postorder of Left Subtree:
- Postorder of Right Subtree:
- Full Postorder:
- 1st: 13
- 2nd: 30
- 3rd: 47
- 4th: 40
- 5th: 25
- 6th: 70
- 7th: 60
63
Q63NAT2 marksMediumConsider the following program snippet. Assume that the program compiles and runs successfully. Further, assume that thefork()system call is always successful in creating a…Think it through. Then check your answer.Question
Consider the following program snippet. Assume that the program compiles and runs successfully. Further, assume that thefork()system call is always successful in creating a process.The total number of times that theint main () { int i; for (i = 0; i < 3; i++){ if (fork() == 0){ continue; } break; } printf("Hello!"); return 0; }printfstatement gets executed is ________. (answer in integer)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 program uses aforloop that iterates for . Inside the loop, afork()system call is made.1.Initial State: We start with one process, let's call it .2.Iteration : callsfork(), creating a child process .- In the parent ,
fork()returns the PID of (non-zero). Theifcondition is false, so it executesbreak, exits the loop, and prints "Hello!". - In the child ,
fork()returns . Theifcondition is true, so it executescontinueand moves to the next iteration ().
fork(), creating a child process .- In the parent ,
fork()returns non-zero. It executesbreak, exits the loop, and prints "Hello!". - In the child ,
fork()returns . It executescontinueand moves to the next iteration ().
fork(), creating a child process .- In the parent ,
fork()returns non-zero. It executesbreak, exits the loop, and prints "Hello!". - In the child ,
fork()returns . It executescontinueand moves to the next iteration ().
printfstatement exactly once. Thus, the total number of executions is .- In the parent ,
64
Q64NAT2 marksMediumConsider a CPU that has to execute two types of processes. The first type, Actuators (A), requires a CPU burst of 6 seconds. The second type, Controllers (C), requires a CPU burst…Think it through. Then check your answer.Question
Consider a CPU that has to execute two types of processes. The first type, Actuators (A), requires a CPU burst of 6 seconds. The second type, Controllers (C), requires a CPU burst of 8 seconds. A new process of type A arrives at time (in seconds). Similarly, a new process of type C arrives at time (in seconds). The CPU scheduling policy is First Come First Serve (FCFS). The first process of type A starts running at seconds. The average waiting time (in seconds) for the 10 processes is ___________. (rounded off to one decimal place)Correct answer
9.5 to 9.5
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The scheduling policy is First Come First Serve (FCFS). We list the processes in order of their arrival times and calculate their start, end, and waiting times.Total Waiting Time = seconds.Average Waiting Time = seconds.Process Arrival Time () Burst Time (s) Start Time End Time Waiting Time (Start - Arrival) 10 6 10 16 11 8 16 24 20 6 24 30 22 8 30 38 30 6 38 44 33 8 44 52 40 6 52 58 44 8 58 66 50 6 66 72 55 8 72 80 65
Q65NAT2 marksMediumConsider a relational database schema with a relationR(A, B, C, D). If and are the only two candidate keys of the relation , then the number of…Think it through. Then check your answer.Question
Consider a relational database schema with a relationR(A, B, C, D). If and are the only two candidate keys of the relation , then the number of superkeys of relation is ______.
(answer in integer)Correct answer
6 to 6
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given a relationR(A, B, C, D)with attributes and candidate keys and .A superkey is a set of attributes that contains at least one candidate key.1.Let be the set of superkeys containing . The remaining attributes are . The number of superkeys is .These are: .2.Let be the set of superkeys containing . The remaining attributes are . The number of superkeys is .These are: .3.To find the total number of unique superkeys, we use the principle of inclusion-exclusion: .4.The intersection consists of superkeys that contain both and , which means they must contain . The remaining attribute is . The number of such superkeys is .These are: .Total number of superkeys .