The sentence requires three different words to be grammatically correct. The first blank needs a subject and verb, which "They're" (a contraction of "they are") provides. The second blank describes possession of the "books," so the possessive pronoun "their" is appropriate. The third blank indicates a location from which the books are brought, requiring the adverb of place "there."
Q2GATE 0MCQ1MGeneral Aptitude
A ________ investigation can sometimes yield new facts, but typically organized ones are more successful. The word that best fills the blank in the above sentence is
The sentence structure uses the word "but" to create a contrast. The phrase "organized ones are more successful" implies that the word in the blank should describe a type of investigation that is the opposite of organized. "Meandering" means proceeding in a winding or aimless way, which provides the necessary contrast to "organized."
Q3GATE 0MCQ1MGeneral Aptitude
The area of a square is d . What is the area of the circle which has the diagonal of the square as its diameter?
Let the side of the square be a. The area of the square is d=a2. The diagonal of the square is a2+a2=a2. This diagonal is the diameter of the circle. Therefore, the radius of the circle is r=2a2. The area of the circle is πr2=π(2a2)2=π42a2=2πa2. Since d=a2, the circle's area is 2πd.
Q4GATE 0MCQ1MGeneral Aptitude
What would be the smallest natural number which when divided either by 20 or by 42 or by 76 leaves a remainder of 7 in each case?
The problem requires finding a number N of the form N=LCM(20,42,76)+7. First, we find the Least Common Multiple (LCM) of the three numbers.
The prime factorizations are: 20=22×5 42=2×3×7 76=22×19
The LCM is 22×3×5×7×19=7980.
The smallest such number is the LCM plus the remainder: 7980+7=7987.
Q5GATE 0MCQ1MGeneral Aptitude
What is the missing number in the following sequence? 2, 12, 60, 240, 720, 1440, _____ ,0
The pattern in the sequence involves multiplying each term by a decreasing integer to get the next term. 2×6=12 12×5=60 60×4=240 240×3=720 720×2=1440
Following this pattern, the next term is 1440×1=1440. The final term is then 1440×0=0, which matches the given sequence.
Q6GATE 0MCQ2MGeneral Aptitude
In appreciation of the social improvements completed in a town, a wealthy philanthropist decided to gift Rs. 750 to each male senior citizen in the town and Rs. 1000 to each female senior citizen. Altogether, there were 300 senior citizens eligible for this gift. However, only 98th of the eligible men and 32rd of the eligible women claimed the gift. How much money (in Rupees) did the philanthropist give away in total?
Let x be the number of eligible male senior citizens. Then, the number of eligible female senior citizens is 300−x.
The number of men who claimed the gift is 98x, and the amount they received is 98x×750.
The number of women who claimed the gift is 32(300−x), and the amount they received is 32(300−x)×1000.
The total amount given away is the sum of these two amounts: Total Amount=(98x×750)+(32(300−x)×1000) =96000x+32000(300−x) =32000x+200000−32000x=200,000
The total amount given away was Rs. 2,00,000.
Q7GATE 0MCQ2MGeneral Aptitude
If pqr=0 and p−x=q1,q−y=r1,r−z=p1, what is the value of the product xyz ?
The given equations can be rewritten using the property a−n=1/an.
The first equation, p−x=1/q, is equivalent to px=q.
The second equation, q−y=1/r, is equivalent to qy=r.
The third equation, r−z=1/p, is equivalent to rz=p.
Now, we can use substitution. Start with p=rz.
Substitute r=qy into this equation: p=(qy)z=qyz.
Next, substitute q=px into the result: p=(px)yz=pxyz.
Since p1=pxyz, we can equate the exponents, which gives xyz=1.
Q8GATE 0MCQ2MGeneral Aptitude
In a party, 60% of the invited guests are male and 40% are female. If 80% of the invited guests attended the party and if all the invited female guests attended, what would be the ratio of males to females among the attendees in the party?
Let's assume there are 100 invited guests in total.
Based on the given percentages, the number of invited males is 0.60×100=60, and the number of invited females is 0.40×100=40.
The total number of guests who attended the party is 80% of the invited guests, which is 0.80×100=80.
It is stated that all invited female guests attended, so there were 40 female attendees.
The number of male attendees is the total number of attendees minus the female attendees: 80−40=40.
The ratio of males to females among the attendees is therefore 40:40, which simplifies to 1:1.
The solution is derived by considering the sum of angles in triangles and the quadrilateral in the figure.
The sum of angles in any triangle is 180∘, and the sum of interior angles in the quadrilateral ABCD is 360∘.
By establishing relationships between the angles of the triangles (e.g., △AEB and △FDC from the diagram) and the angles of the quadrilateral ABCD, a final expression can be derived.
The derivation shown in the solution booklet, despite some ambiguity in notation, combines these geometric facts to conclude that ∠E+∠F=∠C−∠A.
This translates to ∠DEC+∠BFC=∠BCD−∠BAD.
Q10GATE 0MCQ2MGeneral Aptitude
A six sided unbiased die with four green faces and two red faces is rolled seven times. Which of the following combinations is the most likely outcome of the experiment?
First, we find the probabilities for each outcome on a single roll. The die has 4 green faces and 2 red faces.
The probability of rolling a green face is P(G)=64=32.
The probability of rolling a red face is P(R)=62=31.
For 7 rolls, the expected number of green faces is E(G)=n×P(G)=7×32=314≈4.67.
The expected number of red faces is E(R)=n×P(R)=7×31=37≈2.33.
The most likely outcome is the integer combination of outcomes that is closest to these expected values. The combination of 5 green faces and 2 red faces is the closest to the expected values of 4.67 and 2.33.
CSE55 questions
Q11GATE 0MCQ1MEngineering Mathematics
Which one of the following is a closed form expression for the generating function of the sequence {an} , where an=2n+3 for all n = 0, 1, 2,...?
The generating function for a sequence {an} is given by G(x)=∑n=0∞anxn.
For an=2n+3, the function is G(x)=∑n=0∞(2n+3)xn.
This can be split into two parts: G(x)=2∑n=0∞nxn+3∑n=0∞xn
Using the standard closed-form expressions for these series: ∑n=0∞xn=1−x1 and ∑n=0∞nxn=(1−x)2x
Substituting these back gives: G(x)=2((1−x)2x)+3(1−x1)=(1−x)22x+3(1−x)=(1−x)23−x
Q12GATE 0MCQ1MC Programming
Consider the following C program. #include < stdio.h > struct Ournode{ char x,y,z; };
In the structure initialization, p.z is assigned 'a' + 2. In ASCII, this operation results in the character 'c'. The structure p in memory will contain the bytes '1', '0', 'c' contiguously.
The pointer q points to the base address of p. The printf statement casts q to a character pointer, (char*)q.
*((char*)q + 1): This expression accesses the second byte of the structure, which is the member y, holding the value '0'.
*((char*)q + 2): This expression accesses the third byte, which is the member z, holding the value 'c'.
Thus, the program prints the characters '0' and 'c'.
Q13GATE 0MCQ1MData Structure
A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let n denote the number of nodes in the queue. Let enqueue be implemented by inserting a new node at the head, and dequeue be implemented by deletion of a node from the tail. Which one of the following is the time complexity of the most time-efficient implementation of enqueue and dequeue, respectively, for this data structure?
The enqueue operation is implemented by inserting a new node at the head of the singly linked list. This involves creating a new node, setting its next pointer to the current head, and then updating the head pointer to the new node. These are all constant-time operations, so the complexity is Θ(1).
The dequeue operation is implemented by deleting a node from the tail. In a singly linked list, to remove the tail node, one must update the next pointer of the second-to-last node to NULL. Finding this predecessor node requires traversing the entire list from the head, which takes time proportional to the number of nodes, n. Therefore, the complexity is Θ(n).
Q14GATE 0MCQ1MDigital Logic
Let ⨁ and ⨀ denote the Exclusive OR and Exclusive NOR operations, respectively. Which one of the following is NOT CORRECT?
Let's analyze the expression in option D: (P⨁P)⨁Q=(P⨀P)⨀Q.
First, evaluate the Left Hand Side (LHS):
The expression P⨁P is always true, evaluating to 1.
So, the LHS becomes 1⨁Q. By the definition of XOR, 1⨁Q=(1⋅Q)+(1⋅Q)=Q.
Next, evaluate the Right Hand Side (RHS):
The expression P⨀P is always false, evaluating to 0.
So, the RHS becomes 0⨀Q. By the definition of XNOR, 0⨀Q=(0⋅Q)+(0⋅Q)=1⋅Q=Q.
The statement thus simplifies to Q=Q, which is not a valid Boolean identity. Therefore, this statement is not correct.
Q15GATE 0MCQ1MComputer Organization
Consider the following processor design characteristics. I. Register-to-register arithmetic operations only II. Fixed-length instruction format III. Hardwired control unit Which of the characteristics above are used in the design of a RISC processor?
The design of a RISC (Reduced Instruction Set Computer) processor is based on several key characteristics aimed at simplifying hardware and enabling high performance through pipelining.
I. Register-to-register arithmetic operations only: This is a core concept of the load/store architecture used by RISC. Data must be loaded from memory into registers before arithmetic operations can be performed, and results are stored back to memory.
II. Fixed-length instruction format: This simplifies the instruction decoding process, allowing for faster and simpler control logic.
III. Hardwired control unit: RISC processors use a hardwired control unit, which is faster than the microprogrammed control units typically found in CISC processors.
All three listed characteristics are fundamental design principles of RISC processors.
Q16GATE 0MCQ1MTheory of Computation
Let N be an NFA with n states. Let k be the number of states of a minimal DFA which is equivalent to N. Which one of the following is necessarily true?
An NFA with n states can be converted to an equivalent DFA using the subset construction method. In this method, each state of the DFA corresponds to a subset of the states of the NFA. Since a set with n elements has 2n possible subsets, the maximum number of states in the equivalent DFA is 2n. Therefore, the number of states, k, in the minimal DFA must be less than or equal to this upper bound, i.e., k≤2n.
Q17GATE 0MCQ1MTheory of Computation
The set of all recursively enumerable languages is
Recursively enumerable (RE) languages are closed under operations like union and intersection. However, they are not closed under complementation. The set of recursive languages is a proper subset of the set of RE languages. Furthermore, the set of all RE languages is countably infinite because they can be enumerated by Turing machines, and the set of all Turing machines is countable.
The statement that type checking is done before parsing is false. In the compilation process, parsing (syntax analysis) occurs before semantic analysis. Type checking is a key part of the semantic analysis phase. The other statements are true: context-free grammars can specify lexical rules (as regular languages are a subset of context-free languages), high-level programs can be translated into various intermediate forms, and the program stack is used for passing function arguments.
Q19GATE 0MCQ1MComputer Organization
The following are some events that occur after a device controller issues an interrupt while process L is under execution. (P) The processor pushes the process status of L onto the control stack. (Q) The processor finishes the execution of the current instruction. (R) The processor executes the interrupt service routine. (S) The processor pops the process status of L from the control stack. (T) The processor loads the new PC value based on the interrupt. Which one of the following is the correct order in which the events above occur?
When a device interrupt occurs, the processor first completes the current instruction (Q). Then, it saves the context of the running process L by pushing its status onto the control stack (P). Next, the processor loads the program counter with the starting address of the interrupt service routine (ISR) from the interrupt vector table (T). The ISR is then executed (R). After the ISR completes, the saved process status is popped from the stack to resume process L (S). The correct sequence of events is QPTRS.
Q20GATE 0MCQ1MOperating System
Consider a process executing on an operating system that uses demand paging. The average time for a memory access in the system is M units if the corresponding memory page is available in memory, and D units if the memory access causes a page fault. It has been experimentally measured that the average time taken for a memory access in the process is X units. Which one of the following is the correct expression for the page fault rate experienced by the process?
The effective memory access time, X, is a weighted average of access time with and without a page fault. Let P be the page fault rate. The formula is X=P×D+(1−P)×M, where D is the time for a page fault and M is the normal memory access time. To find the page fault rate P, we can rearrange the equation: X=PD+M−PM X−M=P(D−M) P=D−MX−M
Q21GATE 0MCQ1MDatabase Management System
In an Entity-Relationship (ER) model, suppose R is a many-to-one relationship from entity set E1 to entity set E2. Assume that E1 and E2 participate totally in R and that the cardinality of E1 is greater than the cardinality of E2. Which one of the following is true about R?
The relationship from entity set E1 to E2 is many-to-one. This implies that any entity in E1 can be associated with at most one entity in E2. Additionally, the problem states that E1 has total participation in the relationship R. This means every entity in E1 must be part of the relationship. Combining these two conditions, it follows that every entity in E1 must be associated with exactly one entity in E2.
Q22GATE 0MCQ1MDatabase Management System
Consider the following two tables and four queries in SQL. Which one of the queries above is certain to have an output that is a superset of the outputs of the other three queries?
A FULL OUTER JOIN returns all rows from both tables, including matched rows and unmatched rows from each table. An INNER JOIN returns only matched rows. A LEFT OUTER JOIN returns all rows from the left table and matched rows from the right. A RIGHT OUTER JOIN does the opposite. By definition, the result of a FULL OUTER JOIN contains all rows from the INNER, LEFT, and RIGHT joins. Therefore, its output is always a superset of the other three.
The standard lengths in bits for the given protocol header fields are as follows:
Q. Ethernet MAC Address: 48 bits (I)
S. TCP Header's Sequence Number: 32 bits (III)
P. UDP Header's Port Number: 16 bits (IV)
R. IPv6 Next Header: 8 bits (II)
Therefore, the correct matching is P-IV, Q-I, R-II, S-III.
Q24GATE 0MCQ1MComputer Network
Consider the following statements regarding the slow start phase of the TCP congestion control algorithm. Note that cwnd stands for the TCP congestion window and MSS denotes the Maximum Segment Size. (i) The cwnd increases by 2 MSS on every successful acknowledgment. (ii) The cwnd approximately doubles on every successful acknowledgement. (iii) The cwnd increases by 1 MSS every round trip time. (iv) The cwnd approximately doubles every round trip time. Which one of the following is correct?
During the TCP slow start phase, the congestion window (cwnd) grows exponentially. For each successful acknowledgment received, the sender increases the cwnd by one Maximum Segment Size (MSS). Since an entire window of segments is acknowledged within one Round Trip Time (RTT), this mechanism causes the cwnd to approximately double every RTT. Thus, statement (iv) is the correct description of the window growth in this phase.
Q25GATE 0NAT1MDiscrete Mathematics
Two people, P and Q, decide to independently roll two identical dice, each with 6 faces, numbered 1 to 6. The person with the lower number wins. In case of a tie, they roll the dice repeatedly until there is no tie. Define a trial as a throw of the dice by P and Q. Assume that all 6 numbers on each dice are equi-probable and that all trials are independent. The probability (rounded to 3 decimal places) that one of them wins on the third trial is
For a winner to be decided on the third trial, the first two trials must result in a tie, and the third trial must not be a tie. The total number of outcomes when rolling two dice is 6×6=36. A tie occurs if both people roll the same number, which can happen in 6 ways (1-1, 2-2, etc.).
The probability of a tie is P(tie)=366.
The probability of no tie is P(no tie)=1−366=3630.
The probability of two ties followed by a non-tie is P(tie)×P(tie)×P(no tie)=366×366×3630≈0.023.
Q26GATE 0NAT1MEngineering Mathematics
The value of ∫04πxcos(x2)dx correct to three decimal places (assuming that π = 3.14 ) is
To evaluate the integral, we use the substitution method. Let t=x2. This implies that dt=2xdx, or xdx=2dt. We must also change the limits of integration. When x=0, t=0. When x=4π, t=(4π)2=16π2.
The integral transforms to: I=∫0π2/16cos(t)2dt=21[sin(t)]0π2/16 I=21(sin(16π2)−sin(0))
Using π≈3.14, we get 16π2≈0.616. I≈21sin(0.616)≈0.29
Q27GATE 0NAT1MEngineering Mathematics
Consider a matrix
A=uvTwhereu=[12],v=[11]
Note that vT denotes the transpose of v. The largest eigenvalue of A is _____.
First, we compute the matrix A from the given vectors u and v. A=uvT=[12][11]=[1212]
The eigenvalues λ are found using the characteristic equation λ2−trace(A)λ+det(A)=0.
The trace of A is the sum of the diagonal elements: trace(A)=1+2=3.
The determinant of A is: det(A)=(1)(2)−(1)(2)=0.
Substituting these values into the characteristic equation gives: λ2−3λ+0=0 λ(λ−3)=0
The eigenvalues are λ=0 and λ=3. The largest eigenvalue is 3.
Q28GATE 0NAT1MDiscrete Mathematics
The chromatic number of the following graph is _______.
The chromatic number of a graph is the minimum number of colors needed to color its vertices so that no two adjacent vertices share the same color.
First, we observe that the vertices {b, c, d} form a triangle, which is a clique of size 3. Therefore, at least 3 colors are required, and the chromatic number χ(G)≥3.
Next, we check if the graph can be colored with 3 colors. A possible 3-coloring is:
Color 1 (e.g., Blue): {a, f}
Color 2 (e.g., Green): {b, e}
Color 3 (e.g., White): {c, d}
Since a valid 3-coloring exists, χ(G)≤3.
Combining both conditions, the chromatic number is exactly 3.
Q29GATE 0NAT1MDiscrete Mathematics
Let G be a finite group on 84 elements. The size of a largest possible proper subgroup of G is ________.
According to Lagrange's theorem, the order (number of elements) of any subgroup of a finite group must be a divisor of the order of the group. The order of the group G is 84.
The divisors of 84 are 1, 2, 3, 4, 6, 7, 12, 14, 21, 28, 42, and 84.
A "proper" subgroup is any subgroup of G except G itself. Therefore, the order of a proper subgroup must be a divisor of 84 that is strictly less than 84. The largest such divisor is 42.
Q30GATE 0NAT1MData Structure
The postorder traversal of a binary tree is 8,9,6,7,4,5,2,3,1. The inorder traversal of the same tree is 8,6,9,4,7,2,5,1,3. The height of a tree is the length of the longest path from the root to any leaf. The height of the binary tree above is ______.
To find the height of the tree, we first need to construct it from its inorder and postorder traversals.
Postorder: 8, 9, 6, 7, 4, 5, 2, 3, 1
Inorder: 8, 6, 9, 4, 7, 2, 5, 1, 3
The last element in the postorder traversal is the root, so the root is 1. In the inorder traversal, all elements to the left of 1 belong to the left subtree, and all elements to the right belong to the right subtree. This process is applied recursively to build the entire tree, as shown in the PDF.
The constructed tree has the root 1. The longest path from the root to a leaf is 1 → 2 → 4 → 6 → 8. The length of this path is the number of edges, which is 4. Therefore, the height of the tree is 4.
Q31GATE 0NAT1MC Programming
Consider the following C program: #include < stdio.h > int counter = 0;
int calc (int a, int b) {
int c;
counter++;
if (b==3) return (a*a*a);
else {
c = calc(a, b/3);
return (c*c*c);
}
}
int main () {
calc(4, 81);
printf ("%d", counter);
}
The C program calculates a value recursively and prints the final count of function calls. The global variable counter is incremented each time the calc function is entered.
The initial call is calc(4, 81). The function calls itself with b divided by 3 until b equals 3.
calc(4, 3): counter becomes 4. The base case b==3 is met, and the function returns.
The main function then prints the final value of counter, which is 4.
Q32GATE 0NAT1MDigital Logic
Consider the sequential circuit shown in the figure, where both flip-flops used are positive edge-triggered D flip-flops. The number of states in the state transition diagram of this circuit that have a transition back to the same state on some value of "in" is _____.
The state of the circuit is determined by the outputs of the two flip-flops, (Q1, Q0). The inputs to the flip-flops are D1 = in and D0 = Q1. The next state (Q1+, Q0+) is (D1, D0).
We can create a state transition table:
When in = 0: The next state is (0, Q1).
From state (00), Q1=0, next state is (0,0). This is a self-loop.
From state (01), Q1=0, next state is (0,0).
When in = 1: The next state is (1, Q1).
From state (10), Q1=1, next state is (1,1).
From state (11), Q1=1, next state is (1,1). This is a self-loop.
The states (00) and (11) have transitions back to themselves for inputs 0 and 1, respectively. Thus, there are 2 such states.
Q33GATE 0NAT1MComputer Organization
A 32-bit wide main memory unit with a capacity of 1 GB is built using 256M x 4-bit DRAM chips. The number of rows of memory cells in the DRAM chip is 214 . The time taken to perform one refresh operation is 50 nanoseconds. The refresh period is 2 milliseconds. The percentage (rounded to the closest integer) of the time available for performing the memory read/write operations in the main memory unit is __________.
First, calculate the total time required to refresh all rows in a DRAM chip.
Number of rows = 214.
Time to refresh one row = 50 ns.
Total refresh time = 214×50 ns=16384×50×10−9 s=0.8192 ms.
This entire refresh operation must be completed within the refresh period of 2 ms. The percentage of time spent on refreshing (overhead) is:
Refresh Overhead = Refresh periodTotal refresh time×100=2 ms0.8192 ms×100=40.96%.
The percentage of time available for read/write operations is the remaining time:
Available Time % = 100%−40.96%=59.04%.
Rounded to the closest integer, this is 59%.
Q34GATE 0NAT1MOperating System
Consider a system with 3 processes that share 4 instances of the same resource type. Each process can request a maximum of K instances. Resource instances can be requested and released only one at a time. The largest value of K that will always avoid deadlock is ____.
To always avoid deadlock, a system must be in a safe state. A safe state is guaranteed if the sum of maximum resource needs of all processes is less than the sum of the total number of processes and total resources.
Let n be the number of processes (3), m be the number of resources (4), and K be the maximum need of each process.
The condition for avoiding deadlock is: \sum_{i=1}^{n} \text{max_need}_i < n + m 3×K<3+4 3K<7 K<37≈2.333
Since K must be an integer, the largest value of K that satisfies this condition is 2.
Q35GATE 0NAT1MComputer Network
Consider a long-lived TCP session with an end-to-end bandwidth of 1 Gbps (= 109 bits-per-second). The session starts with a sequence number of 1234. The minimum time (in seconds, rounded to the closest integer) before this sequence number can be used again is _______.
The TCP sequence number is 32 bits, which means there are 232 unique sequence numbers. Since TCP assigns a sequence number to each byte, this corresponds to 232 bytes of data.
The bandwidth is 1 Gbps, which is 109 bits per second. To find the rate in bytes per second, we divide by 8:
Bandwidth = 8109 bytes/second.
The time before the sequence number wraps around is the total number of bytes divided by the transmission rate:
Time = 8109 bytes/s232 bytes=109232×8 s≈34.36 s.
Rounding to the closest integer, the minimum time is 34 seconds.
Q36GATE 0MCQ2MEngineering Mathematics
Consider a matrix P whose only eigenvectors are the multiples of
[14]
. Consider the following statements. (I) P does not have an inverse (II) P has a repeated eigenvalue (III) P cannot be diagonalized Which one of the following options is correct?
A matrix is diagonalizable if and only if it has a complete set of linearly independent eigenvectors. Since all eigenvectors of P are multiples of a single vector, P has only one linearly independent eigenvector. For a 2x2 matrix, this means it does not have a full set of two linearly independent eigenvectors, so it cannot be diagonalized (Statement III is true).
A matrix that is not diagonalizable must have at least one repeated eigenvalue (Statement II is true). Statement I is not necessarily true, as P could be invertible. For example, the matrix
[1011]
has a repeated eigenvalue of 1 but is invertible.
Q37GATE 0MCQ2MDiscrete Mathematics
Let N be the set of natural numbers. Consider the following sets. P: Set of Rational numbers (positive and negative) Q: Set of functions from {0, 1} to N R: Set of functions from N to {0, 1} S: Set of finite subsets of N. Which of the sets above are countable?
Let's analyze the countability of each set:
P: The set of rational numbers (Q) is countable. This can be demonstrated by creating a one-to-one correspondence with the natural numbers.
Q: The set of functions from {0,1} to N. Each function is uniquely determined by the pair of values (f(0),f(1)). This set is equivalent to N×N, which is the Cartesian product of two countable sets and is therefore countable.
R: The set of functions from N to {0,1}. This set is equivalent to the set of all infinite binary sequences, which has the same cardinality as the power set of N. By Cantor's theorem, this set is uncountable.
S: The set of all finite subsets of N is countable.
Thus, the countable sets are P, Q, and S.
Q38GATE 0MCQ2MDiscrete Mathematics
Consider the first-order logic sentence φ≡∃s∃t∃u∀v∀w∀x∀yφ(s,t,u,v,w,x,y) where φ(s,t,u,v,w,x,y) is a quantifier-free first-order logic formula using only predicate symbols, and possibly equality, but no function symbols. Suppose φ has a model with a universe containing 7 elements. Which one of the following statements is necessarily true?
The first-order logic sentence φ asserts the existence of three elements s,t,u for which a property holds for all elements in the universe. If a model with a universe of 7 elements satisfies this, it means such s,t,u can be found within those 7 elements. We can then construct a new, smaller model whose universe consists only of these three specific elements {s,t,u}. In this universe of size 3, the sentence φ remains true. Therefore, if a model of size 7 exists, a model of size less than or equal to 3 must also exist.
Q39GATE 0MCQ2MC Programming
Consider the following C program: #include < stdio.h >
The function fun1 receives pointers by value. Swapping the local copies of the pointers s1 and s2 inside fun1 does not alter the original pointers str1 and str2 in the main function. Thus, the first printf outputs "Hi Bye". In contrast, fun2 receives pointers to pointers (pass-by-reference). Dereferencing them allows fun2 to swap the actual pointers str1 and str2 in main. After the call to fun2, str1 points to "Bye" and str2 points to "Hi". The second printf therefore outputs "Bye Hi".
Q40GATE 0MCQ2MAlgorithm
Let G be a simple undirected graph. Let TD be a depth first search tree of G. Let TB be a breadth first search tree of G. Consider the following statements. (I) No edge of G is a cross edge with respect to TD. (A cross edge in G is between two nodes neither of which is an ancestor of the other in TD.) (II) For every edge (u,v) of G, if u is at depth i and v is at depth j in TB, then |i-j|=1. Which of the statements above must necessarily be true?
Statement (I) is true. During a Depth First Search (DFS) on an undirected graph, any edge not part of the DFS tree must be a back edge, connecting a vertex to one of its ancestors. Cross edges, which connect vertices in different subtrees where neither is an ancestor of the other, do not occur in a DFS of an undirected graph. Statement (II) is false. A Breadth First Search (BFS) explores level by level. An edge can connect two vertices at the same depth, for which ∣i−j∣=0. This violates the condition ∣i−j∣=1.
Q41GATE 0MCQ2MAlgorithm
Assume that multiplying a matrix G1 of dimension pxq with another matrix G2 of dimension pxq requires pqr scalar multiplications. Computing the product of n matrices G1G2G3...Gn can be done by parenthesizing in different ways. Define Gi Gi+1 as an explicitly computed pair for a given paranthesization if they are directly multiplied. For example, in the matrix multiplication chain G1G2G3G4G5G6 using parenthesization (G1(G2G3))(G4(G5G6)), G2G3 and G5G6 are the only explicitly computed pairs. Consider a matrix multiplication chain F1F2F3F4F5, where matrices F1, F2, F3, F4 and F5 are of dimensions 2x25, 25x3, 3x16, 16x1 and 1x1000, respectively. In the parenthesization of F1F2F3F4F5 that minimizes the total number of scalar multiplications, the explicitly computed pairs is/are
This is a matrix chain multiplication problem. The goal is to find the parenthesization that minimizes the number of scalar multiplications. The dimensions are F1(2x25), F2(25x3), F3(3x16), F4(16x1), and F5(1x1000).
Let's analyze the parenthesization (F1(F2(F3F4)))F5:
Cost of (F3F4): Dimensions are (3x16) and (16x1). Cost = 3×16×1=48. Result is a 3x1 matrix.
Cost of F2(F3F4): Dimensions are (25x3) and (3x1). Cost = 25×3×1=75. Result is a 25x1 matrix.
Cost of F1(F2(F3F4)): Dimensions are (2x25) and (25x1). Cost = 2×25×1=50. Result is a 2x1 matrix.
Cost of (F1(F2(F3F4)))F5: Dimensions are (2x1) and (1x1000). Cost = 2×1×1000=2000.
Total cost = 48+75+50+2000=2173. This is the optimal arrangement. An "explicitly computed pair" is defined as two original adjacent matrices being multiplied. In this optimal order, only F3 and F4 are multiplied directly.
Q42GATE 0MCQ2MC Programming
Consider the following C code. Assume that unsigned long int type length is 64 bits.
unsigned long int fun(unsigned long int n) {
unsigned long int i, j = 0, sum = 0;
for (i = n; i > 1; i = i/2) j++;
for ( ; j > 1; j = j/2) sum++;
return(sum);
}
The value returned when we call fun with the input 240 is
The function fun is called with n = 2^40. Let's trace the execution.
The first for loop runs as long as i > 1, with i being halved in each iteration.
i starts at 240 and takes values 240,239,…,21.
The loop executes 40 times before i becomes 1 and the loop terminates.
In each iteration, j is incremented. So, after this loop, j will be 40.
The second for loop runs as long as j > 1, with j being halved.
j starts at 40. The loop iterates for j values of 40, 20, 10, 5, and 2.
When j is 2, j/2 becomes 1. The loop condition j > 1 fails for the next iteration.
The loop body sum++ executes 5 times.
Therefore, the final value of sum returned is 5.
Q43GATE 0MCQ2MDigital Logic
Consider the unsigned 8-bit fixed point binary Number System below, b7b6b5b4b3.b2b1b0 where the position of the binary point is between b3andb2 . Assume b7 is the most significant bit. Some of the decimal numbers listed below cannot be represented exactly in the above representation: (i) 31.500 (ii) 0.875 (iii) 12.100 (iv) 3.001 Which one of the following statements is true?
The fixed-point representation has 3 bits for the fractional part. A decimal number can be represented exactly if its fractional part has a finite binary representation.
(i) 31.500: The fractional part 0.5 is 1/2, which is exactly 0.12.
(ii) 0.875: The fractional part 0.875 is 7/8, which is exactly 0.1112.
(iii) 12.100: The fractional part 0.1 has a non-terminating, repeating binary expansion (0.000110011...2).
(iv) 3.001: The fractional part 0.001 also has a non-terminating binary expansion.
Therefore, only numbers (iii) and (iv) cannot be represented exactly.
Q44GATE 0MCQ2MComputer Organization
The size of the physical address space of a processor is 2P bytes. The word length is 2W bytes. The capacity of cache memory is 2N Bytes. The size of each cache block is 2M words. For a K-way set-associative cache memory, the length (in number of bits) of the tag field is
The size of the tag field is determined by subtracting the bits used for the set index and byte offset from the total physical address bits.
Physical Address (PA) bits: The physical address space is 2P bytes, so the PA has P bits.
Byte Offset bits: The block size is 2M words, and word length is 2W bytes. So, block size is 2M×2W=2M+W bytes. The number of bits for byte offset is M+W.
Set Index bits:
Cache capacity = 2N bytes.
Number of blocks in cache = (Cache Capacity) / (Block Size) = 2N/2M+W=2N−M−W.
Number of sets = (Number of blocks) / K = 2N−M−W/K.
Set index bits = log2(Number of sets)=log2(2N−M−W/K)=N−M−W−log2K.
Tag bits:
Tag bits = PA bits - Set bits - Byte offset bits
Tag bits = P−(N−M−W−log2K)−(M+W)
Tag bits = P−N+M+W+log2K−M−W=P−N+log2K.
Q45GATE 0MCQ2MTheory of Computation
Consider the following languages: I. {ambncpdq∣m+p=n+q,wherem,n,p,q≥0} II. {ambncpdq∣m=nandp=q,wherem,n,p,q≥0} III. {ambncpdq∣m=n=pandp=q,wherem,n,p,q≥0} IV. {ambncpdq∣mn=p+q,wherem,n,p,q≥0} Which of the languages above are context-free?
I. {ambncpdq∣m+p=n+q,m,n,p,q≥0}: This language is context-free. The condition can be rewritten as m−n=q−p. A pushdown automaton (PDA) can be designed to recognize this. It can push for a's, pop for b's (or vice-versa, handling the difference on the stack), and then do the same for c's and d's to verify the equality of differences.
II. {ambncpdq∣m=nandp=q,m,n,p,q≥0}: This is context-free. It is the concatenation of two CFLs: L1={ambn∣m=n} and L2={cpdq∣p=q}. The concatenation of CFLs is a CFL. A grammar is S→AB, A→aAb∣ϵ, B→cBd∣ϵ.
III. {ambncpdq∣m=n=p…}: This is not context-free as it requires comparing three counts (m,n,p), which a PDA cannot do.
IV. {ambncpdq∣mn=p+q…}: This is not context-free as multiplication (mn) is beyond the capabilities of a PDA.
Q46GATE 0MCQ2MTheory of Computation
Consider the following problems. L(G) denotes the language generated by a grammar G. L(M) denotes the language accepted by a machine M. (I) For an unrestricted grammar G and a string w, whether w ∈ L(G) (II) Given a Turing machine M, whether L(M) is regular (III) Given two grammars G1 and G2, whether L(G1) = L(G2) (IV) Given an NFA N, whether there is a deterministic PDA P such that N and P accept the same language. Which one of the following statements is correct?
The decidability of the given problems is as follows:
(I) The membership problem for an unrestricted grammar (which is equivalent to a Turing Machine) is undecidable.
(II) According to Rice's theorem, any non-trivial property of the language accepted by a Turing Machine is undecidable. Whether a language is regular is a non-trivial property, hence this problem is undecidable.
(III) The equivalence problem, which is determining if two grammars generate the same language (L(G1)=L(G2)), is undecidable for context-free grammars and higher.
(IV) The problem of equivalence between an NFA (accepting a regular language) and a DPDA (accepting a deterministic CFL) is decidable.
Thus, problems I, II, and III are undecidable.
Q47GATE 0MCQ2MCompiler Design
A lexical analyzer uses the following patterns to recognize three tokens T1,T2,andT3 over the alphabet {a,b,c}. T1:a?(b∣c)∗aT2:b?(a∣c)∗bT3:c?(b∣a)∗c Note that 'x?' means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix. If the string bbaacabc is processed by the analyzer, which one of the following is the sequence of tokens it outputs?
The lexical analyzer uses the "longest possible prefix" rule on the input string bbaacabc.
The longest prefix of the string that matches any of the three patterns is bbaac. This string matches the pattern for token T3:c?(b∣a)∗c. Here, c? matches an empty string, (b|a)^* matches bbaa, and the final c matches c.
After this token is recognized, the remaining string is abc.
The longest prefix of the remaining string abc that matches a pattern is the entire string abc itself. This also matches the pattern for token T3.
Therefore, the sequence of tokens output by the analyzer is T3T3.
Q48GATE 0MCQ2MCompiler Design
C onsider the following parse tree for the expression a#bcd#e#f, involving two binary operators $ and #. Which one of the following is correct for the given parse tree?
By examining the structure of the parse tree, we can determine the operator precedence and associativity.
The sub-expression b$c$d is evaluated before the operators # are considered, as it is located at a lower level in the tree. This indicates that $ has higher precedence than #.
Within the sub-tree for b$c$d, the grouping is (b$c)$d, meaning the $ operator associates to the left. Thus, $ is left-associative.
The operations involving # are evaluated from right to left. For instance, e#f is evaluated first, and its result is then used. This shows that # is right-associative.
Q49GATE 0MCQ2MOperating System
In a system, there are three types of resources: E, F and G. Four processes P0,P1,P2andP3 execute concurrently. At the outset, the processes have declared their maximum resource requirements using a matrix named Max as given below. For example, Max[ P2 ,F] is the maximum number of instances of F that P2 would require. The number of instances of the resources allocated to the various processes at any given state is given by a matrix named Allocation. Consider a state of the system with the Allocation matrix as shown below, and in which 3 instances of E and 3 instances of F are the only resources available. From the perspective of deadlock avoidance, which one of the following is true?
To determine if the system is in a safe state, we use the Banker's algorithm. First, we calculate the Need matrix as Max - Allocation. Need matrix: P0: (3,3,0), P1: (1,0,2), P2: (0,3,0), P3: (3,4,1).
The available resources are (3,3,0).
The safety algorithm checks if there is a sequence of processes that can complete. A safe sequence exists, for example, <P0,P2,P1,P3>.
P0's need (3,3,0) ≤ Available (3,3,0). P0 can execute. New Available = (3,3,0) + (1,0,1) = (4,3,1).
P2's need (0,3,0) ≤ Available (4,3,1). P2 can execute. New Available = (4,3,1) + (1,0,3) = (5,3,4).
This process continues for P1 and P3. Since a safe sequence can be found, the system is in a safe state.
Q50GATE 0MCQ2MOperating System
Consider the following solution to the producer-consumer synchronization problem. The shared buffer size is N. Three semaphores empty, full and mutex are defined with respective initial values of 0, N and 1. Semaphore empty denotes the number of available slots in the buffer, for the consumer to read from. Semaphore full denotes the number of available slots in the buffer, for the producer to write to. The placeholder variables, denoted by P, Q, R, and S, in the code below can be assigned either empty or full . The valid semaphore operations are: wait() and signal() . Which one of the following assignments to P, Q, R and S will yield the correct solution?
The problem uses non-standard definitions for the semaphores.
empty: "slots... for the consumer to read from," meaning the number of full slots. Its initial value is 0.
full: "slots... for the producer to write to," meaning the number of empty slots. Its initial value is N.
Based on these definitions:
The producer must wait for an empty slot (semaphore full) and signal a full slot (semaphore empty). Thus, P = full and Q = empty.
The consumer must wait for a full slot (semaphore empty) and signal an empty slot (semaphore full). Thus, R = empty and S = full.
This assignment is P: full, Q: empty, R: empty, S: full.
Q51GATE 0MCQ2MDatabase Management System
Consider the relations r(A, B) and s(B, C), where s.B is a primary key and r.B is a foreign key referencing s.B. Consider the query Q:r⋈(σB<5(s)) Let LOJ denote the natural left outer-join operation. Assume that r and s contain no null values. Which one of the following queries is NOT equivalent to Q?
The original query, Q:r⋈(σB<5(s)), first selects rows from table s where B is less than 5, and then performs a natural join with table r. This is an inner join, so any row in r whose B value is 5 or greater will be discarded because it won't find a match in the filtered s.
Now consider option C: r LOJ(σB<5(s)). This also filters s first. However, it then performs a left outer join. This means if a row in r has a B value ≥5, it will still be included in the final result, with NULL values for the columns from s. Since this query preserves rows from r that the original query would discard, it is not equivalent.
Q52GATE 0MCQ2MDatabase Management System
Consider the following four relational schemas. For each schema, all non-trivial functional dependencies are listed. The underlined attributes are the respective primary keys. Which one of the relational schemas above is in 3NF but not in BCNF?
Let's analyze Schema II: Registration(rollno, courseid, email) with FDs rollno, courseid → email and email → rollno.
The candidate keys are {rollno, courseid} and {email, courseid}.
The set of prime attributes (part of any candidate key) is {rollno, courseid, email}. There are no non-prime attributes.
A schema is in 3NF if for every FD X→Y, either X is a superkey or Y is a prime attribute.
For email → rollno, the right-hand side rollno is a prime attribute.
For rollno, courseid → email, the determinant is a superkey.
Thus, the schema is in 3NF.
A schema is in BCNF if for every FD X→Y, X must be a superkey.
The FD email → rollno violates BCNF because its determinant, {email}, is not a superkey.
Therefore, Schema II is in 3NF but not in BCNF.
Q53GATE 0NAT2MDiscrete Mathematics
Let G be a graph with 100! vertices, with each vertex labelled by a distinct permutation of the numbers 1,2,...,100. There is an edge between vertices u and v if and only if the label of u can be obtained by swapping two adjacent numbers in the label of v. Let y denote the degree of a vertex in G, and z denote the number of connected components in G. Then, y+ 10z = _____.
The degree of a vertex, y, is the number of neighbors it has. A neighbor is formed by swapping two adjacent numbers in the permutation. For a sequence of 100 numbers, there are 100−1=99 adjacent pairs. Each adjacent swap results in a unique neighboring vertex. Therefore, the degree of any vertex is y=99.
The set of all permutations can be generated from any single permutation through a series of adjacent swaps (this is the principle behind bubble sort). This means the graph is connected, so it has only one connected component. Thus, z=1.
The required value is y+10z=99+10(1)=109.
Q54GATE 0NAT2MDiscrete Mathematics
Consider Guwahati (G) and Delhi (D) whose temperatures can be classified as high (G), medium (M) and low (L). Let P( HG ) denote the probability that Guwahati has high temperature. Similarly, P( MG ) and P( LG ) denotes the probability of Guwahati having medium and low temperatures respectively. Similarly, we use P( HD ),P( MD ) and P( LD ) for Delhi. The following table gives the conditional probabilities for Delhi's temperature given Guwahati's temperature. Consider the first row in the table above. The first entry denotes that if Guwahati has high temperature ( HG ) then the probability of Delhi also having a high temperature ( HD ) is 0.40; i.e., ( HD | HG ) = 0.40. Similarly, the next two entries are P( MD | HG )= 0.48 and P( LD | HG ) = 0.12. Similarly for the other rows. If it is known that P( HG )= 0.2, P( MG )= 0.5, andP( LG )= 0.3, then the probability (correct to two decimal places) that Guwahati has high temperature given that Delhi has high temperature is _______
We need to find the probability P(HG∣HD), which is the probability that Guwahati has a high temperature given that Delhi has a high temperature. Using Bayes' theorem: P(HG∣HD)=P(HD)P(HD∣HG)⋅P(HG)
The numerator is P(HD∩HG)=P(HD∣HG)⋅P(HG)=0.40×0.2=0.08.
The denominator P(HD) is found using the law of total probability: P(HD)=P(HD∣HG)P(HG)+P(HD∣MG)P(MG)+P(HD∣LG)P(LG)
Using the values from the problem description and the PDF's calculation: P(HD)=(0.40×0.2)+(0.1×0.5)+(0.01×0.3)=0.08+0.05+0.003=0.133.
(Note: The PDF calculation uses P(HD∣MG)=0.1, which differs from the table.)
Finally, P(HG∣HD)=0.1330.08≈0.60.
Q55GATE 0NAT2MC Programming
Consider the following program written in pseudo-code. Assume that x and y are integers. Count(x,y) { if (y != 1){ if (x != 1) { print("*"); Count(x/2, y); } else { y = y-1; Count(1024, y); } } } The number of times that the print statement is executed by the call Count(1024,1024) is _____.
The print("*") statement is executed only when y != 1 and x != 1.
Let's analyze the function call Count(1024, 1024).
The function will keep calling Count(x/2, y) as long as x is not 1. For a given y, the values of x will be 1024,512,256,...,2. Since 1024=210, this sequence has 10 terms (210 to 21), so the print statement executes 10 times.
When x becomes 1, the else block is triggered. It decrements y to y-1 and then calls Count(1024, y-1), restarting the process. This outer loop on y continues as long as y != 1. It will run for y values from 1024 down to 2, which is a total of 1024−2+1=1023 times.
For each of these 1023 iterations of y, the inner recursion on x prints 10 stars.
Total prints = 1023×10=10230.
Q56GATE 0NAT2MData Structure
The number of possible min-heaps containing each value from {1, 2, 3, 4, 5, 6, 7} exactly once is _____.
The number of min-heaps that can be formed from N distinct elements can be calculated using a recurrence relation. A min-heap with 7 nodes has a root, a left subtree of 3 nodes, and a right subtree of 3 nodes.
The smallest element, 1, must be at the root.
From the remaining 6 elements {2,3,4,5,6,7}, we must choose 3 for the left subtree. This can be done in (36) ways.
Let T(n) be the number of min-heaps with n nodes. The total number of heaps is given by: T(7)=(36)×T(3)×T(3)
For a 3-node heap, we choose 1 element for the left child from the 2 available elements: T(3)=(12)×T(1)×T(1)=2.
Substituting back: T(7)=20×2×2=80.
Thus, there are 80 possible min-heaps.
Q57GATE 0NAT2MAlgorithm
Consider the following undirected graph G: Choose a value for x that will maximize the number of minimum weight spanning trees (MWSTs) of G. The number of MWSTs of G for this value of x is ______.
To find the number of Minimum Weight Spanning Trees (MWSTs), one can use an algorithm like Kruskal's. The number of MWSTs is maximized when there are multiple choices of edges with the same minimum weight at some step of constructing the tree. According to the provided solution, the number of MWSTs is maximized when the edge weight x is set to 5. For this value, a total of 4 different MWSTs can be formed. For values of x from 1 to 4, only 2 MWSTs are possible. Thus, the maximum number of MWSTs is 4.
Q58GATE 0NAT2MAlgorithm
Consider the weights and values of items listed below. Note that there is only one unit of each item. The task is to pick a subset of these items such that their total weight is no more than 11 Kgs and their total value is maximized. Moreover, no item may be split. The total value of items picked by an optimal algorithm is denoted by Vopt . A greedy algorithm sorts the items by their value-to-weight ratios in descending order and packs them greedily, starting from the first item in the ordered list. The total value of items picked by the greedy algorithm is denoted by Vgreedy . The value of Vopt - Vgreedy is ____________.
The greedy approach for the 0/1 knapsack problem involves selecting items based on the highest value-to-weight ratio first.
The ratios are:
Item 1: 60/10=6
Item 2: 28/7=4
Item 3: 20/4=5
Item 4: 24/2=12
The sorted order of items by ratio is 4, 1, 3, 2. With a knapsack capacity of 11 kg:
Pick Item 4 (weight 2, value 24). Remaining capacity: 11−2=9 kg.
Skip Item 1 (weight 10 > 9).
Pick Item 3 (weight 4, value 20). Remaining capacity: 9−4=5 kg.
Skip Item 2 (weight 7 > 5).
The total value for the greedy approach is Vgreedy=24+20=44.
The optimal solution is to pick only Item 1 (weight 10, value 60), which fits the capacity. So, Vopt=60.
The difference is Vopt−Vgreedy=60−44=16.
Q59GATE 0NAT2MDigital Logic
Consider the minterm list form of a Boolean function F given below. F(P,Q,R,S)=∑m(0,2,5,7,9,11)+d(3,8,10,12,14) Here, m denotes a minterm and d denotes a don't care term. The number of essential prime implicants of the function F is ______.
An essential prime implicant (EPI) is a prime implicant that covers at least one minterm that cannot be covered by any other prime implicant. To find the EPIs, we can use a Karnaugh map (K-map) for the given function F(P,Q,R,S)=∑m(0,2,5,7,9,11)+d(3,8,10,12,14).
By grouping the minterms and don't-cares on the K-map, we identify the prime implicants. Then, we check which of these are essential:
The group covering minterms (0, 2, 8, 10) is an EPI because minterm 0 is covered only by this group.
The group covering minterms (3, 7, 11) is an EPI because minterm 11 is covered only by this group.
The group covering minterms (5, 7, 9, 11) is an EPI because minterm 5 is covered only by this group.
Since there are three such groups, the number of essential prime implicants is 3.
Q60GATE 0NAT2MComputer Organization
The instruction pipeline of a RISC processor has the following stages: Instruction Fetch (IF), Instruction Decode (ID), Operand Fetch (OF), Perform Operation (PO) and Writeback (WB). The IF, ID, OF and WB stages take 1 clock cycle each for every instruction. Consider a sequence of 100 instructions. In the PO stage, 40 instructions take 3 clock cycles each, 35 instructions take 2 clock cycles each, and the remaining 25 instructions take 1 clock cycle each. Assume that there are no data hazards and no control hazards. The number of clock cycles required for completion of execution of the sequence of instructions is ______.
The total number of clock cycles to execute instructions in a pipeline can be calculated as: Total Cycles=(k−1)+n+Stall Cycles
where k is the number of pipeline stages (5), and n is the number of instructions (100).
Stall cycles are the extra cycles consumed beyond the ideal one cycle per stage. Here, stalls are caused by the multi-cycle Perform Operation (PO) stage.
Total cycles spent in the PO stage for all 100 instructions: (40 instr×3 cycles)+(35 instr×2 cycles)+(25 instr×1 cycle)=120+70+25=215 cycles
Ideally, the PO stage would take 100 cycles for 100 instructions. The number of stall cycles is the excess: Stall Cycles=215−100=115
Total cycles = (5−1)+100+115=4+100+115=219.
Q61GATE 0NAT2MComputer Organization
A processor has 16 integer registers (R0, R1,...,R15) and 64 floating point registers (F0, F1,...,F63). It uses a 2-byte instruction format. There are four categories of instructions: Type-1, Type-2, Type-3, and Type-4. Type-1 category consists of four instructions, each with 3 integer register operands (3Rs). Type-2 category consists of eight instructions, each with 2 floating point register operands (2Fs). Type-3 category consists of fourteen instructions, each with one integer register operand and one floating point register operand (1R+1F). Type-4 category consists of N instructions, each with a floating point register operand (1F). The maximum value of N is __________.
The total instruction size is 16 bits, creating a total encoding space of 216 unique instructions. This space must be shared among all instruction types. The space an instruction type consumes depends on the number of instructions and the bits needed for operands.
Operand bits for each type:
Type-1 (3Rs): 3×log2(16)=12 bits
Type-2 (2Fs): 2×log2(64)=12 bits
Type-3 (1R+1F): 4+6=10 bits
Type-4 (1F): 6 bits
The total space used is the sum of (number of instructions) ×2operand bits. (4×212)+(8×212)+(14×210)+(N×26)≤216 (12×212)+(14×210)+(N×26)≤216 (3×22×212)+(14×210)+(N×26)≤216 (3×214)+(14×210)+(N×26)≤216
Dividing by 26: 3×28+14×24+N≤210 768+224+N≤1024 992+N≤1024⟹N≤32
The maximum value of N is 32.
Q62GATE 0NAT2MTheory of Computation
Given a language L, define Li as follows: L0={ε}Li=Li−1⋅L for all i>0 The order of a language L is defined as the smallest k such that Lk=Lk+1 . Consider the language L1 (over alphabet 0) accepted by the following automaton. The order of L1 is ______
The language L1 accepted by the automaton consists of the empty string ε and all strings with an odd number of 0s. So, L1={ε,0,000,00000,…}. The order of a language is the smallest k such that L1k=L1k+1.
Let's compute L12=L1⋅L1. Concatenating any string from L1 with ε results in a string in L1. Concatenating two strings with an odd number of 0s results in a string with an even number of 0s. Therefore, L12 contains all strings with an odd number of 0s and all strings with an even number of 0s, which is the set of all possible strings over the alphabet {0}, i.e., 0∗.
Now, let's compute L13=L12⋅L1=0∗⋅L1. Since 0∗ contains ε, 0∗⋅L1 contains all of L1. Since L1 contains ε, 0∗⋅L1 contains all of 0∗. Thus, L13=0∗.
Since L12=L13=0∗, the smallest k for which this holds is k=2.
Q63GATE 0NAT2MOperating System
Consider a storage disk with 4 platters (numbered as 0, 1, 2 and 3), 200 cylinders (numbered as 0, 1, ... , 199), and 256 sectors per track (numbered as 0, 1, ... , 255). The following 6 disk requests of the form [sector number, cylinder number, platter number] are received by the disk controller at the same time: [120, 72, 2] , [180, 134, 1] , [60, 20, 0] , [212, 86, 3] , [56, 116, 2] , [118, 16, 1] Currently the head is positioned at sector number 100 of cylinder 80, and is moving towards higher cylinder numbers. The average power dissipation in moving the head over 100 cylinders is 20 milliwatts and for reversing the direction of the head movement once is 15 milliwatts. Power dissipation associated with rotational latency and switching of head between different platters is negligible. The total power consumption in milliwatts to satisfy all of the above disk requests using the Shortest Seek Time First disk scheduling algorithm is _______.
The total power consumption is the sum of the power for head movement and the power for direction changes. The solution in the PDF calculates the total head movement to be 200 cylinders and the number of direction changes to be 3.
Power for head movement:
The average power dissipation is 20 milliwatts per 100 cylinders. For a total movement of 200 cylinders:
Power = 100 cylinders200 cylinders×20 milliwatts=2×20=40 milliwatts.
Power for direction changes:
The power for one direction reversal is 15 milliwatts. For 3 direction changes:
Power = 3×15 milliwatts=45 milliwatts.
Total power consumption:
Total Power = 40+45=85 milliwatts.
Q64GATE 0NAT2MComputer Network
Consider an IP packet with a length of 4,500 bytes that includes a 20-byte IPv4 header and a 40-byte TCP header. The packet is forwarded to an IPv4 router that supports a Maximum Transmission Unit (MTU) of 600 bytes. Assume that the length of the IP header in all the outgoing fragments of this packet is 20 bytes. Assume that the fragmentation offset value stored in the first fragment is 0. The fragmentation offset value stored in the third fragment is _______.
The total length of the IP packet is 4500 bytes, with a 20-byte header. The total data to be fragmented is 4500−20=4480 bytes. The Maximum Transmission Unit (MTU) is 600 bytes. Each fragment will have its own 20-byte IP header.
The maximum data payload in each fragment is 600−20=580 bytes. The data length must be a multiple of 8. The largest multiple of 8 less than or equal to 580 is 576 (72×8).
The fragments are created as follows:
Fragment 1: Carries data bytes 0 to 575. The offset is 80=0.
Fragment 2: Carries data bytes 576 to 1151. The offset is 8576=72.
Fragment 3: Carries data bytes 1152 to 1727. The offset is 81152=144.
The fragmentation offset value for the third fragment is 144.
Q65GATE 0NAT2MComputer Network
Consider a simple communication system where multiple nodes are connected by a shared broadcast medium (like Ethernet or wireless). The nodes in the system use the following carrier-sense based medium access protocol. A node that receives a packet to transmit will carrier-sense the medium for 5 units of time. If the node does not detect any other transmission in this duration, it starts transmitting its packet in the next time unit. If the node detects another transmission, it waits until this other transmission finishes, and then begins to carrier-sense for 5 time units again. Once they start to transmit, nodes do not perform any collision detection and continue transmission even if a collision occurs. All transmissions last for 20 units of time. Assume that the transmission signal travels at the speed of 10 meters per unit time in the medium. Assume that the system has two nodes P and Q, located at a distance d meters from each other. P starts transmitting a packet at time t=0 after successfully completing its carrier-sense phase. Node Q has a packet to transmit at time t=0 and begins to carrier-sense the medium. The maximum distance d (in meters, rounded to the closest integer) that allows Q to successfully avoid a collision between its proposed transmission and P's ongoing transmission is _____.
Node P starts transmitting at t=0. Node Q begins to carrier-sense the medium at t=0 for 5 units of time. For Q to avoid a collision, it must detect P's transmission before it finishes sensing at t=5.
Let the distance between P and Q be d meters. The signal propagation speed is 10 meters/unit time. The time it takes for P's signal to reach Q is the propagation delay, tp=10d.
To prevent a collision, Q must detect the signal while it is still sensing. This means the signal must arrive before or at the moment Q finishes sensing: tp≤5 10d≤5 d≤50 meters
The maximum distance d that allows Q to successfully avoid a collision is 50 meters.