Related Questions8 Items
Q1.NUMERICAL
c
include <stdio.h>
int foo(int S,int size){
if(size == 0) return 0;
if(size == 1) return 1;
if(S0 != S1) return 1+foo(S+1,size-1);
return foo(S+1,size-1);
}
int main(){
int A={0,1,2,2,2,0,0,1,1};
printf("%d",foo(A,9));
return 0;
}
The value printed by the given C program is . (Answer in integer)
Q2.NUMERICAL
Consider the following C program:
c
include <stdio.h>
int gate (int n) {
int d, t, newnum, turn;
newnum = turn = 0; t=1;
while (n>=t) t = 10;
t /=10;
while (t>0) {
d = n/t;
n = n%t;
t /= 10;
if (turn) newnum = 10newnum + d;
turn = (turn + 1) % 2;
}
return newnum;
}
int main () {
printf ("%d", gate(14362));
return 0;
}
The value printed by the given C program is . (Answer in integer)
Q3.NUMERICAL
c
include <stdio.h>
void foo(int p, int x) {
p = x;
}
int main() {
int z;
int a = 20, b = 25;
z = &a;
foo(z, b);
printf("%d", a);
return 0;
}
The output of the given C program is . (Answer in integer)
Q4.NUMERICAL
The height of any rooted tree is defined as the maximum number of edges in the path from the root node to any leaf node.
Suppose a Min-Heap $T$ stores $32$ keys. The height of $T$ is \\\\\\\. (Answer in integer)
Q5.M-MCQ
Which of the following statement(s) is/are TRUE for any binary search tree (BST) having $n$ distinct integers?
Q6.NUMERICAL
The pseudocode of a function fun() is given below:
!image(https://uadmin.udsfgecw.tech/file/download/public/public:a0c49ceb-c3c7-4ed8-a756-67719ef01d2e.png)
Let 𝐴0, … ,29 be an array storing 30 distinct integers in descending order. The
number of swap operations that will be performed, if the function fun() is called
with 𝐴0, … ,29 as argument, is . (Answer in integer)
Q7.MCQ
An array $82, 101, 90, 11, 111, 75, 33, 131, 44, 93$ is heapified. Which one of the following options represents the first three elements in the heapified array?
Q8.MCQ
Consider a binary min-heap containing 105 distinct elements. Let $k$ be the index (in the underlying array) of the maximum element stored in the heap. The number of possible values of $k$ is
Computer Science And EngineeringProgramming & Data StructuresNumerical Answer (NAT)1 Mark
Q4.
The height of any rooted tree is defined as the maximum number of edges in the path from the root node to any leaf node.
Suppose a Min-Heap T stores 32 keys. The height of T is _______. (Answer in integer)
A
5