The sentence requires the simple present tense in the clause following "until" to refer to a future event. The subject "the minister" is a third-person singular noun, so the verb must be "meets". Options A and B use a grammatically incorrect double negative ("not...does not" and "not...doesn't"). Option C uses "meet," which is the incorrect verb form for a third-person singular subject.
Q2GATE 0MCQ1MGeneral Aptitude
rewording of something written or spoken is a __________.
A "paraphrase" is a restatement or rewording of a text or passage, giving the meaning in another form. The other terms have different meanings: a "paradox" is a self-contradictory statement, a "paradigm" is a typical example or model of something, and "paraffin" is a flammable, waxy substance.
Q3GATE 0MCQ1MGeneral Aptitude
Archimedes said, "Give me a lever long enough and a fulcrum on which to place it, and I will move the world." The sentence above is an example of a ____________ statement.
The statement by Archimedes is not meant to be interpreted literally, as finding a lever long enough to move the Earth is physically impossible. Instead, it uses exaggeration (hyperbole) to make a point about the immense power of leverage. This use of language to create an effect rather than to convey a literal meaning is known as a figurative statement.
Q4GATE 0MCQ1MGeneral Aptitude
If 'relftaga' means carefree, 'otaga' means careful and 'fertaga' means careless, which of the following could mean 'aftercare'?
By comparing 'carefree' (relftaga), 'careful' (otaga), and 'careless' (fertaga), we can deduce that 'taga' means 'care'. The prefixes 'relf', 'o', and 'fer' correspond to 'free', 'ful', and 'less' respectively. The question asks for 'aftercare'. The options suggest a structure of 'care' + suffix for 'after' or prefix for 'after' + 'care'. In 'tagazen', 'taga' means care, and 'zen' likely means 'after', forming 'aftercare'.
Q5GATE 0MCQ1MGeneral Aptitude
A cube is built using 64 cubic blocks of side one unit. After it is built, one cubic block is removed from every corner of the cube. The resulting surface area of the body (in square units) after the removal is ________.
The cube is built from 64 smaller cubes, meaning it is a 4x4x4 cube. The initial surface area is 6×(side length)2=6×42=96 square units. When a corner block is removed, three of its faces, which were part of the cube's surface, are removed. However, this exposes three new inner faces of the resulting cavity. The net change in surface area is −3+3=0. Since this happens at all 8 corners, the total surface area remains unchanged at 96.
Q6GATE 0MCQ2MGeneral Aptitude
A shaving set company sells 4 different types of razors- Elegance, Smooth, Soft and Executive. Elegance sells at Rs. 48, Smooth at Rs. 63, Soft at Rs. 78 and Executive at Rs. 173 per piece. The table below shows the numbers of each razor sold in each quarter of a year.
To find the product with the highest revenue, we calculate the total annual revenue for each razor type by multiplying the total units sold per year by the price per unit.
Executive: (9999+8942+10234+10109)×173=39284×173=6,796,132
Comparing the total revenues, the Executive razor contributes the most.
Q7GATE 0MCQ2MGeneral Aptitude
Indian currency notes show the denomination indicated in at least seventeen languages. If this is not an indication of the nation's diversity, nothing else is. Which of the following can be logically inferred from the above sentences?
The sentences state that the presence of at least seventeen languages on currency notes is an indication of the nation's diversity. The phrasing "If this is not an indication..., nothing else is" emphasizes the significance of this linguistic multiplicity as a powerful sign of diversity. This directly supports the inference that linguistic pluralism is strong evidence of India's diversity. The other options make claims that are too specific (e.g., "exactly seventeen") or too absolute (e.g., "the only indicator") to be logically inferred.
Q8GATE 0MCQ2MGeneral Aptitude
Consider the following statements relating to the level of poker play of four players P, Q, R and S. I. P always beats Q II. R always beats S III. S loses to P only sometimes. IV. R always loses to Q Which of the following can be logically inferred from the above statements? (i). P is likely to beat all the three other players (ii). S is the absolute worst player in the set
The provided statements are:
I. P always beats Q (P > Q).
II. R always beats S (R > S).
III. S loses to P only sometimes (P does not always beat S).
IV. R always loses to Q (Q > R).
From I, II, and IV, we can form a partial hierarchy: P > Q > R > S. However, statement III contradicts a strict, transitive hierarchy because it implies that S sometimes does not lose to P.
Inference (i), "P is likely to beat all the three other players," cannot be logically inferred because of the conflict regarding S.
Inference (ii), "S is the absolute worst player," is false because S sometimes holds its own against P, the strongest player in other matchups.
Since neither statement can be definitively concluded from the given information, the correct choice is neither (i) nor (ii).
Q9GATE 0MCQ2MGeneral Aptitude
If f(x)=2x7+3x−5 , which of the following is a factor of f(x) ?
According to the Factor Theorem, a polynomial f(x) has a factor (x−c) if and only if f(c)=0. We can test the given options.
Let's test option B, which corresponds to the factor (x−1). Here, c=1. We need to evaluate f(1).
The function is f(x)=2x7+3x−5.
Substituting x=1: f(1)=2(1)7+3(1)−5 f(1)=2+3−5=0
Since f(1)=0, the polynomial f(x) has a factor of (x−1).
Q10GATE 0MCQ2MGeneral Aptitude
In a process, the number of cycles to failure decreases exponentially with an increase in load. At a load of 80 units, it takes 100 cycles for failure. When the load is halved, it takes 10000 cycles for failure.The load for which the failure will happen in 5000 cycles is _________
The solution for this question is not available in the provided PDF. The explanation is based on standard textbook concepts.
Let N be the number of cycles and L be the load. The relationship is exponential: N=Ae−kL.
Given:
100=Ae−80k
10000=Ae−40k
Dividing (2) by (1) gives 10010000=e40k, so 100=e40k.
We need to find L when N = 5000.
From (2), A=10000e40k=10000×100=106.
So, 5000=106e−kL. ekL=5000106=200. kL=ln(200).
From 100=e40k, we have 40k=ln(100). L=kln(200)=ln(100)/40ln(200)=40ln(100)ln(200)≈404.6055.298≈46.02.
CSE55 questions
Q11GATE 0NAT1MDiscrete Mathematics
Let p,q, r, s represent the following propositions. p: x ∈ {8,9,10,11,12} q: x is a composite number r: x is a perfect square s: x is a prime number The integer x ≥ 2 which satisfies ¬((p⇒q)∧(¬r∨¬s)) is ________.
The given logical expression is ¬((p⇒q)∧(¬r∨¬s)). For this to be true, the inner expression ((p⇒q)∧(¬r∨¬s)) must be false. An AND expression is false if at least one of its operands is false.
Case 1: (p⇒q) is false.
This occurs only when p is true and q is false.
p is true: x∈{8,9,10,11,12}.
q is false: x is not a composite number.
From the set for p, the only non-composite number is 11 (which is prime). So, x=11 satisfies this case.
Case 2: (¬r∨¬s) is false.
This is equivalent to r∧s being true.
r is true: x is a perfect square.
s is true: x is a prime number.
No integer is both a prime number and a perfect square. This case is impossible.
Thus, the only integer that satisfies the condition is x=11.
Q12GATE 0MCQ1MDiscrete Mathematics
Let an be the number of n-bit strings that do NOT contain two consecutive 1s. Which one of the following is the recurrence relation for an ?
Let an be the number of n-bit strings without two consecutive 1s. We can find the first few terms of the sequence to identify the pattern.
For n=1: The valid strings are "0" and "1". So, a1=2.
For n=2: The valid strings are "00", "01", "10". The string "11" is invalid. So, a2=3.
For n=3: The valid strings are "000", "001", "010", "100", "101". The strings "011", "110", "111" are invalid. So, a3=5.
The sequence starts a1=2,a2=3,a3=5. Let's check the given options with n=3.
Option (b) is an=an−1+an−2.
For n=3, this gives a3=a2+a1=3+2=5. This matches our calculated value.
To evaluate the limit, we can use a substitution. Let t=x−4. As x approaches 4, t approaches 0. Substituting this into the expression gives us the standard trigonometric limit: limt→0tsin(t)
The value of this well-known limit is 1.
Q14GATE 0NAT1MDiscrete Mathematics
A probability density function on the interval [a,1] is given by 1/ x2 and outside this interval the value of the function is zero.The value of a is __________.
For a function to be a valid probability density function (PDF), its integral over the entire domain must equal 1. For the given function f(x)=1/x2 on the interval [a,1], we must have: ∫a1x21dx=1
Evaluating the integral gives: [−x1]a1=(−11)−(−a1)=a1−1
Setting this equal to 1, we get a1−1=1, which solves to a1=2, so a=0.5.
Q15GATE 0NAT1MEngineering Mathematics
Two eigen values of a 3x3 real matrix P are (2+ −1 ) and 3.The determinantof P is __________.
For a real matrix, complex eigenvalues must occur in conjugate pairs. Since (2+−1) or (2+i) is an eigenvalue, its complex conjugate, (2−i), must also be an eigenvalue. The three eigenvalues of the 3x3 matrix P are therefore 2+i, 2−i, and 3.
The determinant of a matrix is the product of its eigenvalues. det(P)=(2+i)(2−i)(3) det(P)=(22−i2)(3)=(4−(−1))(3)=(5)(3)=15
Q16GATE 0MCQ1MDigital Logic
Consider the Boolean operator with the following properties: x#0=x,x#1=xˉ , x#x=0 and x#xˉ=1 . Then x#y is equivalent to
The given 16-bit number is 1111 1111 1111 0101. Since the most significant bit is 1, the number is negative in 2's complement representation. To find its magnitude, we take the 2's complement of the number.
Find the 1's complement by inverting all bits: 0000 0000 0000 1010.
Add 1 to the 1's complement: 0000 0000 0000 1011.
The resulting binary number, 1011, represents the magnitude. Converting to decimal: 8+2+1=11. Since the original number was negative, the decimal value is -11.
Q18GATE 0NAT1MDigital Logic
We want to design a synchronous counter that counts these quence 0-1-0-2-0-3 and then repeats. The minimum number of J-K flip flop srequired to implement this counteris ________.
The counter must generate the sequence 0-1-0-2-0-3. The maximum value is 3, which can be represented by 2 bits. However, the state '0' appears three times in the sequence. To distinguish between these three occurrences, additional state bits are required.
A state can be represented by a composite of the output value and an instance counter for that value. For example, we can use 2 bits for the value (0 to 3) and 2 bits to count the instances of '0' (first, second, third). This composite state representation requires a total of 4 bits, and thus 4 J-K flip-flops.
Q19GATE 0NAT1MOperating System
A processor can support a maximum memory of 4GB, where the memory is word-addressable (a word consists of two bytes). The size of the address bus of the process or is at least bits________.
A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT (n refers to the number of items in the queue)?
The worst-case time complexity for Insertion sort occurs when the input array is sorted in reverse order, leading to Θ(n2) comparisons and swaps. For Mergesort, the time complexity is consistently Θ(nlogn) in all cases, as it always divides the array and merges. Quicksort's worst-case complexity is Θ(n2), which happens when the pivot selection consistently results in highly unbalanced partitions, such as when the input array is already sorted.
Q24GATE 0MCQ1MAlgorithm
Let G be a weighted connected undirected graph with distinct positive edge weights. If every edge weight is increasedby the same value ,then which of the following statements is/are TRUE? P: Minimum spanning tree of G does not change Q: Shortest path between any pair of vertices does not change
Statement P is true. The Minimum Spanning Tree (MST) is determined by the relative order of edge weights. Adding a constant value to every edge does not change this relative order, so algorithms like Kruskal's or Prim's will select the same set of edges, resulting in the same MST.
Statement Q is false. The shortest path can change because adding a constant penalizes paths with more edges. A path that was originally shorter but had more edges might become longer than a path with fewer edges after the weights are increased.
Q25GATE 0NAT1MC Programming
Consider the following C program. #include < stdio.h >
The function mystery takes two integer pointers, ptra and ptrb, as arguments. Inside the function, it swaps the values of these local pointer variables. Since C passes arguments by value, the function receives copies of the addresses of a, b, and d. Swapping these copies inside mystery has no effect on the original variables a, b, and d in the main function. The if (a < c) condition (2016 < 4) is false, so the second call is skipped. The value of a remains unchanged from its initial value of 2016, which is what gets printed.
Q26GATE 0MCQ1MTheory of Computation
Which of the following languages is generated by the given grammar? S→aS∣bS∣ε
The given grammar is S→aS∣bS∣ε. The productions S→aS and S→bS allow for prefixing the derived string with either an 'a' or a 'b' and then continuing the derivation from S. The production S→ε provides the base case to terminate the recursion. This process can generate any sequence of 'a's and 'b's of any length, including the empty string (ε). This is the definition of the set of all strings over the alphabet {a, b}, which is denoted by {a,b}∗.
Q27GATE 0MCQ1MTheory of Computation
Which of the following decision problems are undecidable? I. Given NFAs N1 and N2, is L(N1) ∩ L(N2) = ϕ ? II. Given a CFG G = (N, Σ ,P,S) and a string x∈Σ∗ , does x∈ L(G)? III. Given CFGs G1 and G2, is L(G1) = L(G2)? IV. Given a TM M, is L(M) = ϕ ?
I. The disjointedness problem for regular languages is decidable. The intersection of two regular languages is regular, and the emptiness of a regular language is a decidable problem.
II. The membership problem for Context-Free Languages (CFLs) is decidable, for instance, by using the CYK algorithm.
III. The equivalence problem for CFLs (checking if L(G1)=L(G2)) is undecidable.
IV. The emptiness problem for Recursively Enumerable (RE) languages (checking if L(M)=ϕ for a Turing Machine M) is undecidable.
Therefore, problems III and IV are undecidable.
Q28GATE 0MCQ1MTheory of Computation
Which one of the following regular expressions represents the language: the set of all binary strings having two consecutive 0s and two consecutive 1s?
The language consists of all binary strings that contain both the substring "00" and the substring "11". This means that for any string in the language, either an occurrence of "00" must appear before an occurrence of "11", or an occurrence of "11" must appear before an occurrence of "00".
The expression (0+1)*(00(0+1)*11 + 11(0+1)*00)(0+1)* correctly captures this. The middle part (00(0+1)*11 + 11(0+1)*00) ensures that both substrings are present in one of the two possible orders, and the surrounding (0+1)* parts allow for any characters at the beginning or end of the string.
Q29GATE 0NAT1MCompiler Design
Consider the following code segment. x =u-t; y =xv; x =y+w; y =t-z; y =xy; The minimum number of total variables required to convert the above code segment to static single assignment form is__________ .
This solution is based on standard textbook concepts as the PDF provides only the final answer.
In Static Single Assignment (SSA) form, each variable is assigned a value exactly once. The original code has 5 input variables (u, t, v, w, z) and uses two other variables (x, y) for intermediate calculations.
The sequence of operations can be represented in a three-address code format, which is closely related to SSA. We need variables to hold the 5 inputs and at least two additional temporary variables (or registers) to store the intermediate results of calculations without overwriting the inputs. Therefore, a minimum of 5 + 2 = 7 total variables are required.
Q30GATE 0MCQ1MOperating System
Consider an arbitrary set of CPU-bound processes with unequal CPU burst lengths submitted at the same time to a computer system.Which one of the following process scheduling algorithms would minimize the average waiting time in the ready queue?
The goal is to minimize the average waiting time. For a set of processes that arrive at the same time, the Shortest Job First (SJF) scheduling algorithm is provably optimal in minimizing average waiting time. Since the processes are non-preemptive (CPU-bound) and arrive simultaneously, the Shortest Remaining Time First (SRTF) algorithm behaves identically to SJF. It will execute the process with the shortest CPU burst first, then the next shortest, and so on, which minimizes the overall waiting time for the set.
Q31GATE 0MCQ1MDatabase Management System
Which of the following is NOT a superkey in a relational schema with attributes V,W, X, Y, Z and primary key V Y?
A superkey is a set of attributes that contains a candidate key. In this relational schema, the primary key is given as VY. Since a primary key is always a candidate key, any attribute set that is a superset of {V, Y} will be a superkey.
We examine the options:
VXYZ contains VY.
VWXY contains VY.
VWXYZ contains VY.
The attribute set VWXZ does not contain the attribute Y, and therefore it is not a superset of the primary key VY. Thus, VWXZ is not a superkey.
Q32GATE 0MCQ1MDatabase Management System
Which one of the following is NOT a part of the ACID properties of database transactions?
The ACID properties are a set of fundamental guarantees for database transactions. The acronym ACID stands for:
Atomicity: Transactions are all-or-nothing.
Consistency: A transaction brings the database from one valid state to another.
Isolation: Concurrent transactions do not interfere with each other.
Durability: Once a transaction is committed, its effects are permanent.
Deadlock-freedom is a desirable characteristic of a concurrency control protocol, but it is not one of the core ACID properties.
Q33GATE 0MCQ1MDatabase Management System
A database of resear charticles in a journal uses the following schema. Which is the weakest normal form that the new database satisfies,but the old one does not?
The original schema has a primary key of (VOLUME, NUMBER, STARTPAGE, ENDPAGE). The functional dependency (VOLUME, NUMBER) → YEAR represents a partial dependency, because a non-prime attribute (YEAR) depends on a proper subset of the primary key. This violates the condition for 2NF, meaning the original schema is only in 1NF. The redesigned database splits the schema into two new relations. An analysis of these new relations shows that both satisfy the conditions for BCNF. Since the new database satisfies 2NF (and higher forms) but the old one did not, the weakest such normal form is 2NF.
Q34GATE 0MCQ1MComputer Network
Which one of the following protocols is NOT used to resolve one form of address to another one?
The question asks which protocol does not resolve one form of address to another. ARP resolves an IP address to a MAC address. RARP does the reverse, resolving a MAC address to an IP address. DNS resolves a domain name to an IP address. All three perform a mapping or resolution. DHCP, however, is a protocol used to dynamically assign an IP address and other network configuration parameters to a host. It does not resolve an existing address into another form.
Q35GATE 0MCQ1MComputer Network
Which of the following is/are example(s) of stateful application layer protocols? (i) HTTP (ii) FTP (iii) TCP (iv) POP3
The solution evaluates which of the listed protocols are both stateful and operate at the application layer. HTTP is stateless. TCP is stateful but is a transport layer protocol, not an application layer one. FTP is an application layer protocol that is stateful, as it maintains state for control and data connections, including user authorization. POP3 is also a stateful application layer protocol because it maintains state across a session, for example, to handle user authentication and track retrieved messages. Therefore, FTP (ii) and POP3 (iv) are the correct examples.
Q36GATE 0NAT2MEngineering Mathematics
The coefficient of x12 in (x3+x4+x5+x6+...)3 is ______.
The expression is (x3+x4+x5+...)3. By factoring out x3, we get (x3(1+x+x2+...))3, which simplifies to x9(1+x+x2+...)3. The infinite series is the geometric series for (1−x)−1. The expression becomes x9(1−x)−3. To find the coefficient of x12, we need the coefficient of x3 from the expansion of (1−x)−3. Using the binomial theorem for a negative exponent, the coefficient of xr in (1−x)−n is (rn+r−1). For n=3 and r=3, the coefficient is (33+3−1)=(35)=10.
Q37GATE 0NAT2MDiscrete Mathematics
Consider the recurrence relation a1 =8, an=6n2+2n+an−1 . Let a99=K×104 . The value of K is .
The recurrence relation is an=6n2+2n+an−1 with a1=8. By expanding the relation for a99, we get a99=∑i=299(6i2+2i)+a1. We can observe that the initial condition a1=8 is equal to 6(12)+2(1). Therefore, the expression for a99 can be written as a complete sum from i=1: a99=∑i=199(6i2+2i). Using the formulas for the sum of the first k integers and squares, this evaluates to 9900×(199+1)=1980000=198×104. Thus, the value of K is 198.
Q38GATE 0NAT2MDiscrete Mathematics
A function f:N+→N+ , defined on the set of positive integers N+ , satisfies the following properties: f(n)=f(n/2) if n is even f(n)=f(n+5) if n is odd Let R={ i∣∃j:f(j)=i } be the set of distinct values that f takes. The maximum possible size of R is ____.
The function's behavior is analyzed by tracing values. For any even number n, f(n)=f(n/2). For any odd number n, f(n)=f(n+5).
f(1)=f(6)=f(3)=f(8)=f(4)=f(2)=f(1). Also f(7)=f(12)=f(6), and f(9)=f(14)=f(7). This group of values all map to a single output value, let's call it v1.
f(5)=f(10)=f(5). This forms a second distinct output value, v2.
The values explored in point 1, such as f(6),f(7),f(9), form a third distinct value group, v3.
Any integer n will eventually fall into one of these three recursive patterns. Therefore, the set R of distinct values contains a maximum of 3 elements.
Q39GATE 0NAT2MDiscrete Mathematics
Consider the following experiment. Step 1. Flip a fair coin twice. Step 2. If the outcomes are(TAILS, HEADS) then output Y and stop. Step 3. If the outcomes are either(HEADS, HEADS) or(HEADS, TAILS), then output N and stop. Step 4. If the out comes are(TAILS, TAILS), then go to Step1. The probability that the output of the experiment is Y is (up to two decimal places)_____.
The experiment involves flipping a fair coin twice. The four possible outcomes (HH, HT, TH, TT) each have a probability of 1/4.
The experiment outputs Y on (TAILS, HEADS), so P(Y)=1/4.
The experiment repeats on (TAILS, TAILS), so P(repeat)=1/4.
The output can be Y on the first try, or after one repeat, or after two repeats, and so on. This forms an infinite geometric series for the total probability of Y: P(Total Y)=41+(41)(41)+(41)2(41)+…
This is a series with first term a=1/4 and common ratio r=1/4. The sum is S=1−ra=1−1/41/4=3/41/4=31≈0.33.
Q40GATE 0MCQ2MDigital Logic
Consider the two cascaded 2-to-1 multiplexers as shown in the figure. The minimal sum of products form of the output X is
The output of a 2-to-1 multiplexer with select line S and inputs I0,I1 is given by SˉI0+SI1.
For the first MUX, the select line is P, I0=0, and I1=R. Its output is Pˉ(0)+P(R)=PR.
This output PR is the I1 input for the second MUX.
For the second MUX, the select line is Q, I0=R, and I1=PR.
The final output X is Qˉ(R)+Q(PR)=QˉR+PQR.
Q41GATE 0NAT2MComputer Organization
The size of the data count register of a DMA controller is 16 bits.The processor needs to transfer a file of 29,154 kilobytes from disk to main memory.The memory is byte addressable. The minimum number of times the DMA control lerneeds to get the control of the systembus from the processor to transfer the file from the disk to main memory is ____.
The DMA controller's data count register size is 16 bits. This means the maximum amount of data that can be transferred in a single DMA operation is 216 bytes. 216 bytes = 65,536 bytes = 64 kilobytes (KB).
The total size of the file to be transferred is 29,154 KB.
To find the minimum number of times the DMA controller must take control of the bus, we divide the total file size by the maximum size per transfer:
Number of transfers = ⌈64 KB29,154 KB⌉=⌈455.53125⌉=456.
Each transfer, including the final partial one, requires the DMA controller to acquire the bus.
Q42GATE 0NAT2MComputer Organization
The stage delays in a 4-stage pipeline are 800,500,400 and 300 picoseconds.The first stage (with delay 800 picoseconds)is replaced with a functionally equivalent design involving two stages with respective delays 600 and 350 picoseconds.The throughput increase of the pipeline is ________ percent.
The throughput of a pipeline is inversely proportional to its cycle time, which is the delay of the longest stage.
Original pipeline (P1): Delays are (800, 500, 400, 300) ps. The maximum delay is 800 ps. Throughput TP1∝1/800.
New pipeline (P2): The 800 ps stage is replaced by two stages (600, 350) ps. The new delays are (600, 350, 500, 400, 300) ps. The new maximum delay is 600 ps. Throughput TP2∝1/600.
The percentage increase in throughput is: TP1TP2−TP1=1/8001/600−1/800=600800−1=34−1=31≈33.33%
The value 33.28% in the provided solution arises from intermediate rounding.
Q43GATE 0MCQ2MAlgorithm
Consider a carry lookahead adder for adding two n-bit integers,built using gates of fan-in at most two. The time to perform addition using this adder is
A carry-lookahead adder (CLA) computes carry signals in parallel, which speeds up the addition process compared to a ripple-carry adder. When using gates with a limited fan-in (at most two, as specified), the logic for generating carries for blocks of bits is structured hierarchically. This creates a tree-like circuit. The depth of this tree determines the overall propagation delay. For an n-bit adder, the depth of this hierarchical structure is proportional to log(n), leading to a time complexity of Θ(log(n)).
Q44GATE 0MCQ2MC Programming
The following function computes the maximum value contained in an integer array p[] of size n (n>=1).
int max(int*p, int n) {
int a=0,b=n-1;
while (__________) {
if (p[a]<=p[b]) {
a=a+1;
} else {
b=b-1;
}
}
return p[a];
}
The function finds the maximum value by using two pointers, a starting from index 0 and b from n-1. In each iteration of the while loop, it compares p[a] and p[b] and moves the pointer corresponding to the smaller element inward. This process effectively discards the smaller of the two boundary elements. The loop should continue until both pointers converge on the same element, which will be the maximum value. The condition b != a ensures the loop terminates precisely when a and b point to the same index.
Q45GATE 0MCQ2MC Programming
What will be the output of the following C program?
The execution is traced assuming dynamic scoping and pass-by-reference.
main calls m(a). Global a is 3. y in m is a reference to global a.
In m, a=1 creates a new local variable a. Then a = y - a evaluates to a = 3 - 1 = 2. So, m's local a is 2.
n(a) is called. Per the PDF's logic, this behaves like pass-by-value, so x in n gets the value 2.
In n, x = x * a. With dynamic scoping, a refers to the a in the caller m, which is 2. So, x = 2 * 2 = 4. print(x) outputs 4.
n returns. Since the call was effectively pass-by-value, m's local a is unchanged and remains 2. print(a) in m outputs 2.
Q47GATE 0MCQ2MData Structure
An operator delete(i) for a binary heap data structure is to be designed to delete the item in the i-th node.Assume that the heap is implemented in an array and i refers to the i-th index of thearray.If the heap tree has depth d (number of edges on the path from the root to the farthest leaf),the n what is the time complexity to re-fix the heap efficiently after the removal of the element?
To delete an element at index i in a binary heap, the standard algorithm replaces it with the last element of the heap. Then, the heap size is decremented. The new element at index i might violate the heap property. To restore it, the element is either sifted up (compared with its parent) or sifted down (compared with its children) until its correct position is found. In the worst-case scenario, this element might need to travel from the root to a leaf (or vice-versa), a path of length equal to the heap's depth, d. Therefore, the time complexity is O(d).
Q48GATE 0NAT2MAlgorithm
Consider the weighted undirected graph with 4 vertices,where the weigh to edge {i, j} is given by the entry Wij in the matrix W.
W=02852058850x58x0
The largest possible integer value of x, for which at least one shortest path between some pair of vertices will contain the edge with weight x is ____.
The solution in the provided PDF is 11. This can be derived by finding the condition under which the edge with weight x becomes part of a unique shortest path.
Let the vertices be 1, 2, 3, and 4. The edge in question is (3, 4) with weight x. To determine if this edge is on a shortest path, we compare its weight to the shortest alternative path between vertices 3 and 4.
The alternative paths between 3 and 4 are:
3-1-4: weight 8 + 5 = 13
3-2-4: weight 5 + 8 = 13
3-2-1-4: weight 5 + 2 + 5 = 12
The shortest alternative path has a weight of 12. For the direct edge (3, 4) to be the unique shortest path, its weight x must be strictly less than the weight of any other path. Therefore, we must have x<12. The largest integer value of x that satisfies this condition is 11.
Q49GATE 0NAT2MAlgorithm
Let G be a complete undirected graph on 4 vertices, having 6 edges with weights being 1,2,3,4,5, and 6. The maximum possible weight that a minimum weight spanning tree of G can haveis .
G = (V,E) is an undirected simple graph in which each edge has a distinct weight,and e is a particular edgeof G. Which of the following statements about the minimum spanning trees (MSTs) of G is/are TRUE? I. If e is the lightest edge of some cycle in G, then every MST of G includes e II. If e is the heaviest edge of some cycle in G, then every MST of G excludes e
Let Q denote a queue containing sixteen numbers and S be an empty stack. Head(Q) returns the element at the head of the queue Q without removing it from Q. Similarly Top(S) returns the element at the top of S without removing it from S. Consider the algorithm given below. The maximum possible number of iterations of the while loop in the algorithm is_________.
Consider the following context-free grammars: G1: S → aS|B, B → b|bB G2: S → aA|bB, A → aA|B| ε , B → bB| ε Which one of the following pair of languages is generated by G1 and G2, respectively?
Consider the transition diagram of a PDA given below with input alphabet Σ ={a,b} and stack alphabet Γ ={X,Z}. Z is the initial stack symbol. Let L denote the language accepted by the PDA. Which one of the following is TRUE?
The PDA accepts the language L={anbn∣n≥0}. The initial state must be an accepting state to include the empty string ϵ (for n=0). For n≥1, the PDA first pushes n 'X's onto the stack while reading n 'a's in the initial state. Then, it transitions to the final state, reading 'b's and popping an 'X' for each 'b'. The language {anbn∣n≥0} is a standard example of a context-free language that is not regular. Therefore, it cannot be accepted by any finite automaton.
Q54GATE 0MCQ2MTheory of Computation
Let X be a recursive language and Y be a recursively enumerable but not recursive language. Let W and Z be two languages such that Yˉ reduces to W, and Z reduces to Xˉ (reduction means the standard many-one-reduction). Which one of the following statements is TRUE?
We are given that X is a recursive (REC) language, and Y is recursively enumerable (RE) but not REC.
From the reduction Z≤mXˉ: Since X is REC, its complement Xˉ is also REC. A language that reduces to a REC language must also be REC. Therefore, Z is recursive.
From the reduction Yˉ≤mW: Since Y is RE but not REC, its complement Yˉ is not RE. If W were RE, then Yˉ would also have to be RE, which is a contradiction. Therefore, W is not recursively enumerable.
Q55GATE 0NAT2MC Programming
The attributes of three arithmetic operators in some programming language are given below. The value of the expression 2-5+1-7*3 in this language is_______ .
The expression is 2 - 5 + 1 - 7 * 3. The evaluation depends on the given operator precedence (High: +, Medium: -, Low: *) and associativity (Left: +, *, Right: -).
The highest precedence operator is +. We evaluate 5 + 1 first: 2 - 6 - 7 * 3.
The next highest is -, which is right-associative. This means a - b - c is evaluated as a - (b - c). So, we evaluate 6 - 7 next: 2 - (-1) * 3.
This simplifies to 3 * 3.
The final operation is *, resulting in 9.
Q56GATE 0MCQ2MCompiler Design
Consider the following Syntax Directed Translation Scheme(SDTS),with non-terminals {S, A} and terminals {a, b}. S → aA {print 1} S → a { print 2} A → Sb { print 3} Using the above SDTS, the output printed by a bottom-up parser, for the input aab is:
Consider a computer system with 40-bit virtual addressing and page size of sixteen kilobytes. If the computer system has a one level page table per process and each page table entry requires 48 bits, then the size of the per-process page table is _________ mega bytes.
Consider a disk queue with requests for I/O to blocks on cylinders 47,38,121,191,87,11, 92, 10. The C-LOOK scheduling algorithm is used. The head is initially at cylinder number 63, moving to wards larger cylinder numbers on its servicing pass. The cylinders are numbered from 0to 199. The total head movement (in number of cylinders) incurred while servicing these requests is____ .
The C-LOOK algorithm services requests in one direction and then jumps to the first request in the opposite direction to continue service, without traveling to the end of the disk.
The head starts at cylinder 63, moving towards larger numbers. It services requests at 87, 92, 121, and finally 191.
After servicing 191, it jumps to the smallest pending request, which is 10.
From 10, it moves towards larger numbers again, servicing 11, 38, and 47.
The total head movement is the sum of movements between each serviced cylinder: (87−63)+(92−87)+(121−92)+(191−121)+(191−10)+(11−10)+(38−11)+(47−38)=346.
Q59GATE 0NAT2MOperating System
Consider a computer system with ten physical page frames. The system is provided with an accessse quence (a1,a2,...,a20,a1,a2,...,a20) , where each ai is a distinct virtual page number. The difference in the number of page faults between the last-in-first-outpage replacement policy and the optimal page replacement policy is ______.
The solution demonstrates the concept by analyzing a smaller, analogous problem: a sequence of (1, 2, 3, 4, 1, 2, 3, 4) with 2 page frames.
For this smaller example:
LIFO (Last-In-First-Out): Results in 7 page faults.
Optimal: Results in 6 page faults.
The difference is 7−6=1.
This pattern holds for the original problem. For the first 20 distinct pages, both algorithms will have 20 faults. The difference in performance occurs during the second pass of the sequence. Generalizing from the smaller example, the difference in the number of page faults between the LIFO and Optimal policies is 1.
Q60GATE 0MCQ2MOperating System
Consider the following proposed solution for the critical section problem. There are n processes: P0...Pn−1 . In the code,function pmax returns an integer not smaller than any of its arguments. For all i, t[i] is initialized to zero. Which one of the following is TRUE about the above solution?
The provided algorithm ensures mutual exclusion. A process Pi must acquire a ticket number t[i] before entering its critical section. It then waits for any other process Pj that has a smaller or equal ticket number (t[j]≤t[i]). If two processes, Pi and Pj, attempt to enter the critical section, the one with the smaller ticket number will proceed while the other waits. If they happen to acquire the same ticket number, they will both wait for each other, preventing simultaneous entry. Thus, at most one process can be in the critical section at any time.
Q61GATE 0MCQ2MDatabase Management System
Consider the following two phase locking protocol. Suppose a transaction T accesses (for read or write operations), a certain set of objects {O1,... ,Ok}. This is done in the following manner: Step 1. T acquires exclusive locks to O1,...,Ok in increasing order of their addresses. Step 2. The required operations are performed. Step 3. All locks are released. This protocol will
Consider that B wants to send a message m that is digitally signed to A. Let the pair of private and public keys for A and B be denoted by Kx− and Kx+ for x = A,B, respectively. Let Kx(m) represent the operation of encrypting m with a key Kx and H(m) represent the message digest. Which one of the following indicates the CORRECT way of sending the message m along with the digital signature to A?
An IP datagram of size 1000 bytes arrives at a router. The router has to forward this packet on a link whose MTU (maximum transmission unit)is 100bytes. Assume that the size of the IP header is 20bytes. The number of fragments that the IP datagram will be divided into for transmission is _________.
The total data payload to be transmitted is the datagram size minus the header size, which is 1000−20=980 bytes. The maximum transmission unit (MTU) is 100 bytes, so the maximum data payload per fragment is the MTU minus the header size, or 100−20=80 bytes. To find the number of fragments, we divide the total data payload by the maximum payload per fragment: ⌈80980⌉=⌈12.25⌉=13. Therefore, 13 fragments are required.
Q64GATE 0NAT2MComputer Network
For a host machine that uses the token bucket algorithm for congestion control, the token bucket has a capacity of 1 megabyte and the maximum output rate is 20 megabytes per second. Tokens arrive at a rate to sustain output at a rate of 10megabytes per second. The token bucket is currently full and the machine needs to send 12megabytes of data. The minimum time required to transmit the data is _____seconds.
First, we determine the duration (S) for which the host can transmit at its maximum rate (M) using the initial tokens in the bucket (C). The governing equation is C+ρS=MS, where ρ is the token arrival rate.
Substituting the values: 1 MB+(10 MBps)×S=(20 MBps)×S.
Solving for S, we get S=0.1 seconds.
In this time, data transmitted is M×S=20 MBps×0.1 s=2 MB.
Remaining data is 12 MB−2 MB=10 MB. This remaining data is sent at the token arrival rate ρ.
Time for remaining data = 10 MBps10 MB=1 second.
Total time = 0.1 s+1 s=1.1 seconds.
Q65GATE 0NAT2MComputer Network
A sender uses the Stop-and Wait ARQ protocol for reliable transmission of frames. Frames are of size 1000bytes and the transmission rate at the sender is 80Kbps(1Kbps=1000 bits/second). Size of anacknowledgement is 100bytes and the transmission rate at the receiver is 8Kbps. The one-way propagation delay is 100milliseconds. Assuming no frame is lost, the sender throughput is _____bytes/second.
Sender throughput is the amount of useful data transmitted per unit of time. For one successful frame transmission in Stop-and-Wait, the total time cycle includes the frame's transmission time (Tt), propagation delay (Tp), ACK's transmission time (Tack), and the ACK's propagation delay (Tp).
Tt=Sender rateFrame size=80×1000 bps1000×8 bits=0.1 s. Tp=100 ms =0.1 s. Tack=Receiver rateACK size=8×1000 bps100×8 bits=0.1 s.
Total cycle time = Tt+Tp+Tack+Tp=0.1+0.1+0.1+0.1=0.4 s.
Throughput = Total timeFrame size=0.4 s1000 bytes=2500 bytes/second.