GATE Overflow - Recent questions tagged descriptive
https://gateoverflow.in/tag/descriptive
Powered by Question2AnswerGATE2002-18-b
https://gateoverflow.in/205818/gate2002-18-b
<p>The functionality of atomic TEST-AND-SET assembly language instruction is given by the following C function</p>
<pre>
int TEST-AND-SET (int *x)
{
int y;
A1: y=*x;
A2: *x=1;
A3: return y;
}</pre>
<p> </p>
<ol style="list-style-type: lower-roman;">
<li>Complete the following C functions for implementing code for entering and leaving critical sections on the above TEST-AND-SET instruction. </li>
<li>
<pre>
int mutex=0;
void enter-cs()
{
while(......................);
}
void leave-cs()
{ .........................;
}</pre>
<p> </p>
</li>
<li>
<p>Is the above solution to the critical section problem deadlock free and starvation-free?</p>
<pre>
</pre>
</li>
<li>For the above solution, show by an example that mutual exclusion is not ensured if TEST-AND-SET instruction is not atomic?</li>
</ol>Operating Systemhttps://gateoverflow.in/205818/gate2002-18-bWed, 28 Feb 2018 03:27:09 +0000GATE1990-1-iv-b
https://gateoverflow.in/203832/gate1990-1-iv-b
A 32-bit floating-point number is represented by a 7-bit signed exponent, and a 24-bit fractional mantissa. The base of the scale factor is 16,<br />
<br />
The range of the exponent is ___________, if the scale factor is represented in excess-64 format.Digital Logichttps://gateoverflow.in/203832/gate1990-1-iv-bMon, 12 Feb 2018 05:07:26 +0000GATE2001-11-b
https://gateoverflow.in/203826/gate2001-11-b
<p>A sequential circuit takes an input stream of 0's and 1's and produces an output stream of 0's and 1's. Initially it replicates the input on its output until two consecutive 0's are encountered on the input. From then onward, it produces an output stream, which is the bit-wise complement of input stream until it encounters two consecutive 1's, whereupon the process repeats. An example input and output stream is shown below.</p>
<table border="0" cellpadding="1" style="border-spacing: 1px;">
<tbody>
<tr>
<td>The input stream:</td>
<td>101100|01001011</td>
<td>0|11</td>
</tr>
<tr>
<td>The desired output</td>
<td>101100|10110100</td>
<td>0|11</td>
</tr>
</tbody>
</table>
<p>J-K master-slave flip-flops are to be used to design the circuit.</p>
<p>Give the minimized sum-of-product expression for J and K inputs of one of its state flip-flops</p>Digital Logichttps://gateoverflow.in/203826/gate2001-11-bMon, 12 Feb 2018 04:40:55 +0000GATE2001-21-b
https://gateoverflow.in/203574/gate2001-21-b
<p>Consider a relation examinee (regno, name, score), where regno is the primary key to score is a real number.</p>
<p>Write an SQL query to list the <em>regno</em> of examinees who have a score greater than the average score.</p>
<ol>
</ol>Databaseshttps://gateoverflow.in/203574/gate2001-21-bThu, 08 Feb 2018 04:41:38 +0000GATE2001-21-c
https://gateoverflow.in/203573/gate2001-21-c
<p>Consider a relation examinee (regno, name, score), where regno is the primary key to score is a real number.</p>
<ol>
</ol>Databaseshttps://gateoverflow.in/203573/gate2001-21-cThu, 08 Feb 2018 04:41:34 +0000False sharing in cache Line
https://gateoverflow.in/120645/false-sharing-in-cache-line
<p>Here is pseudo code for a multiprocessing purpose:</p>
<pre class="prettyprint lang-c_cpp">
set_num_threads(NUM_THREADS);
double sum=0.0;
sum_local[NUM_THREADS];
parallel region
{
int this_thread_id = get_thread_number(); // returns 0 to (no_of_threads-1)
sum_local[this_thread_id] = 0.0;
for (i = this_thread_id; i < N; i += NUM_THREADS)
sum_local[this_thread_id] += foo(i); // foo(i) is just some other work
} // join
// main thread
for(int i=0;i<NUM_THREADS;i++)
sum += sum_local[i];
</pre>
<p> </p>
<p>Instead of using a serial program on a multicore core system if I use this parallel version the running time should reduce compared to serial version. I have dual core system. But it does not reduce time to half even if I use <code>NUM_THREADS = 2</code></p>
<p>I found this happens because of false sharing.</p>
<p>I googled and found an Intel page on false sharing. They have explained as follows:</p>
<p>There is a potential for false sharing on the array <code>sum_local</code>. This array is dimensioned according to the number of threads and is small enough to fit in a single cache line. When executed in parallel, the threads modify different, but adjacent, elements of <code>sum_local</code> (the source line shown in red), which invalidates the cache line for all processors.</p>
<p><img alt="" src="https://gateoverflow.in/?qa=blob&qa_blobid=15262462493723493468"></p>
<p><strong>Figure 1.</strong> False sharing occurs when threads on different processors modify variables that reside on the same cache line. This invalidates the cache line and forces a memory update to maintain cache coherency.</p>
<p>In <strong>Figure 1</strong>, threads $0$ and $1$ require variables that are adjacent in memory and reside on the same cache line. The cache line is loaded into the caches of CPU $0$ and CPU $1$ (gray arrows). Even though the threads modify different variables (red and blue arrows), the cache line is invalidated, forcing a memory update to maintain cache coherency.</p>
<p><strong>Later they explained more:</strong></p>
<p>To ensure data consistency across multiple caches, multiprocessor-capable Intel® processors follow the MESI (Modified/Exclusive/Shared/Invalid) protocol. On the first load of a cache line, the processor will mark the cache line as ‘Exclusive’ access. As long as the cache line is marked exclusive, subsequent loads are free to use the existing data in the cache. If the processor sees the same cache line loaded by another processor on the bus, it marks the cache line with ‘Shared’ access. If the processor stores a cache line marked as ‘S’, the cache line is marked as ‘Modified’ and all other processors are sent an ‘Invalid’ cache line message. If the processor sees the same cache line which is now marked ‘M’ being accessed by another processor, the processor stores the cache line back to memory and marks its cache line as ‘Shared’. The other processor that is accessing the same cache line incurs a cache miss.</p>
<p>The frequent coordination required between processors when cache lines are marked ‘Invalid’ requires cache lines to be written to memory and subsequently loaded. False sharing increases this coordination and can significantly degrade application performance.</p>
<p> </p>
<p>Please explain this cache line miss due to this MESI protocol. I found this interesting but I could not understand clearly what they have explained. I think frequent DRAM write back causing the problem, but not very clear, though. </p>
<p>please explain a bit. @Arjun Sir</p>CO & Architecturehttps://gateoverflow.in/120645/false-sharing-in-cache-lineSun, 05 Mar 2017 19:30:28 +0000ISI 2016 PCB C8
https://gateoverflow.in/120576/isi-2016-pcb-c8
Consider $2n$ committees, each having at least $2n$ persons, formed from a group of $4n$ persons. Prove that there exists at least one person who belongs to at least $n$ committees.Othershttps://gateoverflow.in/120576/isi-2016-pcb-c8Sun, 05 Mar 2017 03:42:44 +0000Discrete math
https://gateoverflow.in/119845/discrete-math
<p>The following is a sequence of formula,</p>
<p>$$\begin{align*} \begin{matrix} & 9*1+2 &= &11 \\ & 9*12+3 &= &111 \\ & 9*123+4 &= &1111 \\ & 9*1234+5 &= &11111 \\ \end{matrix} \\ \dots \dots \dots \dots \dots \dots \\ \end{align*}$$</p>
<p>Here numbers are in base $10$.</p>
<p><strong>(a)</strong> Establish a formula in $\sum$ notation.</p>
<p><strong>(b)</strong> Generalize that formula in for any base $b$..</p>Set Theory & Algebrahttps://gateoverflow.in/119845/discrete-mathSun, 26 Feb 2017 12:48:14 +0000Discrete Math
https://gateoverflow.in/119774/discrete-math
Prove or disprove: $\begin{align*} \log_8x = \frac{1}{2}.\log_{2}x \end{align*}$.Set Theory & Algebrahttps://gateoverflow.in/119774/discrete-mathSat, 25 Feb 2017 08:41:33 +0000Discrete math
https://gateoverflow.in/119667/discrete-math
Let $w \in \sum$$*$ be a string, with $\sum$ being the alphabet. Let $w^R$ be the reversal of string $w$, using induction prove that $(w^R)(w^R). . .(\text{for k times}) = (ww . . .(\text{for k times}))^R.$Set Theory & Algebrahttps://gateoverflow.in/119667/discrete-mathWed, 22 Feb 2017 17:40:32 +0000Discrete Math
https://gateoverflow.in/119664/discrete-math
Prove or disprove the following: for finite sets A and B, $\overline{(A - B) \cup (B - A)} = A \cap B$ . If the proposition is incorrect, do minimal modifications to the same and prove.Set Theory & Algebrahttps://gateoverflow.in/119664/discrete-mathWed, 22 Feb 2017 17:08:35 +0000Discrete math
https://gateoverflow.in/119662/discrete-math
Prove the following: $3 \; | \;\left ( a^2+b^2 \right )$ if and only if $3 \; | \;a$ and $3 \; | \;b$.Set Theory & Algebrahttps://gateoverflow.in/119662/discrete-mathWed, 22 Feb 2017 17:03:31 +0000Stable sorting algorithms
https://gateoverflow.in/119550/stable-sorting-algorithms
Show that any comparison based sorting algorithm can be made stable without increasing its complexity beyond a constant factor.Algorithmshttps://gateoverflow.in/119550/stable-sorting-algorithmsTue, 21 Feb 2017 11:00:23 +0000CMI2016-B-7ai
https://gateoverflow.in/98777/cmi2016-b-7ai
Consider the funciton $M$ defined as follows:<br />
<br />
$M(n) = \begin{cases} n-10 & \text{ if } n > 100 \\ M(M(n+11)) & \text{ if } n \leq 100 \end{cases}$<br />
<br />
Compute the following:<br />
<br />
M(101)Othershttps://gateoverflow.in/98777/cmi2016-b-7aiSat, 31 Dec 2016 07:48:31 +0000CMI2016-B-7b
https://gateoverflow.in/98776/cmi2016-b-7b
Consider the funciton $M$ defined as follows:<br />
<br />
$M(n) = \begin{cases} n-10 & \text{ if } n > 100 \\ M(M(n+11)) & \text{ if } n \leq 100 \end{cases}$<br />
<br />
Give a constant time algorithm that computes $M(n)$ on input $n$. (A contant-time algorithm is one whose running time is independent of the input $n$)Othershttps://gateoverflow.in/98776/cmi2016-b-7bSat, 31 Dec 2016 07:48:20 +0000CMI2016-B-7aiii
https://gateoverflow.in/98775/cmi2016-b-7aiii
Consider the funciton $M$ defined as follows:<br />
<br />
$M(n) = \begin{cases} n-10 & \text{ if } n > 100 \\ M(M(n+11)) & \text{ if } n \leq 100 \end{cases}$<br />
<br />
Compute the following:<br />
<br />
M(87)Othershttps://gateoverflow.in/98775/cmi2016-b-7aiiiSat, 31 Dec 2016 07:46:31 +0000CMI2016-B-7aii
https://gateoverflow.in/98773/cmi2016-b-7aii
Consider the funciton $M$ defined as follows:<br />
<br />
$M(n) = \begin{cases} n-10 & \text{ if } n > 100 \\ M(M(n+11)) & \text{ if } n \leq 100 \end{cases}$<br />
<br />
Compute the following:<br />
<br />
M(99)Othershttps://gateoverflow.in/98773/cmi2016-b-7aiiSat, 31 Dec 2016 07:45:44 +0000CMI2016-B-6
https://gateoverflow.in/98766/cmi2016-b-6
<p>An automatic spelling checker works as follows. Given a word $w$, first check if $w$ is found in the dictionary. If $w$ is not in the dictionary, compute a dictionary entry that is close to $w$. For instance if the user types $\mathsf{ocurrance}$, the spelling checker should suggest $\mathsf{occurence}$, which belongs to the dictionary. Similarity between words such as $\mathsf{occurrence}$ and $\mathsf{occurrance}$ is quantified in terms of $alignment$.
<br>
<br>
An alignment between two strings $w1$ and $w2$ (over the alphabet $\{ \mathsf{a, b, c, ...., z} \}$) is obtained by inserting hyphens in the two strings such that the modified strings $align$ (i.e.,the modified strings are of equal length, and at each position, either both strings have the same letter or one of the strings has a hyphen).
<br>
<br>
here are three examples of alignments. The first is between $\mathsf{ocurrance}$ and $\mathsf{occurrence}$ and the second and third are between $\mathsf{ctatg}$ and $\mathsf{ttaagc}$.</p>
<table border="0" cellpadding="1" style="width:500px; border-spacing: 1px;">
<tbody>
<tr>
<td>(1)</td>
<td>
<p>oc-urr-ance</p>
<p>occurre-nce</p>
</td>
<td>(2)</td>
<td>
<p>ct-at-g-</p>
<p>-tta-agc</p>
</td>
<td>(3)</td>
<td>
<p>ctat---g-</p>
<p>---ttaagc</p>
</td>
</tr>
</tbody>
</table>
<p>A $mismatch$ in an alignment is a position where one of modified strings has a hyphen and the other does not. There are three mismatches in the first alignment given above, five mismatches in the second, and seven mismatches in the third.
<br>
<br>
use dynamic programming to give an efficient algorithm that takes two strings $x$ and $y$ (over teh alphabet $\{ \mathsf{a, b, c, ... , z} \}$ as its input, and computes the minimum number of mismatches among all alignments of $x$ and $y$. What is the running time of your algorithm (in terms of the lengths of $x$ and $y$)?</p>Othershttps://gateoverflow.in/98766/cmi2016-b-6Sat, 31 Dec 2016 07:31:54 +0000CMI2016-B-5
https://gateoverflow.in/98506/cmi2016-b-5
For a string $x=a_0a_1 \ cdots a_{n-1}$ over the alphabet $\{0, 1, 2\}$, define $val(x)$ to be the value of $x$ interpreted as a ternary number, where $a_0$ is the most significant digit. More formally, $val(x)$ is given by $$ \Sigma_{0 \leq i < n} 3^{n-1-i} \cdot a_i.$$<br />
<br />
Design a finite automaton that accepts exactly the set of strings $ x \in \{0, 1, 2\}^*$ such that $val(x)$ is divisible by 4.Othershttps://gateoverflow.in/98506/cmi2016-b-5Fri, 30 Dec 2016 16:31:46 +0000CMI2016-B-4
https://gateoverflow.in/98501/cmi2016-b-4
Let $\Sigma - \{0, 1\}$. Let $A, \: B$ be arbitrary subsets of $\Sigma^*$. We define the following operatins on such sets:<br />
<br />
$$ A+B := \{ w \in \Sigma^* \mid w \in A \text{ or } w \in B \}$$<br />
<br />
$$A \cdot B := \{ uv \in \Sigma^* \mid u \in A \text{ and } v \in B \} $$<br />
<br />
$$ 2A := \{ ww \in \Sigma^* \mid w \in A \}$$<br />
<br />
Is it true that $(A+B) \cdot (A+B) = A \cdot A + B \cdot B +2(A \cdot B)$ for all choices of $A$ and $B$? If yes, give a proof. If not, provide suitable $A$ and $B$ for which this equation fails.Othershttps://gateoverflow.in/98501/cmi2016-b-4Fri, 30 Dec 2016 16:12:14 +0000CMI2016-B-3
https://gateoverflow.in/98391/cmi2016-b-3
<p>An undirected graph canbe converted into a directed graph by choosing a direction for every edge. Here is an example:</p>
<p><img alt="" src="https://gateoverflow.in/?qa=blob&qa_blobid=3499310542156286665"></p>
<p>Show that for every undirected graph, there is a way of choosing directions for its edges so that the resulting directed graph has no directed cycles.</p>Othershttps://gateoverflow.in/98391/cmi2016-b-3Fri, 30 Dec 2016 08:44:07 +0000CMI2016-B-2b
https://gateoverflow.in/98389/cmi2016-b-2b
A $\textit{simple path}$ (respectively cycle) in a graph is a path (respectively cycle) in which no edge or vertex os repeated. The $length$ of such a path (respectively cycle) is the number of edges in the path (respectively cycle).<br />
<br />
Let $G$ be an undirected graph with minimum degree $k \geq 2$.<br />
<br />
Show that $G$ contains a simple cycle of length at least $k+1$.Othershttps://gateoverflow.in/98389/cmi2016-b-2bFri, 30 Dec 2016 08:40:18 +0000CMI2016-B-2a
https://gateoverflow.in/98388/cmi2016-b-2a
A $\textit{simple path}$ (respectively cycle) in a graph is a path (respectively cycle) in which no edge or vertex os repeated. The $length$ of such a path (respectively cycle) is the number of edges in the path (respectively cycle).<br />
<br />
Let $G$ be an undirected graph with minimum degree $k \geq 2$.<br />
<br />
Show that $G$ contains a simple path of length at least $k$.Othershttps://gateoverflow.in/98388/cmi2016-b-2aFri, 30 Dec 2016 08:40:12 +0000CMI2016-B-1
https://gateoverflow.in/98385/cmi2016-b-1
<p>A group of war prisoners are trying to escape from a prison. They have thoroughly planned teh escape from the prison itself, and after that they hope to find shelter in a nearby village. However, the village (marked as $B$, see picture below) and the prison (marked as $A$) are separated by a canyon which is also guarded by soldiers (marked as $S$). These soldiers sit in their pickets and rarely walk; the range of view of each soldier is limited to exactly 100 meters. Thus, depending on the locations of soldiers, it may be possible to pass the canyon safely, keeping the distance to the closest soldier strictly larger than 100 meters from any moment. The situation is depicted in the following picture, where the circles around $S$ indicate the range of view.</p>
<p><img alt="" src="https://gateoverflow.in/?qa=blob&qa_blobid=11863072934403472507"></p>
<p>Provide an algorithm to determine if the prisoners can pass the canyon unnoticed, given the width and the length of a canyon and teh coordinated of every soldier in the canyon, and assuming that soldiers do not change their locations ($Hint$: Model this as a graph, with soldiers represented by the vertices.)</p>Othershttps://gateoverflow.in/98385/cmi2016-b-1Fri, 30 Dec 2016 08:34:34 +0000GATE1988-17i-ii-iii
https://gateoverflow.in/94649/gate1988-17i-ii-iii
<ol style="list-style-type:lower-roman">
<li>The following table gives the cost of transporting one tonne of goods from the origins A, B, C to the destinations F, G, H. Also shown are the availabilities of the goods at the origins and the requirements at the destinations. <img alt="" src="https://gateoverflow.in/?qa=blob&qa_blobid=15650573197188366844">
<p>The transportation problem implied by this table can also be written in the form</p>
<p>$$\text{minimize} \: \: \underline{c} \: ^T \: \underline{x}$$</p>
<p>$$\text{subject to :} \: \: Ax= \underline{b}$$</p>
<p>$$ \underline{x} \geq 0$$</p>
<p>Display $\underline{c} \: ^T , A$ and $\underline{b}$ if $\underline{x}$ is the vector</p>
<p>(XAF, XAG, XAH, XAH, XBF, XBG, XBH, XCF, XCG, XCH)</p>
Where $x_{ij}$ represents the shipment from $i$ to $j$.</li>
<li>
<p>Given that XAG, XBH, XCF, XC are the variable in the basis, solve for the values of these variables in the above question(i).</p>
</li>
<li>
<p>For the solution of (ii) above, calculate the values of the duals and determine whether this is an optimal solution.</p>
</li>
</ol>Othershttps://gateoverflow.in/94649/gate1988-17i-ii-iiiTue, 20 Dec 2016 05:26:18 +0000GATE1988-16ii-iii
https://gateoverflow.in/94646/gate1988-16ii-iii
If $x \| \underline{x} \| \infty = 1< i^{max} < n \: \: max \: \: ( \mid x1 \mid ) $ for the vector $\underline{x} = (x1, x2 \dots x_n)$ and $\| A \| \infty = x^{Sup} \frac{\| A \underline{x} \| \infty}{\| \underline{x} \| \infty}$ is the corresponding matrix norm, calculate $\| A \|_o$ for the matrix $A=\begin{bmatrix} 2 & 5 & 9 \\ 4 & 6 & 5 \\ 8 & 2 & 3 \end{bmatrix}$ using a known property of this norm.<br />
<br />
Although this norm is very easy to calculate for any matrix, explain why the condition number is difficult (i.e. expensive) to calculate.Linear Algebrahttps://gateoverflow.in/94646/gate1988-16ii-iiiTue, 20 Dec 2016 05:19:50 +0000GATE1988-16i
https://gateoverflow.in/94644/gate1988-16i
Assume that the matrix $A$ given below, has factorization of the form $LU=PA$, where $L$ is lower-triangular with all diagonal elements equal to 1, $U$ is upper-triangular, and $P$ is a permutation matrix. For<br />
<br />
$A = \begin{bmatrix} 2 & 5 & 9 \\ 4 & 6 & 5 \\ 8 & 2 & 3 \end{bmatrix}$<br />
<br />
Compute $L, U,$ and $P$ using Gaussian elimination with partial pivoting.Linear Algebrahttps://gateoverflow.in/94644/gate1988-16iTue, 20 Dec 2016 05:17:56 +0000GATE1988-15
https://gateoverflow.in/94642/gate1988-15
<p>Consider the DFA $M$ and NFA M2 as defined below. Let the language accepted by machine $M$ be $L$. What language machine M2 accepts, if</p>
<ol style="list-style-type:lower-roman">
<li>$F2=A$ ?</li>
<li>$F2=B$ ?</li>
<li>$F2=C$ ?</li>
<li>$F2=D$ ?</li>
</ol>
<ul>
<li>$M=(Q, \Sigma, \delta, q_0, F)$</li>
<li>$M2=(Q2, \Sigma, \delta_2, q_{00}, F2)$</li>
</ul>
<p>where</p>
<p>$Q2=(Q \times Q \times Q) \cup \{ q_{00} \}$</p>
<p>$\delta_2 (q_{00}, \epsilon) = \{ \langle q_0, q, q \rangle \mid q \in Q\}$</p>
<p>$\delta_2 ( \langle p, q, r \rangle, \sigma ) = \langle \delta (p, \sigma), \delta (q, \sigma), r \rangle$</p>
<p>for all $p, q, r \in Q$ and $\sigma \: \in \: \Sigma$</p>
<p>$A=\{ \langle p, q, r \rangle \mid p \in F; q, r \in Q \}$</p>
<p>$B=\{\langle p, q, r \rangle \mid q \in F; p, r \in Q\}$</p>
<p>$C=\{\langle p, q, r \rangle \mid p, q, r \in Q; \exists s \in \Sigma^* ( \delta (p,s) \in F) \}$</p>
<p>$D=\{\langle p, q, r \rangle \mid p \in Q; q \in F\}$</p>Theory of Computationhttps://gateoverflow.in/94642/gate1988-15Tue, 20 Dec 2016 05:13:57 +0000GATE1988-14ii
https://gateoverflow.in/94640/gate1988-14ii
<p>Consider the following well-formed formula:</p>
<ul>
<li>$\exists x \forall y [ \neg \exists z [ p (y, z) \wedge p (z, y) ] \equiv p(y)$</li>
</ul>
<p>
<br>
Show using resolution principle that the well-formed formula, given above, cannot be satisfied for any interpretation.</p>Mathematical Logichttps://gateoverflow.in/94640/gate1988-14iiTue, 20 Dec 2016 05:08:39 +0000GATE1988-14i
https://gateoverflow.in/94639/gate1988-14i
<p>Consider the following well-formed formula:</p>
<ul>
<li>$\exists x \forall y [ \neg \: \exists z [ p (y, z) \wedge p (z, y) ] \equiv p(y)$</li>
</ul>
<p>
<br>
Express the above well-formed formula in clause form.</p>Mathematical Logichttps://gateoverflow.in/94639/gate1988-14iTue, 20 Dec 2016 05:06:05 +0000GATE1988-13iv
https://gateoverflow.in/94637/gate1988-13iv
<p>Solve the recurrence equations:</p>
<ul>
<li>$T(n)= T( \frac{n}{2})+1$</li>
<li>$T(1)=1$</li>
</ul>Algorithmshttps://gateoverflow.in/94637/gate1988-13ivTue, 20 Dec 2016 05:05:05 +0000GATE1988-13iii
https://gateoverflow.in/94636/gate1988-13iii
<p><img alt="" src="https://gateoverflow.in/?qa=blob&qa_blobid=11769911094076315028"></p>
<p>Are the two diagraphs shown in the above figure isomorohic? Justify your answer.</p>Graph Theoryhttps://gateoverflow.in/94636/gate1988-13iiiTue, 20 Dec 2016 05:02:50 +0000GATE1988-13ii
https://gateoverflow.in/94634/gate1988-13ii
If the set $S$ has a finite number of elements, prove that if $f$ maps $S$ onto $S$, then $f$ is one-to-one.Set Theory & Algebrahttps://gateoverflow.in/94634/gate1988-13iiTue, 20 Dec 2016 05:01:29 +0000GATE1988-13ic
https://gateoverflow.in/94633/gate1988-13ic
Verify whether the following mapping is a homomorphism. If so, determine its kernel.<br />
<br />
$f(x)=x^3$, for all $x$ belonging to $G$.Set Theory & Algebrahttps://gateoverflow.in/94633/gate1988-13icTue, 20 Dec 2016 04:59:42 +0000GATE1988-13ib
https://gateoverflow.in/94631/gate1988-13ib
Verify whether the following mapping is a homomorphism. If so, determine its kernel.<br />
<br />
$\bar{G}=G$Set Theory & Algebrahttps://gateoverflow.in/94631/gate1988-13ibTue, 20 Dec 2016 04:58:00 +0000GATE1988-13ia
https://gateoverflow.in/94630/gate1988-13ia
Verify whether the following mapping is a homomorphism. If so, determine its kernel.<br />
<br />
$G$ is the group of non zero real numbers under multiplication.Set Theory & Algebrahttps://gateoverflow.in/94630/gate1988-13iaTue, 20 Dec 2016 04:57:27 +0000GATE1988-12iv
https://gateoverflow.in/94626/gate1988-12iv
<pre class="prettyprint lang-sql">
Select SNAME
from S
Where SNOin
(select SNO
from SP
where PNOin
(select PNO
from P
Where COLOUR='BLUE'))</pre>
<p>What relations are being used in the above SQL query? Given at least two attributes of each of these relations.</p>Databaseshttps://gateoverflow.in/94626/gate1988-12ivTue, 20 Dec 2016 04:56:15 +0000GATE1988-12iii
https://gateoverflow.in/94625/gate1988-12iii
<p>Describe the relational algebraic expression giving the relation returned by the following SQL query.</p>
<pre class="prettyprint lang-sql">
Select SNAME
from S
Where SNOin
(select SNO
from SP
where PNOin
(select PNO
from P
Where COLOUR='BLUE'))</pre>
<p> </p>Databaseshttps://gateoverflow.in/94625/gate1988-12iiiTue, 20 Dec 2016 04:55:05 +0000GATE1988-12iic
https://gateoverflow.in/94619/gate1988-12iic
Using Armstrong’s axioms of functional dependency derive the following rules:<br />
<br />
$\{ x \rightarrow y, \: z \subset y \} = x \rightarrow z$<br />
<br />
(Note: $x \rightarrow y$ denotes $y$ is functionally dependenet on $x$, $z \subseteq y$ denotes $z$ is subset of $y$, and $\mid =$ means derives).Databaseshttps://gateoverflow.in/94619/gate1988-12iicTue, 20 Dec 2016 04:46:14 +0000GATE1988-12iib
https://gateoverflow.in/94618/gate1988-12iib
Using Armstrong’s axioms of functional dependency derive the following rules:<br />
<br />
$\{ x \rightarrow y. \: wy \rightarrow z \} = xw \rightarrow z$<br />
<br />
(Note: $x \rightarrow y$ denotes $y$ is functionally dependenet on $x$, $z \subseteq y$ denotes $z$ is subset of $y$, and $\mid =$ means derives).Databaseshttps://gateoverflow.in/94618/gate1988-12iibTue, 20 Dec 2016 04:41:16 +0000GATE1988-12iia
https://gateoverflow.in/94399/gate1988-12iia
Using Armstrong’s axioms of functional dependency derive the following rules:<br />
<br />
$\{ x \rightarrow y, \: x \rightarrow z \} = x \rightarrow yz$<br />
<br />
(Note: $x \rightarrow y$ denotes $y$ is functionally dependenet on $x$, $z \subseteq y$ denotes $z$ is subset of $y$, and $\mid =$ means derives).Databaseshttps://gateoverflow.in/94399/gate1988-12iiaMon, 19 Dec 2016 08:56:25 +0000GATE1988-12i
https://gateoverflow.in/94398/gate1988-12i
What are the three axioms of functional dependency for the relational databases given by Armstrong.Databaseshttps://gateoverflow.in/94398/gate1988-12iMon, 19 Dec 2016 08:55:58 +0000GATE1988-11
https://gateoverflow.in/94397/gate1988-11
<p>A number of processes could be in a deadlock state if none of them they execute due to non-availability of sufficient resources. Let $P_i, 0 \leq i \leq 4$ represent five processes and let there be four resources types $r_j, 0 \leq j \leq 3$. Suppose the following data structures have been used.</p>
<p><strong>Available:</strong> A vector of length 4 such that if Available $[i]=k$, there are k instances of resource type $r_j$ available in the system.</p>
<p><strong>Allocation. </strong>A 5 $\times$ 4 matrix defining the number of each type currently allocated to each process. If Allocation $[i,j]=k$ then process $p_i$ is currently allocated $k$ instances of resource type $r_j$.</p>
<p><strong>Max.</strong> A 5 $\times$ 4 matrix indicating the maximum resource need of each process. If $Max[i,j]=k $ then process $p_i$, may need a maximum of $k$ instances of resource type $r_j$ in order to complete the task.</p>
<p>Assume that system allocated resources only when it does not lead into an unsafe state such that resource requirements in future night cause a deadlock state. Now consider the following snapshot of the system.</p>
<table border="0" cellpadding="1" style="width:200px; border-spacing: 1px;">
<tbody>
<tr>
<td colspan="5">$$\textbf{Allocation}$$</td>
</tr>
<tr>
<td> </td>
<td>r0</td>
<td>r1</td>
<td>r2</td>
<td>r3</td>
</tr>
<tr>
<td>$p_0$</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>$p_1$</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>$p_2$</td>
<td>1</td>
<td>3</td>
<td>5</td>
<td>4</td>
</tr>
<tr>
<td>$p_3$</td>
<td>0</td>
<td>6</td>
<td>3</td>
<td>2</td>
</tr>
<tr>
<td>$p_4$</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>4</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="1" style="width:200px; border-spacing: 1px;">
<tbody>
<tr>
<td colspan="4">$$\textbf{Max}$$</td>
</tr>
<tr>
<td>r0</td>
<td>r1</td>
<td>r2</td>
<td>r3</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>1</td>
<td>7</td>
<td>5</td>
<td>0</td>
</tr>
<tr>
<td>2</td>
<td>3</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>0</td>
<td>6</td>
<td>5</td>
<td>2</td>
</tr>
<tr>
<td>0</td>
<td>6</td>
<td>5</td>
<td>6</td>
</tr>
</tbody>
</table>
<p> </p>
<table border="0" cellpadding="1" style="width:200px; border-spacing: 1px;">
<tbody>
<tr>
<td colspan="4">$$\textbf{Available}$$</td>
</tr>
<tr>
<td>r0</td>
<td>r1</td>
<td>r2</td>
<td>r3</td>
</tr>
<tr>
<td>1</td>
<td>5</td>
<td>2</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>Is the system currently in a safe state? If yes, explain why.</p>
<p> </p>Operating Systemhttps://gateoverflow.in/94397/gate1988-11Mon, 19 Dec 2016 08:54:50 +0000GATE1988-10iib
https://gateoverflow.in/94393/gate1988-10iib
<p>Given below is solution for the critical section problem of two processes $P_0$ and $P_1$ sharing the following variables:</p>
<pre class="prettyprint lang-c_cpp">
var flag :array [0..1] of boolean; (initially false)
turn: 0 .. 1;</pre>
<p>The program below is for process Pi (i=0 or 1) where process Pj (j=1 or 0) being the other one.</p>
<pre class="prettyprint lang-c_cpp">
repeat
flag[i]:= true;
while turn != i
do begin
while flag [j] do skip
turn:=i;
end
critical section
flag[i]:=false;
until false</pre>
<p>Determine of the above solution is correct. If it is incorrect, demonstrate with an example how it violates the conditions.</p>Operating Systemhttps://gateoverflow.in/94393/gate1988-10iibMon, 19 Dec 2016 08:44:07 +0000GATE1988-10iia
https://gateoverflow.in/94392/gate1988-10iia
<p>Translate the executable statements of the following Pascal Program into quadruples. Assume that integer and real values require four words each.</p>
<pre class="prettyprint lang-c_cpp">
repeat
flag[i]:=true;
while turn !=i
do begin
while flag[j] do skip
turn:=i;
end
critical section
flag[i]:=false;
until false
Program Test;
var i:integer;
a: array [1...10] of real;
begin i:=0;
While i:<=10 do
begin
a[i]:=0;
i:=i+1
end;
end.</pre>
<p> </p>Compiler Designhttps://gateoverflow.in/94392/gate1988-10iiaMon, 19 Dec 2016 08:39:25 +0000GATE1988-10ib
https://gateoverflow.in/94391/gate1988-10ib
<p>Consider the following grammar:</p>
<ul>
<li>$S \rightarrow S$</li>
<li>$S \rightarrow SS \mid a \mid \epsilon$</li>
</ul>
<p>
<br>
Indicate the shift-reduce and reduce-reduce conflict (if any) in the various states of the LR(0) parser.</p>Compiler Designhttps://gateoverflow.in/94391/gate1988-10ibMon, 19 Dec 2016 08:30:05 +0000GATE1988-10ia
https://gateoverflow.in/94390/gate1988-10ia
<p>Consider the following grammar:</p>
<ul>
<li>$S \rightarrow S$</li>
<li>$S \rightarrow SS \mid a \mid \epsilon$</li>
</ul>
<p>
<br>
Construct the collection of sets of LR (0) items for this grammar and draw its goto graph.</p>Compiler Designhttps://gateoverflow.in/94390/gate1988-10iaMon, 19 Dec 2016 08:29:33 +0000GATE1988-9iii
https://gateoverflow.in/94388/gate1988-9iii
<p>In the program scheme given below indicate the instructions containing any operand needing relocation for position independent behaviour. Justify your answer.</p>
<table border="0" cellpadding="1" style="width:200px; border-spacing: 1px;">
<tbody>
<tr>
<td> </td>
<td>Y=10.</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>MOV</td>
<td>X (OR), R1</td>
</tr>
<tr>
<td> </td>
<td>MOV</td>
<td>X, RO</td>
</tr>
<tr>
<td> </td>
<td>MOV</td>
<td>2(RO), R1</td>
</tr>
<tr>
<td> </td>
<td>MOV</td>
<td>Y (RO), R5</td>
</tr>
<tr>
<td> </td>
<td>.</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>.</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>.</td>
<td> </td>
</tr>
<tr>
<td>X:</td>
<td>WORD</td>
<td>0, 0, 0</td>
</tr>
</tbody>
</table>
<p> </p>CO & Architecturehttps://gateoverflow.in/94388/gate1988-9iiiMon, 19 Dec 2016 08:28:42 +0000GATE1988-9ii
https://gateoverflow.in/94387/gate1988-9ii
<p>The code for the implementation of a sub-routine to convert positive numeric data from binary to appropriate character string in a PDP-11 like machine has been given below</p>
<p>Note-that SP is the stack pointer and $R_i$ represents i-th register respectively.</p>
<table border="0" cellpadding="1" style="width:500px; border-spacing: 1px;">
<tbody>
<tr>
<td>BTOD:</td>
<td>MOV</td>
<td>(SP)+, RO</td>
<td>: Save the PC</td>
</tr>
<tr>
<td> </td>
<td>MOV</td>
<td>(SP)+, +R1</td>
<td>: address of last significant digit of destination.</td>
</tr>
<tr>
<td> </td>
<td>INC</td>
<td>R1</td>
<td>: Setting an autodecrement in eighth instruction</td>
</tr>
<tr>
<td> </td>
<td>MOV</td>
<td>(SP)+, R3</td>
<td>: Value to be converted</td>
</tr>
<tr>
<td>BTOD 1:</td>
<td>CLR</td>
<td>R2</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>DIV</td>
<td>10.R2</td>
<td>: Pair R2-R3 receive quotient in R2 and remainder in R3.</td>
</tr>
<tr>
<td> </td>
<td>ADD</td>
<td>48, R3</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>MOVB</td>
<td>R3, -(R1)</td>
<td>: autodecrement will decrease R1</td>
</tr>
<tr>
<td> </td>
<td>MOV</td>
<td>R2, R3</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>BNE</td>
<td>BTOD 1</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>MOV</td>
<td>RO-(SP)</td>
<td>: restore PC</td>
</tr>
<tr>
<td> </td>
<td>RTS</td>
<td>PC</td>
<td>: return</td>
</tr>
</tbody>
</table>CO & Architecturehttps://gateoverflow.in/94387/gate1988-9iiMon, 19 Dec 2016 08:25:39 +0000GATE1988-9i
https://gateoverflow.in/94384/gate1988-9i
<p>The following program fragment was written in an assembly language for a single address computer with one accumulator register:</p>
<table border="0" cellpadding="1" style="width:150px; border-spacing: 1px;">
<tbody>
<tr>
<td>LOAD</td>
<td>B</td>
</tr>
<tr>
<td>MULT</td>
<td>C</td>
</tr>
<tr>
<td>STORE</td>
<td>T$_1$</td>
</tr>
<tr>
<td>ADD</td>
<td>A</td>
</tr>
<tr>
<td>STORE</td>
<td>T$_2$</td>
</tr>
<tr>
<td>MULT</td>
<td>T$_2$</td>
</tr>
<tr>
<td>ADD</td>
<td>T$_1$</td>
</tr>
<tr>
<td>STORE</td>
<td>Z</td>
</tr>
</tbody>
</table>
<p>Give the arithmetic expression implemented by the fragment.</p>CO & Architecturehttps://gateoverflow.in/94384/gate1988-9iMon, 19 Dec 2016 08:19:19 +0000