GATE CSE Doubts - Recent questions and answers
https://csedoubts.gateoverflow.in/qa
Powered by Question2AnswerAnswered: Is hypercube graph is another name of regular graph??
https://csedoubts.gateoverflow.in/3753/is-hypercube-graph-is-another-name-of-regular-graph?show=3781#a3781
<p><a href="https://www.geeksforgeeks.org/hypercube-graph/" rel="nofollow">https://www.geeksforgeeks.org/hypercube-graph/</a></p>
<p><a href="http://mathworld.wolfram.com/HypercubeGraph" rel="nofollow">http://mathworld.wolfram.com/HypercubeGraph</a>.</p>
Mathematical Logichttps://csedoubts.gateoverflow.in/3753/is-hypercube-graph-is-another-name-of-regular-graph?show=3781#a3781Fri, 23 Aug 2019 16:33:45 +0000Answered: What is maximal independent set(MIS)?
https://csedoubts.gateoverflow.in/3761/what-is-maximal-independent-set-mis?show=3779#a3779
<a href="https://www.geeksforgeeks.org/gate-gate-it-2008-question-4/" rel="nofollow">https://www.geeksforgeeks.org/gate-gate-it-2008-question-4/</a><br />
<br />
<br />
<a href="https://www.cc.gatech.edu/~vigoda/7530-Spring10/MIS.pdf" rel="nofollow">https://www.cc.gatech.edu/~vigoda/7530-Spring10/MIS.pdf</a>Mathematical Logichttps://csedoubts.gateoverflow.in/3761/what-is-maximal-independent-set-mis?show=3779#a3779Fri, 23 Aug 2019 16:29:06 +0000Gateoverflow question on B+ tree - Self Doubt
https://csedoubts.gateoverflow.in/3776/gateoverflow-question-on-b-tree-self-doubt
<p><a rel="nofollow" href="https://gateoverflow.in/258022/dbms-basic-test1">https://gateoverflow.in/258022/dbms-basic-test1</a></p>
<p> </p>
<p>Int the above question, as per the diagram, the leaves are supposed to be in level 4 and so the number of children in level 3 which equals to 27 as per calculation means the number of child pointers to level 4 that is the leaf node level is actually 27. Am I correct ?</p>
<p> </p>
<p><img alt="" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=6641513753631041357"></p>Databaseshttps://csedoubts.gateoverflow.in/3776/gateoverflow-question-on-b-tree-self-doubtFri, 23 Aug 2019 14:24:21 +0000B tree and B+ tree - Made Easy / Gateoverflow
https://csedoubts.gateoverflow.in/3773/b-tree-and-b-tree-made-easy-gateoverflow
<p>For the below question, </p>
<p><a rel="nofollow" href="https://gateoverflow.in/285557/madeeasy-test-series-databases-b-tree">https://gateoverflow.in/285557/madeeasy-test-series-databases-b-tree</a></p>
<p> </p>
<p>Can anyone explain option B and option D ? I mean what they actually mean to say ?</p>Databaseshttps://csedoubts.gateoverflow.in/3773/b-tree-and-b-tree-made-easy-gateoverflowFri, 23 Aug 2019 13:44:34 +0000Virtual Gate: Programming (Array)
https://csedoubts.gateoverflow.in/3770/virtual-gate-programming-array
<p>Consider the following declaration in two dimensional array in C. </p>
<pre class="prettyprint linenums lang-c_cpp" data-pbcklang="c_cpp" data-pbcktabsize="4">
char arr[100][100];</pre>
<p>Assuming the main memory is byte addressable and the array is stored starting from memory address $0.$ The address of $arr\left [ 40 \right ]\left [ 50 \right ]$ is _____________</p>
<hr>
<p>By row major order, I got ans as $\left ( 40-0 \right )\times \left ( 50-0+1 \right )+\left ( 50-0 \right )=2090$</p>
<p>Ans given $4050$</p>
<p>Why they have not calculated it in row-major order?? Why they put it in direct multiplication??</p>Programminghttps://csedoubts.gateoverflow.in/3770/virtual-gate-programming-arrayFri, 23 Aug 2019 10:48:51 +0000Answered: Decidability Problem (Rice University pdf)
https://csedoubts.gateoverflow.in/3728/decidability-problem-rice-university-pdf?show=3769#a3769
<p>$L_1 = \{\langle M \rangle \mid \epsilon \in L(M)\}$<br>
<br>
$L_2 = \{\langle M \rangle \mid \epsilon \notin L(M)\}$<br>
<br>
Here, $L_1$ is recursively enumerable (just run M on empty string and say “yes” if it accepts and otherwise we don’t care for the output) and $L_2$ is not even r.e. (can be proved using Rice’s theorem).<br>
<br>
Now, we have<br>
$L_{11} = \{\langle M_{1}, M_2\rangle \mid \text{ M}_1 \text{and M}_2 \text{ are two TMs}, \text{and } \epsilon \in L(M_1) \backslash L(M_2) \}$<br>
<br>
Let’s suppose $L_{11}$ is r.e. or equivalently we have a TM $M$ which can say “yes” whenever we have an input which is in $L_{11}.$<br>
<br>
Using this we try to semi-decide $L_2$ and if we succeed, it means our assumption is WRONG $\implies$ $L_{11}$ is not even recursively enumerable.<br>
</p>
<ol>
<li>Say we are given the language $L_2 = \{\langle M \rangle \mid \epsilon \notin L(M)\}$ and we have to decide if it is r.e. or not.</li>
<li>We assume a semi-deciding TM exists, say $N$ for $L_{11} = \{\langle M_{1}, M_2\rangle \mid \text{ M}_1 \text{and M}_2 \text{ are two TMs}, \text{and } \epsilon \in L(M_1) \backslash L(M_2) \}$</li>
<li>Now, we make a TM for $L = \{\epsilon\}$ ($L$ can contain other strings too) and call it say $M_1.$ Lets call the TM $M$ of step 1 as $M_2.$</li>
<li>Now, we feed $\langle M_{1}, M_2\rangle$ as input to $N.$ If answer is “yes”, it means $\epsilon \in M_1$ (which we know is true) and $\epsilon \notin M_2.$ So, we get the answer “yes” for $L_2$ too which is not possible. </li>
<li>Hence, $L_{11}$ cannot be r.e. as if it is it’ll cause $L_2$ also to be r.e.</li>
</ol>Digital Logichttps://csedoubts.gateoverflow.in/3728/decidability-problem-rice-university-pdf?show=3769#a3769Fri, 23 Aug 2019 10:41:47 +0000Binary String with 5 0's and 6 1's possible, where all 0's are together.
https://csedoubts.gateoverflow.in/3766/binary-string-with-0s-and-1s-possible-where-all-are-together
Binary String with 5 0's and 6 1's possible, where all 0's are together?Combinatoryhttps://csedoubts.gateoverflow.in/3766/binary-string-with-0s-and-1s-possible-where-all-are-togetherFri, 23 Aug 2019 09:57:05 +0000Answered: What is the difference between computer architecture and computer organization? Help me with good examples.
https://csedoubts.gateoverflow.in/3476/difference-computer-architecture-computer-organization?show=3764#a3764
In computer there are mainly 2 components:<br />
<br />
1) Processor: Architecture is all about computer's processor and Instructions.<br />
<br />
2) Memory: Organization parts is all about Memory Organization. Where the instructions and data required by the processor is stored and how to access it.CO & Architecturehttps://csedoubts.gateoverflow.in/3476/difference-computer-architecture-computer-organization?show=3764#a3764Fri, 23 Aug 2019 09:20:42 +0000Virtual Gate Test Series:Programming test 2015
https://csedoubts.gateoverflow.in/3752/virtual-gate-test-series-programming-test-2015
<pre class="prettyprint linenums lang-c_cpp" data-pbcklang="c_cpp" data-pbcktabsize="4">
int main(){
int *ptr;
ptr=(int*)malloc(100);
printf("%d",sizeof(ptr));
return 0;
}</pre>
<p>Consider the memory allocated by integer pointer $4B$. What will be output of the program?</p>Programminghttps://csedoubts.gateoverflow.in/3752/virtual-gate-test-series-programming-test-2015Fri, 23 Aug 2019 08:06:59 +0000Virtual Gate Test Series:Programming
https://csedoubts.gateoverflow.in/3750/virtual-gate-test-series-programming
<pre class="prettyprint linenums lang-c_cpp" data-pbcklang="c_cpp" data-pbcktabsize="4">
union u1{
int x;
struct s1{
char ch1;
union u2{
char ch2;
short int var;
}u3;
}s2;
}u4;</pre>
<p>Assume that object of type char , short int and int takes $1B,2B,4B$ respectively. The memory required for variable $u4$ is ________ Bytes.</p>
<hr>
<p>See here memory created by union $u1$ is for integer<code>(4B)</code> and structure $s1$, </p>
<p>now memory created by $s1$ is for a character<code>(1B)</code> and for union $u2$</p>
<p>Now $u2$ will create maximum memory , i.e. for short int <code>(2B)</code></p>
<p>So total memory created will be <code>4+1+2=7B</code>, isnot it??</p>
<p>But answer given 4B , Plz tell me where am I missing??</p>Programminghttps://csedoubts.gateoverflow.in/3750/virtual-gate-test-series-programmingFri, 23 Aug 2019 08:01:19 +0000ACE TEST SERIES: DBMS
https://csedoubts.gateoverflow.in/3742/ace-test-series-dbms
<p><img alt="" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=14679669845489280788"></p>
<p><br>
The number of serial schedules which are view equal to schedule(s) but not conflict equal to schedule(s) are ________.</p>Databaseshttps://csedoubts.gateoverflow.in/3742/ace-test-series-dbmsFri, 23 Aug 2019 06:18:55 +0000iGate Bhillai Test: DBMS
https://csedoubts.gateoverflow.in/3743/igate-bhillai-test-dbms
<p><img alt="" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=6228733939757413715"></p>
<p><img alt="" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=9332145638226563926"></p>Databaseshttps://csedoubts.gateoverflow.in/3743/igate-bhillai-test-dbmsFri, 23 Aug 2019 06:18:50 +0000iGate Bhilai Test 2020:dbms
https://csedoubts.gateoverflow.in/3744/igate-bhilai-test-2020-dbms
<p><img alt="" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=17387133777151996550"></p>
<p><img alt="" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=5474120404619934110"></p>Databaseshttps://csedoubts.gateoverflow.in/3744/igate-bhilai-test-2020-dbmsFri, 23 Aug 2019 06:18:46 +0000Express it using logic. "There are exactly two systems that monitor every re mote server"
https://csedoubts.gateoverflow.in/3739/express-using-logic-there-exactly-systems-monitor-every-server
Mathematical Logichttps://csedoubts.gateoverflow.in/3739/express-using-logic-there-exactly-systems-monitor-every-serverFri, 23 Aug 2019 00:18:43 +0000Answered: Foreign key - Self Doubt
https://csedoubts.gateoverflow.in/3511/foreign-key-self-doubt?show=3738#a3738
<p>While inserting something in the table, you are only restricted not to put null value in primary key attribute,</p>
<p>this is called as <strong>Entity Integrity </strong><strong>constr</strong><strong>aint</strong></p>
<p> </p>
<p><strong>Your Statement</strong> – when it comes to deleting something from the referenced table, we can perform ON DELETE SET NULL operation and make the foreign key value in a particular tuple as NULL.-- <strong>is correct</strong></p>
<p> </p>
<p><strong>But Your statement – </strong> a foreign key can’t remain null while inserting but it can be null while deletion – <strong>is incorrect</strong></p>
<p>It is totally up to you, whether you want to provide the foreign key or want to keep it null while inserting a new tuple in the relation.</p>
<p>And also it can be null while deletion.</p>
Databaseshttps://csedoubts.gateoverflow.in/3511/foreign-key-self-doubt?show=3738#a3738Thu, 22 Aug 2019 21:49:36 +0000Which chapters should I study from the standard textbooks?
https://csedoubts.gateoverflow.in/3607/which-chapters-should-i-study-from-the-standard-textbooks
Can anyone please tell me which all chapters are to be studied from standard textbooks? I searched many places on the internet to find an answer to this, but everyone just mentions the standard books name and not the specific chapters/topics that are required. I believe that the entire standard book need not be studied as all topics are not there in the syllabus. So someone please help me with this as I don't want to join a coaching institute just to get this information.Puzzleshttps://csedoubts.gateoverflow.in/3607/which-chapters-should-i-study-from-the-standard-textbooksThu, 22 Aug 2019 21:20:37 +0000Do process and threads (belong to that process) share same address space ? If yes, How?
https://csedoubts.gateoverflow.in/3608/process-threads-belong-that-process-share-same-address-space
Operating Systemhttps://csedoubts.gateoverflow.in/3608/process-threads-belong-that-process-share-same-address-spaceThu, 22 Aug 2019 21:20:33 +0000A draws 2 cards at random from a pack of 52 cards.
https://csedoubts.gateoverflow.in/3662/a-draws-2-cards-at-random-from-a-pack-of-52-cards
A draws 2 cards at random from a pack of 52 cards. After returning them to the pack and shifting it, B draws two cards at random. The probability that their contain exactly 1 common card is<br />
<br />
(a) 25/546<br />
<br />
(b) 50/63<br />
<br />
(c) 25/663<br />
<br />
(d) NoneProbabilityhttps://csedoubts.gateoverflow.in/3662/a-draws-2-cards-at-random-from-a-pack-of-52-cardsThu, 22 Aug 2019 09:20:36 +0000Algorithms - Time Complexity analysis
https://csedoubts.gateoverflow.in/3660/algorithms-time-complexity-analysis
<p>1 .Let P be the problem. Suppose that the worst case asymptotic running time complexity of P is in O($n^2$lgn) and is also in Ω(n). Now let A be an algorithm that solves P. Which of the following is correct about A:</p>
<ol style="list-style-type:decimal" type="1">
<li>A has worst-case time comlexity in O(lgn)</li>
<li>A has worst case time complexity in Ω(nlgn)</li>
<li>A has worst case time complexity in θ($n^3$)</li>
<li>A has best case time complexity in Ω(n)</li>
</ol>
<p> </p>
<p>2 .State True and False for each statement:</p>
<ol style="list-style-type:decimal" type="1">
<li>The worst case time case complexity of an algorithm is Ω(n). The Algorithm executes in time T(n) = Ω($n^2$) for some input data.</li>
<li>The worst case time case complexity of an algorithm is Ω(n). The Algorithm executes in time T(n) = Ω($n^2$) for every input data.</li>
<li>The best case time case complexity of an algorithm is θ(n). The Algorithm executes in time T(n) = Ω($n^2$) for some input data.</li>
<li>The best case time case complexity of an algorithm is θ(n). The Algorithm executes in time T(n) = Ω($n^2$) for every input data.</li>
</ol>Algorithmshttps://csedoubts.gateoverflow.in/3660/algorithms-time-complexity-analysisThu, 22 Aug 2019 08:56:21 +0000Algorithms - Time complexity
https://csedoubts.gateoverflow.in/3658/algorithms-time-complexity
<p>1 .Solve the recurrence:</p>
<ol style="list-style-type:decimal" type="1">
<li>$T(n) = 2T(\sqrt n) + log\ n$</li>
<li>$T(n) = T(\frac{n}{2}) + 2T(\frac{n}{4}) +n$</li>
</ol>
<p> </p>
<p>2 .$f(n) = n^{1.01}$ and $g(n) = n(log\ n)^2$ then which one is true </p>
<ol style="list-style-type:lower-alpha" type="a">
<li>$f(n) = O(g(n))$ </li>
<li>$f(n) = \Omega(g(n))$ </li>
<li>$f(n) = \Theta(g(n))$</li>
</ol>
<p> </p>
<p>3 . $f(n) = n^{\frac{1}{2}}, g(n) = 1$, then is it correct $g(n) = o(fn)$ {$o$ = small o Not big $O$}</p>
<p>Please solve the above questions.</p>Algorithmshttps://csedoubts.gateoverflow.in/3658/algorithms-time-complexityThu, 22 Aug 2019 08:41:10 +0000Self Doubt: BST and Heap
https://csedoubts.gateoverflow.in/3630/self-doubt-bst-and-heap
<p>What is the time required to </p>
<ol>
<li>
<p>Deletion of the smallest element from a balanced binary search tree</p>
</li>
<li>
<p>Insertion an element in heap</p>
</li>
</ol>
<hr>
<p>Will it be O(log n) or O(1) for 1st one and O(n) or O(logn) for 2nd one??</p>DShttps://csedoubts.gateoverflow.in/3630/self-doubt-bst-and-heapThu, 22 Aug 2019 05:20:38 +0000Self doubt regarding error control
https://csedoubts.gateoverflow.in/3541/self-doubt-regarding-error-control
Is 2D parity scheme for error control techniques in GATE CSE 2020 Syllabus?<br />
<br />
Because in 2008 IT paper it was asked? Do i need to practice the questions related to the concept of 2D parity??Computer Networkshttps://csedoubts.gateoverflow.in/3541/self-doubt-regarding-error-controlWed, 21 Aug 2019 23:42:37 +0000Answered: Self Doubt: Parsers
https://csedoubts.gateoverflow.in/3197/self-doubt-parsers?show=3581#a3581
<p>$ G1 :A→ A1|0A1|01$</p>
<p><img alt="" height="200" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=4324392336892508824" width="438"></p>
<p>Here we have shift move and reduce move in same state and both also have same lookaheads i.e. $ \$ $ so the given grammar is not LR(k).</p>
<hr>
<p>$ G2 :A→ 0A|1$</p>
<p>It is LR(k) since in each final state we have only 1 reduce move so no SR or RR conflict happens.</p>
<p><img alt="" height="315" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=2510529015171705349" width="366"></p>
<p>$\therefore$ option B is correct.</p>Compiler Designhttps://csedoubts.gateoverflow.in/3197/self-doubt-parsers?show=3581#a3581Wed, 21 Aug 2019 18:36:37 +0000Answered: Self Doubt in Parsers
https://csedoubts.gateoverflow.in/3234/self-doubt-in-parsers?show=3577#a3577
<p><strong>Language of LR(0) </strong>:- DCFL having a prefix property or the laguages accepted by DPDA with empty stack.</p>
<p>By adding an end delimeter we can remove prefix property restriction of LR(0) set of languages because when an end delimeter is added, no string becomes a prefix of any other string.</p>
<p>language of LR(0) is a proper subset of SLR(1).</p>
<p>$\therefore$ “ Any DCFL has an equivalent grammar that can be parsed by a SLR(1) parser with end string delimiter” is Correct</p>Compiler Designhttps://csedoubts.gateoverflow.in/3234/self-doubt-in-parsers?show=3577#a3577Wed, 21 Aug 2019 18:27:52 +0000Answered: Gateforum Test Series: Compiler Design
https://csedoubts.gateoverflow.in/3331/gateforum-test-series-compiler-design?show=3571#a3571
<p>In static single assignment form</p>
<ol style="list-style-type:decimal" type="1">
<li>each variable is assigned exactly once.</li>
<li>every variable is defined before it is used.</li>
<li>Temporary variables are needed to store result of each binary operation.</li>
<li>variables cannot be repeated on LHS of assignment.</li>
</ol>
<p>q=3…..…...$T_1 =q$<br>
r=10……....$T_2 = r$<br>
s=q+r……..$T_3 = T_2+T_1$<br>
t=2*r+s…...$T_{4} = 2*T_2, T_5 = T_{4} +T_3$ (since in SSA we need to store every temporary result)<br>
t=q………...$T_6 = T_1$<br>
u=q+r……...$T_7 = T_1 + T_2$<br>
v=q+t……….$T_8 = T_1 + T_6$<br>
t=3+x ……...$T_9 = 3 + T_{10}$</p>
<p>$\therefore$ $10$ variables are required.</p>Compiler Designhttps://csedoubts.gateoverflow.in/3331/gateforum-test-series-compiler-design?show=3571#a3571Wed, 21 Aug 2019 18:01:41 +0000Sorting algorithm
https://csedoubts.gateoverflow.in/3553/sorting-algorithm
<p>An unsorted array of n elements is given to you and you have to print largest 10% of them. This can be done on time</p>
<ol style="list-style-type:decimal" type="1">
<li>O(1)</li>
<li>O(n)</li>
<li>O(logn)</li>
<li>O(nlogn)</li>
</ol>Algorithmshttps://csedoubts.gateoverflow.in/3553/sorting-algorithmWed, 21 Aug 2019 15:56:03 +0000Why T=2*t-pd In the answer and total no: of gate is not odd also!
https://csedoubts.gateoverflow.in/3366/why-t-2-t-pd-in-the-answer-and-total-no-of-gate-is-not-odd-also
<p><img alt="" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=16631049190173860009" srcset="Made easy test esries">why T=2*tpd?</p>Digital Logichttps://csedoubts.gateoverflow.in/3366/why-t-2-t-pd-in-the-answer-and-total-no-of-gate-is-not-odd-alsoWed, 21 Aug 2019 12:43:01 +0000It is CFL or not
https://csedoubts.gateoverflow.in/3494/it-is-cfl-or-not
It is CFL or not $\{wa^n w^r |\ w\ \in (a+b)^*, n>=0 \}$Theory of Computationhttps://csedoubts.gateoverflow.in/3494/it-is-cfl-or-notWed, 21 Aug 2019 12:03:38 +0000Should I cover HDL for gate exam?
https://csedoubts.gateoverflow.in/3493/should-i-cover-hdl-for-gate-exam
Digital Logichttps://csedoubts.gateoverflow.in/3493/should-i-cover-hdl-for-gate-examWed, 21 Aug 2019 11:16:39 +0000What is the difference between Computer organization and Computer Architecture?
https://csedoubts.gateoverflow.in/3471/difference-computer-organization-computer-architecture
<p>Can someone give a proper explanation for the difference? One example is : </p>
<p>Computer Architecture: Whether a computer will have a multiply instruction or not? </p>
<p>Computer Organisation: Whether the multiply instruction will be implemented by a special multiply unit or by a mechanism that makes repeated use of the add unit of the system?</p>
<p>My question is that it that every computer will surely have multiply instruction then why consider 1<sup>st</sup> question for computer architecture?</p>CO & Architecturehttps://csedoubts.gateoverflow.in/3471/difference-computer-organization-computer-architectureWed, 21 Aug 2019 07:17:24 +0000f(m,n) { ans = 1; count = 0; while (ans <= m) { count = count + 1; ans = ans * n; } return(count) }
https://csedoubts.gateoverflow.in/3400/f-m-n-ans-1-count-0-while-ans-count-count-1-ans-ans-n-return-count
Algorithmshttps://csedoubts.gateoverflow.in/3400/f-m-n-ans-1-count-0-while-ans-count-count-1-ans-ans-n-return-countWed, 21 Aug 2019 07:14:08 +0000How many 5 digit positive integers possible with 2,3,and5
https://csedoubts.gateoverflow.in/3457/how-many-5-digit-positive-integers-possible-with-2-3-and5
Mathematical Logichttps://csedoubts.gateoverflow.in/3457/how-many-5-digit-positive-integers-possible-with-2-3-and5Wed, 21 Aug 2019 07:12:24 +0000View Serializability
https://csedoubts.gateoverflow.in/3469/view-serializability
Can someone write the entire steps and rules of polygraph test to check view serializability.<br />
P.S. : Kindly, dont give me links. Please write the rules in a stepwise manner if known.Databaseshttps://csedoubts.gateoverflow.in/3469/view-serializabilityWed, 21 Aug 2019 07:11:31 +0000on which interface will an IP packet with destination address 144.25.64.120 be forwarded
https://csedoubts.gateoverflow.in/3374/which-interface-will-packet-destination-address-forwarded
<p><img alt="" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=11965445110440922644"></p>
<ol style="list-style-type:lower-alpha" type="a">
<li>Eth0</li>
<li>Eth1</li>
<li>Eth2</li>
<li>Eth3</li>
</ol>Computer Networkshttps://csedoubts.gateoverflow.in/3374/which-interface-will-packet-destination-address-forwardedWed, 21 Aug 2019 07:05:21 +0000Answered: A wait operation on a semaphore should not occur within a critical section controlled by that semaphore because:
https://csedoubts.gateoverflow.in/3424/operation-semaphore-critical-controlled-semaphore-because?show=3461#a3461
<p>Imagine a person [ <strong>PROCESS </strong>] booked a ticket to watch Saaho. He showed the ticket to the guard and entered the hall [ <strong>CRITICAL SECTION</strong> ]. He was the last viewer at that time because after him the theatre became housefull [ N<strong>OBODY CAN ENTER THE CRITICAL SECTION</strong>]. While watching the movie, he used his mobile phone to record the film and decided to sell the video as a pirated movie. One of the theatre guys caught him and threw him outside the theatre. </p>
<p>Now the person cant enter the theatre because he had already shown the ticket and as per procedure it was torn by the guard. [ <strong>SEMAPHORE VALUE HAS BEEN DECREASED THROUGH WAIT OPERATION</strong> ]. So, he cant enter the theatre with a valid ticket [ <strong>NEW VALUE OF SEMAPHORE</strong> ] as the screen is already showing to b housefull [ <strong>SOMEONE IS ALREADY THERE IN CRITICAL SECTION</strong>].</p>
<p>Therefore, neither the person [ <strong>PROCESS </strong>] can enter the theatre nor anyone else [ <strong>ANY OTHER PROCESS</strong> ]. So, it is a deadlock situation.</p>
<p><strong>Option A</strong> is the correct answer.</p>
<p><strong>Option B </strong>: Once the person got a ticket, why he wd share it wit others – False.</p>
<p><strong>Option C</strong> : Another person is a DIE-HARD FAN of Prabhas, he wd definitely enter a housefull theatre to watch the movie whatever it takes – Not possible - False.</p>
<p><strong>Option D </strong>– A guy outside the theatre tells another person : what happens if it is housefull, u will get a ticket bt a black ticket ----- Not possible coz the theatre is already housefull – False.</p>Operating Systemhttps://csedoubts.gateoverflow.in/3424/operation-semaphore-critical-controlled-semaphore-because?show=3461#a3461Wed, 21 Aug 2019 06:29:00 +0000Answered: predict the output
https://csedoubts.gateoverflow.in/3389/predict-the-output?show=3451#a3451
<p><img alt="" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=18060452591193763903"> </p>
<p>is this right way to solve</p>Programminghttps://csedoubts.gateoverflow.in/3389/predict-the-output?show=3451#a3451Wed, 21 Aug 2019 05:51:17 +0000ACE Test Series - Normalization
https://csedoubts.gateoverflow.in/3442/ace-test-series-normalization
<p><img alt="" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=4919902350096286208"></p>
<p> </p>
<p>Regarding statement Q, I don’t think it will violate 3NF because whatever be the R.H.S. if L.H.S. is superkey, then it is in BCNF and ultimately in 3NF. Therefore, it is allowed in 3NF and so the statement is supposed to be right. Is my approach correct ? </p>Databaseshttps://csedoubts.gateoverflow.in/3442/ace-test-series-normalizationWed, 21 Aug 2019 05:10:38 +0000Answered: regular language and few statements
https://csedoubts.gateoverflow.in/2963/regular-language-and-few-statements?show=3434#a3434
<ol style="list-style-type:upper-roman" type="I">
<li>It says that there exist some word $w$ that belongs to set $X$ and it also belongs to the language $L$ then $L$ will be infinite.</li>
</ol>
<p>This statement may not be true always. Hence it is false.</p>
<p>eg:-</p>
<p>Take any value of $n$. Lets say $n=5$</p>
<p>then $2n-1 = 9$</p>
<p>Let $\Sigma = \{a\}$</p>
<p>$X = \{ aaaaaa,aaaaaaa,aaaaaaaa \} $ ( Here each term’s length should be between $5$ and $9$ }</p>
<p>then if $L = \{ a^n | 8> n > 4 \} = \{ aaaaa,aaaaaa,aaaaaaa \} $ ( this $L$ is valid since it is a regular language )</p>
<p>Now this $L$ is finite and we can see,$aaaaaa$ belongs to $X$ and $aaaaaa$ also belongs to $L$.</p>
<p> </p>
<ol start="2" style="list-style-type:upper-roman" type="I">
<li>It says there exist some word $w$ whose length is greater than or equal to $2n$ and $w$ belongs to the language $L$ then there will also be an element $x$ that will belong to $X$ i.e. if $w$ exists then $x$ also exists i.e. $w \implies x$</li>
</ol>
<p>if we take contrapositive of above statement i.e. $\sim x \implies \sim w $ then that should also hold true.</p>
<p>So if we take $n=0$ then $X$ will be an empty set.($X$ will not contain $\epsilon$ because $X$ is a set not a language).</p>
<p>But $w$ can still exist whose length is greater than $2n$ ($\because$ As we can see here from the definition there is no relation between $w$ and $x$.)</p>
<p>So contrapositive is becoming FALSE.</p>
<p>Hence this statement is FALSE</p>
<p>$\therefore$ Option D is the correct answer.</p>Theory of Computationhttps://csedoubts.gateoverflow.in/2963/regular-language-and-few-statements?show=3434#a3434Wed, 21 Aug 2019 03:11:09 +0000Gate overflow doubt made easy cache stalls
https://csedoubts.gateoverflow.in/3431/gate-overflow-doubt-made-easy-cache-stalls
Suppose that in 500 memory references there are 50 misses in the first level cache and 20 misses in the second level cache.Assume miss penalty from the L2 cache to memory is 100 cycles.The hit time of L2 cache is 20 cycle.The hit time of the L1 cache is 10 cycles. If there are 2.5 memory references per instruction.How many average stall cycles per instructions are there?CO & Architecturehttps://csedoubts.gateoverflow.in/3431/gate-overflow-doubt-made-easy-cache-stallsWed, 21 Aug 2019 02:18:40 +0000Answered: The language is context free or not
https://csedoubts.gateoverflow.in/3370/the-language-is-context-free-or-not?show=3425#a3425
<p>$(a^{n}b^{n})^{2} = a^{n}b^{n}a^{n}b^{n}$</p>
<p>This is not CFL as there is multiple dependency present for the occurrence of <em>a </em>and <em>b </em>i.e., $a^{n}b^{n}a^{n}b^{n}$ </p>
<p>As stack can remember up to one conditions, but here we have two conditions (1). No. Of <em>a </em>can push and than <em>b</em> can pop for every <em>a</em> (2). Again no. Of a and b should be same as in 1.</p>
<p>Hence it is not CFL</p>Theory of Computationhttps://csedoubts.gateoverflow.in/3370/the-language-is-context-free-or-not?show=3425#a3425Tue, 20 Aug 2019 21:52:42 +0000Answered: How to solve such question.
https://csedoubts.gateoverflow.in/3254/how-to-solve-such-question?show=3383#a3383
+ 127 = 01111111 in 2’s and 1’scompilment both!<br />
-127 =10000000 in 1’s compliment!<br />
-127 =10000000+1 =10000001 in 2’s compliment.<br />
So ans is 2:1Digital Logichttps://csedoubts.gateoverflow.in/3254/how-to-solve-such-question?show=3383#a3383Tue, 20 Aug 2019 17:59:42 +0000Made easy Test series!!
https://csedoubts.gateoverflow.in/3418/made-easy-test-series
<p><img alt="" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=4803630067568418861"></p>Digital Logichttps://csedoubts.gateoverflow.in/3418/made-easy-test-seriesTue, 20 Aug 2019 17:59:31 +0000Programming : Self doubt
https://csedoubts.gateoverflow.in/3420/programming-self-doubt
<pre class="prettyprint linenums lang-c_cpp" data-pbcklang="c_cpp" data-pbcktabsize="4">
1)void main(int n){
if(n==0)
return;
main(--n);
printf("%d",n);
//return n; this line maynot exists
}</pre>
<pre class="prettyprint linenums lang-c_cpp" data-pbcklang="c_cpp" data-pbcktabsize="4">
2)void main(int n){
if(n==0)
return;
main(n--);
printf("%d",n);
//return n; this line maynot exists
}</pre>
<p>Suppose when $n=4$</p>
<p>Here, 2nd program will print infinite loop. right??</p>
<p>What 1st program will print 1,2,3 or 1,1,1. ??</p>Programminghttps://csedoubts.gateoverflow.in/3420/programming-self-doubtTue, 20 Aug 2019 17:02:06 +0000Answered: GATEBOOK Floating point 16 bit
https://csedoubts.gateoverflow.in/3177/gatebook-floating-point-16-bit?show=3385#a3385
<p>Using IEEE format ,here 2<sup>nd</sup> smallest is just the 2<sup>nd</sup> number actually it is 3<sup>rd</sup> smallest!</p>
<p><img alt="" src="https://csedoubts.gateoverflow.in/?qa=blob&qa_blobid=14360854106135806908"></p>Digital Logichttps://csedoubts.gateoverflow.in/3177/gatebook-floating-point-16-bit?show=3385#a3385Tue, 20 Aug 2019 16:33:40 +0000self doubt-relative addressing mode
https://csedoubts.gateoverflow.in/3407/self-doubt-relative-addressing-mode
Can anyone tell me what is the format of relative addressing mode instructions in 8086 microprocessor?CO & Architecturehttps://csedoubts.gateoverflow.in/3407/self-doubt-relative-addressing-modeTue, 20 Aug 2019 15:27:14 +0000Answered: Made easy Algorithm
https://csedoubts.gateoverflow.in/3391/made-easy-algorithm?show=3395#a3395
<p><strong>Option: (3) Dynamic Programming</strong></p>
<p>We can reverse the direction of every edge and get a new directed acyclic graph $-G$ where edge weights are negative values. </p>
<p>As a result, finding the longest path between any two given vertices $(u, v)$ in $G$ reduces to finding the shortest path between $(v, u)$ in $-G$.</p>
<p>Now, we can now use the Dynamic Programming Approach to find the shortest between $(v, u)$ in this DAG $-G$, which, in turn, will give us the longest path between $(u, v)$ in DAG $G$.</p>
<p>For more information, you can refer to this link- <a rel="nofollow" href="https://en.m.wikipedia.org/wiki/Longest_path_problem">https://en.m.wikipedia.org/wiki/Longest_path_problem</a></p>
Algorithmshttps://csedoubts.gateoverflow.in/3391/made-easy-algorithm?show=3395#a3395Tue, 20 Aug 2019 13:03:22 +0000Answered: Programming:Self Doubt
https://csedoubts.gateoverflow.in/3303/programming-self-doubt?show=3392#a3392
<pre class="prettyprint linenums lang-c_cpp" data-pbcklang="c_cpp" data-pbcktabsize="4">
int bar(int val) //val =3 here
{
int x = 0; //x=0
while(val > 0) { // 3>0 is TRUE so while loop goes for 1st iteration
x= x + bar(val-1); // x= 0 + bar(2) so now control goes to bar(2)
//------------------------------------------JUMP TO bar(2)
int bar(int val) //val =2 here
{
int x = 0; //x=0 //this x is different from the x mentioned above in bar(3)
while(val > 0) { // 2>0 is TRUE so while loop goes for 1st iteration
x= x + bar(val-1); // x= 0 + bar(1) so now control goes to bar(1).
//------------------------------------------JUMP TO bar(1)
int bar(int val) //val =1 here
{
int x = 0; //x=0 //this x is different from the x mentioned above in bar(3)and bar(2)
while(val > 0) { // 1>0 is TRUE so while loop goes for 1st iteration
x= x + bar(val-1); // x= 0 + bar(0) so now control goes to bar(0)…………….COMEBACK 1.
//------------------------------------------JUMP TO bar(0)
int bar(int val) //val =0 here
{
int x = 0; //x=0 //this x is different from the x mentioned above in bar(3)and bar(2)and bar(1)
while(val > 0) { // 0>0 is FALSE so while loop terminates
x= x + bar(val-1); // not executed.
}
return val; // it returns 0 to bar(0) which is at line COMEBACK 1.
}
//------------------------------------------RETURN TO bar(1)
int bar(int val)
{
int x=0; //x=0 //this x is different from the x mentioned above in bar(3)and bar(2)
while(val > 0) { // 1>0 is TRUE so while loop goes for 1st iteration
x= x + bar(val-1); // x= 0 + bar(0) = 0 + 0 =0; …………….COMEBACK 1.
} //1st iteration of this while loop ends
</pre>
<p>$\rightarrow$ Now here <code><span class="marker">while</span></code> loop again goes for 2nd iteration and since value of <code>val</code> is not changed</p>
<p>$\rightarrow$ <code><span class="marker">while</span></code> loop condition will again become <code>true</code> and it would again go to <code>bar(0)</code> and then again comeback.</p>
<p>$\rightarrow$ Then again <code><span class="marker">while</span></code> loop will go for 3rd iteration and so on.</p>
<p>$\rightarrow$ This <code><span class="marker">while</span></code> loop will keep happening infinite number of times.</p>Programminghttps://csedoubts.gateoverflow.in/3303/programming-self-doubt?show=3392#a3392Tue, 20 Aug 2019 12:40:48 +0000array self doubts
https://csedoubts.gateoverflow.in/3387/array-self-doubts
{<br />
<br />
char str1[] = "altamashs";<br />
<br />
char str2[] = {'a', 'l', 't', 'a', 'm', 'a', 's', 'h', 's'};<br />
<br />
int n1 = sizeof(str1)/sizeof(str1[0]);<br />
<br />
int n2 = sizeof(str2)/sizeof(str2[0]);<br />
<br />
printf("n1 = %d, n2 = %d", n1, n2);<br />
<br />
return 0;<br />
<br />
}<br />
<br />
IN str1 we should consider null so its length=10 and in str2 only given so length=9Programminghttps://csedoubts.gateoverflow.in/3387/array-self-doubtsTue, 20 Aug 2019 11:38:33 +0000C PROGRAMMING QS
https://csedoubts.gateoverflow.in/3365/c-programming-qs
What will be the output of the following program?<br />
<br />
#include<stdio.h><br />
<br />
int print 1(void)<br />
<br />
{<br />
<br />
static int x=10;<br />
<br />
x+=5;<br />
<br />
return x;<br />
<br />
}<br />
<br />
int print 2(void)<br />
<br />
{<br />
<br />
static int x<br />
<br />
X=10;<br />
<br />
x+=5;<br />
<br />
return x;<br />
<br />
}<br />
<br />
int main()<br />
<br />
{<br />
<br />
int x;<br />
<br />
x=print 1();<br />
<br />
x+=print 1();<br />
<br />
x+=print 2();<br />
<br />
x+=print 2();<br />
<br />
printf(“%d”,x);<br />
<br />
return 0;<br />
<br />
}Programminghttps://csedoubts.gateoverflow.in/3365/c-programming-qsTue, 20 Aug 2019 09:28:13 +0000Virtual Gate :Programming question
https://csedoubts.gateoverflow.in/3364/virtual-gate-programming-question
<p>Assume that there are two lower triangular matrices $A$ and $B$ of size $n*n$. If matrix $A$ and transpose of $B$ are fit into a rectangular matrix $C$ of size $n*(n+1)$, then</p>
<ol start="1">
<li>$B[i,j]=C[i,j+1]$</li>
<li>$B[i,j]=C[j+1,i]$</li>
<li>$B[i,j]=C[j, i+1]$ </li>
</ol>
<hr>
<p>I cannot understand, how $n$ number of column fits into $n+1$ while transposing the matrix??</p>
<p>Say matrix $A=\begin{bmatrix} 1 &0 \\ 3 &4 \end{bmatrix}$</p>
<p>$B=\begin{bmatrix} 9 &0 \\ 6 &3 \end{bmatrix}$</p>
<p>Now $C$ will be $\begin{bmatrix} 1 & 9 & 6\\ 3 & 4 & 3 \end{bmatrix}$ like that ??</p>
<p>Then lower triangular matrix column will be transpose and shifted by $1$ position in new matrix. right??</p>
<p>So, Ans $2)$ right??</p>Programminghttps://csedoubts.gateoverflow.in/3364/virtual-gate-programming-questionTue, 20 Aug 2019 09:25:20 +0000