search
Log In

Recent questions in Programming and DS

0 votes
1 answer
1
Consider the process of inserting an element into a $Max\ Heap$, where the $Max\ Heap$ is represented by an $array$. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of $comparisons$ performed is $\Theta(\log _{2}n)$ $\Theta(n\log _{2} \log_2 n)$ $\Theta (n)$ $\Theta(n\log _{2}n)$
asked Apr 2 in DS Lakshman Patel RJIT 252 views
0 votes
1 answer
2
The question is based on the following program fragment. f(intY[10],int x){ int u,j,k; i=0;j=9; do{ k=(i+j)/2; if(Y[k] < x) i=k; else j=k; } while(Y[k]!=x) && (i<j)); if (Y[k]==x) printf( x is in the array. ); else printf( x is not in the array. ); } On which of the following contents of ... $x>2$ $Y$ is $[2\;4\;6\;8\;10\;12\;14\;16\;18\;20]$ and $2<x<20$ and $'x'$ is even
asked Apr 1 in Programming Lakshman Patel RJIT 158 views
0 votes
1 answer
3
What will be the output of following? main() { Static int a = 3; Printf(“%d”,a--); If(a) main(); } $3$ $3\;2\;1$ $3\;3\;3$ Program will fall in continuous loop and print $3$
asked Apr 1 in Programming Lakshman Patel RJIT 95 views
0 votes
1 answer
4
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number number of nodes in a binary tree of height $h$ is $2^{h}$ $2^{h-1} – 1$ $2^{h+1} – 1$ $2^{h+1}$
asked Apr 1 in DS Lakshman Patel RJIT 91 views
0 votes
2 answers
5
0 votes
1 answer
6
If queue is implemented using arrays, what would be the worst run time complexity of queue and dequeue operations? $O(n),O(n)$ $O(n),O(1)$ $O(1),O(n)$ $O(1),O(1)$
asked Apr 1 in DS Lakshman Patel RJIT 55 views
0 votes
1 answer
7
The following program fragment prints int i = 5; do { putchar(i+100); printf(“%d”, i--;) } while(i); i5h4g3f2el 14h3g2f1e0 An error message None of the above
asked Apr 1 in Programming Lakshman Patel RJIT 56 views
0 votes
1 answer
9
Consider the following declaration. int a, *b = &a, **c = &b; a = 4; **c = 5; If the statement b = (int *)**c Is appended to the above program fragment then Value of $b$ becomes $5$ Value of $b$ will be the address of $c$ Value of $b$ is unaffected None of these
asked Apr 1 in Programming Lakshman Patel RJIT 47 views
0 votes
2 answers
10
0 votes
2 answers
11
0 votes
0 answers
12
A binary search tree contains the values-$1,2,3,4,5,6,7$ and $8.$ The tree is traversed in preorder and the values are printed out. Which of the following sequences is a valid output? $5\;\;3\;\;1\;\;2\;\;4\;\;7\;\;8\;\;6\;\;$ $5\;\;3\;\;1\;\;2\;\;6\;\;4\;\;9\;\;7$ $5\;\;3\;\;2\;\;4\;\;1\;\;6\;\;7\;\;8$ $5\;\;3\;\;1\;\;2\;\;4\;\;7\;\;6\;\;8$
asked Apr 1 in DS Lakshman Patel RJIT 68 views
0 votes
0 answers
13
The question is based on the following program fragment. f(intY[10],int x){ int u,j,k; i=0;j=9; do{ k=(i+j)/2; if(Y[k] < x) i=k; else j=k; } while(Y[k]!=x) && (i<j)); if (Y[k]==x) printf( x is in the array. ); else printf( x is not in the array. ); } On which of the following contents of ... $x>2$ $Y$ is $[2\;4\;6\;8\;10\;12\;14\;16\;18\;20]$ and $2<x<20$ and $'x'$ is even
asked Apr 1 in Programming Lakshman Patel RJIT 58 views
0 votes
2 answers
14
0 votes
2 answers
15
1 vote
1 answer
16
Which of the following is illegal declaration in $C$ language? char*str ="Raj is a Research scholar"; charstr[25] ="Raj is a Research scholar"; charstr[40] ="Raj is a Research scholar"; char[]str ="Raj is a Research scholar";
asked Mar 31 in Programming Lakshman Patel RJIT 85 views
1 vote
1 answer
17
The address field of linked list : Contain address of next node May contain null character Contain address of next pointer Both $\left (A \right)$ and $\left ( B \right)$
asked Mar 31 in DS Lakshman Patel RJIT 78 views
1 vote
1 answer
18
The expression $5-2-3^{*} – 2$ will evaluate to $18$, if : $‘ – ‘$ is left associative and $‘*‘$ has precedence over $‘ – ‘$ $‘ – ‘$ is right associative and $‘*‘$ has precedence over $‘ – ‘$ $‘ – ‘$ is right associative and $‘ – ‘$ has precedence over $‘*‘$ $‘ – ‘$ is left associative and $‘ – ‘$ has precedence over $‘*‘$
asked Mar 31 in DS Lakshman Patel RJIT 70 views
1 vote
3 answers
19
What is the correct way to round off $x$, $a$ $\text{float}$ to an $\text{int}$ value? $y=(\text{int})(x+0.5)$ $y=\text{int} (x+0.5)$ $y=(\text{int}) x+0.5$ $y=(\text{int})(\text{int})x+0.5)$
asked Mar 31 in Programming Lakshman Patel RJIT 165 views
2 votes
6 answers
20
What error would the following function give on compilation? f(int a, int b) { int a; a=20; return a; } Missing parenthesis is $\textit{return}$ statement. Function should be defined as $\text{int f(int a, int b)}$ Redeclaration of $a$. None of these.
asked Mar 31 in Programming Lakshman Patel RJIT 492 views
...