1
I want longest path from root to leaf. Then which code is correct among Code-1 or Code-2? Code-1) int tree(Struct node *root){ int a=0, b=0,c=0; if(root==NULL) return 0; if((root->left==NULL)&&(root->right==NULL)) return 1; a=1+tree(root->left); b=1+tree(root->right); c= ... 0; if((root->left==NULL)&&(root->right==NULL)) return 1; a=tree(root->left); b=tree(root->right); c=1+max(a,b); return c; }
2
$I=$Iterative Program $R=$ Recursive Program $(A)$ For every program belonging to class $I$, there is an equivalent program to class $R.$ $(B)$ Every program in $R$ uses strictly more stack space compared to equivalent program in $I.$ Among $(A)$ and $(B)$ which one is correct?
3
Consider the following function with a binary tree with atleast one node: int path(struct node *x, int len){ if(x==NULL) return B; else return A; } Assume the above function is used to check the given binary tree has any path with specified length from root to the leaf node . Let $T$ ... $B$ is $(len== -1)$ which of these two option correct? Please Explain.
1 vote
4
A default catch block catches, [A]. all thrown objects [B]. no thrown objects [C]. any thrown object that has not been caught by an earlier catch block [D]. all thrown objects that have been caught by an earlier catch block
5
6
What kind of linked list is best to answer question like “What is the item at position n?” a) Singly linked list b) Doubly linked list c) Circular linked list d) Array implementation of linked list
7
What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list? a) O(1) b) O(n) c) θ(n) d) θ(1)
8
How many element comparisons would heap sort use to sort the integers $1$ to $8$ if they were initially in sorted order, initially in reverse sorted order?
9
Let $A$ be a $3\times 3$ matrix such that $\mid A-I \mid=0$.If trace of $A=13$ and $det A = 32$ then sum of squares of the eigen values of $A$ is ..... $82$ $13$ $169$ $81$
10
Suppose the rank of the matrix $\begin{pmatrix}1&1&2&2\\1&1&1&3\\a&b&b&1\end{pmatrix}$ is $2$ for some real numbers $a$ and $b$. Then $b$ equals $1$ $3$ $1/2$ $1/3$
1 vote
11
A party of n persons take their seats at random at a round table,then the probability that two specified person do not sit together is $\left(\dfrac{2}{n-1}\right)$ $\left(\dfrac{n-3}{n-1}\right)$ $\left(\dfrac{n-2}{n-1}\right)$ $\left(\dfrac{1}{n-1}\right)$
1 vote
12
Let $A$ be a $3\times 3$ matrix with Eigen values $-1,1,0$.Then $\mid A^{100}+I\mid$ is...
13
Show that an edge in a simple graph is a cut edge if and only if this edge is not a part of any simple circuit in the graph.
14
Let $X_1,X_2,X_3,X_4$ be i.i.d. random variables each assuming the value $1$ and $-1$ with probability $\dfrac{1}{2}$ each. Then, the probability that the matrix $\begin{pmatrix}X_1 &X_2\\ X_3 &X_4\end{pmatrix}$ is nonsingular equals $1/2$ $3/8$ $5/8$ $1/4$
15
A plane is missing and it is presumed that it was equally likely to have gone down in any of three possible regions. Let 1 − αi denote the probability the plane will be found upon a search of the ith region when the plane is, in fact, in that region, i = 1, 2, ... What is the conditional probability that the plane is in the ith region, given that a search of region 1 is unsuccessful, i = 1, 2, 3?
16
Consider the undirected graph $G$ defined as follows. The vertices of $G$ are bits of strings of length $n$. We have an edge between vertex $u$ and $v$ if and only if $u$ and $v$ differ exactly in one bit position. The ratio of chromatic number of $G$ to the diameter of $G$ is . $\dfrac{1}{(2^{n-1})}$ $\dfrac{1}{n}$ $\dfrac{2}{n}$ $\dfrac{3}{n}$
17
Every student in this class has studied calculus If S(x) represents the statement that person x is in this class, C(x) which is the statement x has studied calculus. we see that our statement can beexpressed as ∀x(S(x) → C(x) ) Some student in this class has visited Mexico M(x), ... class. ∃x(S(x) ∧ M(x)) In 1st example Implication is taken Why in 2nd Example and is taken why not S(x) ->M(x)
18
which statement is true? 1)for any data file it is possible to construct two separate sparse first level index on different keys. 2)for any data file it is possible to construct two separate dense first level index on different keys. 3)for any data file it is possible to construct a sparse first level index and a dense second level indexboth should be useful 4) none.
1 vote
19
How many concurrent schedules are conflict serializable of given transactions T1 and T2: T1 = r1(A) W1(A)R1(B)W1(B) T2 = R2(B)W2(B)R2(A)W2(A)
20
$L = \{ wcww^r |\ w,c\ \epsilon\ ( a + b\ )^* \}$ Identify the language.
21
If all state of DFA is final then it accpets $\sum$ (i.e) regular true or false
22
What should be the minimum & maximum sampling rate for NYQUIST THEOREM?
23
Turing machine can be constructed by FA with 2 stacks??
24
Let the homomorphism defined over alphabet Σ{0, 1} is h(0) = aa and h(1) = aba, and L = (ab + ba)*a then what is h-1(L)?
1 vote
25
there is a proof for equivalence of empty stack and final state but what about the prefix property cases empty stack cant accept regular languages which donot accept the prefix property isnt it less powerful than the acceptance by final state ?? what kind of equivalence they have ??
1 vote
26
A decimal parallel adder that add n decimal digits needs how many BCD adder stages 1. n 2. 2n 3. 1 4 n^2