Most answered questions in Programming and DS

#61
31.8k
views
8 answers
55 votes
A circularly linked list is used to represent a Queue. A single variable $p$ is used to access the Queue. To which node should $p$ point such that both the operations $\t...
#62
11.2k
views
8 answers
33 votes
Consider the following nested representation of binary trees: $(X \ Y \ Z)$ indicates $Y$ and $Z$ are the left and right subtrees, respectively, of node $X$. Note that $Y...
#63
10.2k
views
8 answers
56 votes
An $n \times n$ array $v$ is defined as follows:$v\left[i,j\right] = i - j$ for all $i, j, i \leq n, 1 \leq j \leq n$The sum of the elements of the array $v$ is$0$$n-1$$n...
#64
10.4k
views
8 answers
33 votes
Consider the following recursive definition of $fib$:fib(n) := if n = 0 then 1 else if n = 1 then 1 else fib(n-1) + fib(n-2)The number of times $fib$ is called (includin...
#65
2.7k
views
7 answers
4 votes
What will be output if you will compile and execute the following C code? void main() { printf("%d",sizeof(5.2)); }$4$$8$$2$$16$
#66
1.7k
views
7 answers
1 votes
Which of the following is a valid heap? $a$$b$$c$$d$
#67
21.0k
views
7 answers
32 votes
Consider the following statements:The smallest element in a max-heap is always at a leaf nodeThe second largest element in a max-heap is always a child of a root nodeA ma...
#68
17.4k
views
7 answers
54 votes
Consider the following snippet of a C program. Assume that swap $(\&x, \&y)$ exchanges the content of $x$ and $y$:int main () { int array[] = {3, 5, 1, 4, 6, 2}; int done...
#69
25.8k
views
7 answers
104 votes
Consider the C functions foo and bar given below:int foo(int val) { int x=0; while(val 0) { x = x + foo(val ); } return val; }int bar(int val) { int x = 0; while(val 0)...
#70
19.1k
views
7 answers
38 votes
Let $T$ be a tree with $10$ vertices. The sum of the degrees of all the vertices in $T$ is ________
#71
35.8k
views
7 answers
88 votes
Consider the following C code:#include<stdio.h int *assignval (int *x, int val) { *x = val; return x; } void main () { int *x = malloc(sizeof(int)); if (NULL == x) return...
#72
12.3k
views
7 answers
25 votes
Consider the following C program.#include<stdio.h int main () { int m=10; int n, n1; n=++m; n1=m++; n ; n1; n-=n1; printf(“%d”, n); return 0; }The output of the prog...
#73
1.9k
views
7 answers
10 votes
What will be the output of the following code?#include <stdio.h #include <string.h int main() { char string[] = "Hello"; if(sizeof(string) <= strlen(string)) printf("1");...
#74
16.1k
views
7 answers
4 votes
Consider a single linked list where $F$ and $L$ are pointers to the first and last elements respectively of the linked list. The time for performing which of the given op...
#75
7.7k
views
7 answers
9 votes
If node A has three siblings and B is parent of A, what is the degree of A?0345
#76
14.2k
views
7 answers
50 votes
The following function computes $X^{Y}$ for positive integers $X$ and $Y$.int exp (int X, int Y) { int res =1, a = X, b = Y; while (b != 0) { if (b % 2 == 0) {a =...
#77
9.0k
views
7 answers
29 votes
The value printed by the following program is _______.void f (int * p, int m) { m = m + 5; *p = *p + m; return; } void main () { int i=5, j=10; f (&i, j); p...
#78
102k
views
7 answers
1 votes
Level of a node is distance from root to that node. For example, level of root is 1 and levels of left and right children of root is 2. The maximum number of nodes on lev...
#79
8.2k
views
7 answers
8 votes
What is the output of the following C program?#include<stdio.h void main(void){ int shifty; shifty=0570; shifty=shifty>>4; shifty=shifty<<6; printf("The value of shifty i...
#80
16.1k
views
7 answers
54 votes
Consider the following pseudo code, where $x$ and $y$ are positive integers.begin q := 0 r := x while r ≥ y do begin r := r - y q := q + 1 end endThe post condition tha...