search
Log In

Recent questions and answers in Programming and DS

0 votes
1 answer
1
When searching for the key value 50 in the binary search tree, node containing the key values 10,30,40,70,90,120,150,175 are traversed in any order.The number of different orders possible in which these keys values can occur on the search path from root to the node containing the value 50 are?
answered 1 day ago in Programming Sainath Mandavilli 149 views
2 votes
4 answers
2
33 votes
7 answers
3
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^2 - 3n +2$ $n^2 \frac{\left(n+1\right)}{2}$
answered 4 days ago in DS Sainikhil_avula 3.2k views
1 vote
3 answers
4
A ________ is a linear list in which insertions and deletions are made to from either end of the structure. Circular queue. Priority queue. Stack. Dequeue.
answered 5 days ago in DS Shashi Kamal Chakrab 146 views
25 votes
5 answers
5
A binary search tree contains the value $1, 2, 3, 4, 5, 6, 7, 8$. The tree is traversed in pre-order 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 \ 8 \ 7$ $5 \ 3 \ 2 \ 4 \ 1 \ 6 \ 7 \ 8$ $5 \ 3 \ 1 \ 2 \ 4 \ 7 \ 6 \ 8$
answered 5 days ago in DS nisargdoshi 8.8k views
8 votes
7 answers
6
Consider a 2 dimensional array A[40...95,40...95] in lower triangular matrix representation. The size of each element of array is 1 Byte.If array is implemented in memory as Row major,with base address as 1000,the address of A[66][50] is ..... Ans. 1361
answered 5 days ago in DS Kushagra गुप्ता 1.1k views
2 votes
5 answers
7
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.
answered 5 days ago in Programming Yogesh Chaurasiya 409 views
79 votes
4 answers
8
Suppose $n$ and $p$ are unsigned int variables in a C program. We wish to set p to $^nC_3$. If $n$ is large, which one of the following statements is most likely to set p correctly? $p = n * (n-1) * (n-2) / 6;$ $p = n * (n-1) / 2 * (n-2) / 3;$ $p = n * (n-1) / 3 * (n-2) / 2;$ $p = n * (n-1) * (n-2) / 6.0;$
answered Jul 28 in Programming siddharths067 6.2k views
10 votes
4 answers
9
An unrestricted use of the "go to" statement is harmful because of which of the following reason (s): It makes it more difficult to verify programs. It makes programs more inefficient. It makes it more difficult to modify existing programs. It results in the compiler generating longer machine code.
answered Jul 27 in Programming siddharths067 1k views
22 votes
8 answers
10
Aliasing in the context of programming languages refers to multiple variables having the same memory location multiple variables having the same value multiple variables having the same identifier multiple uses of the same variable
answered Jul 27 in Programming siddharths067 4k views
20 votes
12 answers
11
29 votes
9 answers
12
Consider a binary tree T that has $200$ leaf nodes. Then the number of nodes in T that have exactly two children are ______.
answered Jul 26 in DS Deepakk Poonia (Dee) 5.6k views
38 votes
4 answers
13
Consider a complete binary tree where the left and right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is $\Omega(\log n)$ $\Omega(n)$ $\Omega(n \log n)$ $\Omega(n^2)$
answered Jul 26 in DS sujithrkumar 5.3k views
31 votes
11 answers
14
What will be the output of the following $C$ program? void count (int n) { static int d=1; printf ("%d",n); printf ("%d",d); d++; if (n>1) count (n-1); printf ("%d",d); } void main(){ count (3); } $3 \ 1 \ 2 \ 2 \ 1 \ 3 \ 4 \ 4 \ 4$ $3 \ 1 \ 2 \ 1 \ 1 \ 1 \ 2 \ 2 \ 2$ $3 \ 1 \ 2 \ 2 \ 1 \ 3 \ 4$ $3 \ 1 \ 2 \ 1 \ 1 \ 1 \ 2$
answered Jul 26 in Programming dexter_n 6k views
2 votes
6 answers
15
What is the output of the following $C$-program main() { printf("%d %d %d",size of (3.14f), size of (3.14), size of (3.141)); } 4 4 4 4 8 10 8 4 8 8 8 8
answered Jul 23 in Programming Aakriti12 416 views
2 votes
1 answer
16
Prior to using a pointer variable it should be declared. initialized. both declared and initialized. none of these.
asked Mar 31 in Programming Lakshman Patel RJIT 231 views
0 votes
1 answer
17
A polynomial $p(x)$ is such that $p(0)=5, \: p(1)=4, \: p(2)=9$ and $p(3)=20$. The minimum degree it can have is $1$ $2$ $3$ $4$
asked Mar 31 in DS Lakshman Patel RJIT 159 views
2 votes
1 answer
18
2 votes
2 answers
19
What is the meaning of following declaration? int(*p[7])(); $p$ is pointer to function $p$ is pointer to such function which return type is array $p$ is array of pointer to function $p$ is pointer to array of function
asked Mar 31 in Programming Lakshman Patel RJIT 124 views
2 votes
1 answer
20
0 votes
1 answer
21
Which of the following is the correct order of evaluation for the below expression? $z=x+y^*z/4\%2-1$ $^*/\%+-=$ $=^*/\%+-$ $/^*\%-+=$ $^*\% /-+=$
asked Mar 31 in DS Lakshman Patel RJIT 74 views
1 vote
1 answer
22
0 votes
1 answer
23
What data structures is used for depth first traversal of a graph? Queue Stack List None of the above
asked Mar 31 in DS Lakshman Patel RJIT 85 views
1 vote
1 answer
24
In the ________ traversal we process all of a vertex's descendants before we move to an adjacent vertex. Depth First Breadth First Width First Depth Limited
asked Mar 31 in DS Lakshman Patel RJIT 108 views
1 vote
2 answers
25
1 vote
1 answer
26
What will be output if you will compile and execute the following C code? void main(){ char c=125; c=c+10; printf("%d",c); } $135$ $115$ $-121$ $-8$
asked Mar 31 in Programming Lakshman Patel RJIT 114 views
1 vote
4 answers
27
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$
asked Mar 31 in Programming Lakshman Patel RJIT 140 views
0 votes
1 answer
28
0 votes
1 answer
29
The maximum number of nodes in a binary tree of level $k, k\geq1$ is: $2^k+1$ $2^{k-1}$ $2^k-1$ $2^{k-1}-1$
asked Mar 31 in DS Lakshman Patel RJIT 84 views
1 vote
1 answer
30
The following program is to be tested for statement coverage: begin if(a==b){S1;exit;} else if (c==d){S2;} else{S3;exit;} S4; end The test cases $T1,T2,T3$ and $T4$ given below are expressed in terms of the properties satisfied by the values of variables $a,b,c$ ... of the test suites given below ensures coverage of statements $S1,S2,S3$ and $S4$? $T_1,T_2,T_3$ $T_2,T_4$ $T_3,T_4$ $T_1,T_2,T_4$
asked Mar 30 in Programming Lakshman Patel RJIT 74 views
1 vote
2 answers
31
Output of following program #include<stdio.h> int main() { int i=5; printf("%d %d %d", i++,i++,i++); return 0; } $7\:6\:5$ $5\:6\:7$ $7\:7\:7$ Compiler Dependent
asked Mar 30 in Programming Lakshman Patel RJIT 97 views
1 vote
1 answer
32
Output of following program? #include<stdio.h> void dynamic(int s,...) { printf("%d",s); } int main() { dynamic(2,4,6,8); dynamic(3,6,9); return 0; } $2\:3$ Compiler Error $4\:3$ $3\:2$
asked Mar 30 in Programming Lakshman Patel RJIT 78 views
1 vote
1 answer
33
Assume that float takes $4$ bytes, predict the output of following program. #include<stdio.h> int main() { float arr[5]={12.5,10.0,13.5,90.5,0.5}; float *ptr1=&arr[0]; float *ptr2=ptr1+3; printf("%f",*ptr2); printf("%d",ptr2-ptr1); return 0; } $90.500000\:\:3$ $90.500000\:\:12$ $10.000000\:\:12$ $0.500000\:\:3$
asked Mar 30 in Programming Lakshman Patel RJIT 69 views
1 vote
1 answer
34
Assume that size of an integer is $32$ bit. What is the output of following ANSI C program? #include<stdio.h> struct st { int x; static int y; }; int main() { printf(%d",sizeof(struct st)); return 0; } $4$ $8$ Compiler Error Runtime Error
asked Mar 30 in Programming Lakshman Patel RJIT 74 views
1 vote
1 answer
35
Consider the following C declaration struct { short s[5]; union { float y; long z; }u; }t; Assume that objects of the type short, float and long occupy $2$ bytes, $4$ bytes and $8$ bytes respectively. The memory requirement for variable $t$ ignoring alignment considerations, is $22$ bytes $14$ bytes $18$ bytes $10$ bytes
asked Mar 30 in Programming Lakshman Patel RJIT 55 views
1 vote
1 answer
36
#include<stdio.h> struct st { int x; struct st next; }; int main() { struct st temp; temp.x=10; temp.next=temp; printf("%d",temp.next,x); return 0; } Compiler Error $10$ Runtime Error Garbage Value
asked Mar 30 in Programming Lakshman Patel RJIT 95 views
1 vote
1 answer
37
What does the following function do for a given Linked List with first node as head? void fun1(struct node* head) { if(head==NULL) return; fun1(head->next); printf("%d",head->data); } Prints all nodes of linked lists Prints all nodes of linked list in reverse order Prints alternate nodes of Linked List Prints alternate nodes in reverse order
asked Mar 30 in Programming Lakshman Patel RJIT 114 views
1 vote
1 answer
38
Consider the following function that takes reference to head of a Doubly Linked List as parameter. Assume that a node of doubly linked list has previous pointer as $\textit{prev}$ and next pointer as $\textit{next}$. void fun(struct node ** ... $6 \leftrightarrow 5 \leftrightarrow 4 \leftrightarrow 3 \leftrightarrow 1 \leftrightarrow 2$
asked Mar 30 in Programming and DS Lakshman Patel RJIT 52 views
1 vote
1 answer
39
Let $A$ be a square matrix of size $n\times n$. Consider the following program. What is the expected output? C=100 for i=1 to n do for j=1 to n do { Temp=A[i][j]+C A[i][j]=A[j][i] A[j][i]=Temp-C } for i=1 to n do for j=1 to n ... ]); The matrix $A$ itself. Transpose of matrix $A$. Adding $100$ to the upper diagonal elements and subtracting $100$ from diagonal elements of $A$. None of the option.
asked Mar 30 in Programming Lakshman Patel RJIT 57 views
1 vote
1 answer
40
Following is C like Pseudo code of a function that takes a number as an argument, and uses a stack S to do processing. void fun(int n) { Stack S;//Say it creates an empty stack S while(n>0) { // This line pushes the value of n%2 to stack S; Push(&S,n%2); n=n ... $n$ in reverse order. Prints binary representation of $n$. Prints the value of $\log n$. Prints the value of $\log n$ in reverse order.
asked Mar 30 in Programming Lakshman Patel RJIT 59 views
To see more, click for all the questions in this category.
...