Download as pdf or txt
Download as pdf or txt
You are on page 1of 245

WELCOME

Question 1
What will be the output of the following pseudocode ?
Int a=9,b=7,c=8,d=4,e
e=a+b+c+d/4
if(e>5)
print “PASS”
A: 1
else
B: PASS
print “FAIL”
C: FAIL
D: 0
Question 2
Integer a=3,b=2
if(a+b<7)
a=a*0+b
else
for i=1 to 4
a=a+i
End for loop A: 2 3
Print a, b+1 B: None of the mentioned options
C: 4 3
D: 3 3
Question 3
What will be the output of the following pseudocode?
int p=2,q=6,r=9,I
if(r>p+q)
for i=1 to 3
p=p+q
q=q+1 A: 32 10 22
end for B: 23 9 9
r=p-q C: 15 8 7
print p,q,r D: 23 9 14
Question 4
What will be the output of the following pseudocode?
int a=15,b=45,c=9, I
if((c>(a+b) OR a< (5*c))
for i =1 to 3
c=c*2
Else A: 48,9

while(a>6) B: 45, 72

b=b+1 C: 45,9

a=a-4 D: 41,4

end while
Print b,c
Question 5
What will be the output of the following pseudocode?
fun(int a)
if(a<1)
return
else
A: 1 2
print a
B: 3 2 1 1 2 3
fun(a-1)
C: 2 1 1 2
print a
D: 2 1
return
Question 6
What will be the output of the following pseudocode if the value of n1
and n2 are 12 and 30 respectively ?
Declare integer variables n1,n2,i,j and flag
Read the values of n1 and n2
for i=n1+1 to n2-1
set flag=1
for j=2 to i/2
if i mod j=0 then set flag=0
break
end if
end for
Question 6
If flag=1 then print I
End if
Set i=i+1
End for
A: will print all values from 12 to 30
stop
B: 12 15 18 21
C: 13 15 17 19 21 23 25 27 29
D: 13 17 19 23 29
Question 7
What will be the output of the following pseudocode ?
intger a,b,c
Set a=10,b=20
For(c=a;c<=b;c=c+2)
a=a+c A: 20 23
b=b-a+c B: 20
if(a>10) C: 22
print a D:20 32
else
print b
Question 8
Integer a,b,c,a1,b1,c1,a2,b2,c2
Set a1=2,b1=45 and c1=36
set a2=11,b2=26,c2=30
A: 13 12 66
c=c1+c2
B: 14 12 6
b=c/60
C: 13 71 66
c=c mod 60
D: 14 12 1
b=b+b1+b2
a=b/60
b=b mod 60
a=a+a1+a2
Print a b c
Question 9
Integer a,b
set a=2,b=50
while (b>0)
a=b mod 2+a
if( a mod 3 IS EQUAL TO 0)
print a
A: 50 10 2
else
B: 49 3 1
print b-1
C: 50 3 2
b=b/5
D: 3 3 3
a=a+1
Question 10
what will be the output of the following pseudocode?
Intger i,j,sum,n
set sum =0,n=7
repeat for i =1 to n
A: 204
sum=sum+(i*i)
B: 64
end loop
C: 8
print sum
D: 140
Question 11

what will be the output of the following pseudocode?


int j=41,k=37
j=j+1
k=k-1
A: 1 1
j=j/k
B: 1 36
k=k/j
C: 36 1
print k,j
D: 42 36
Question 12

what will be the output of the following pseudocode?


Declare Integer c,d,r
integer array[6]={23,45,67,12,13,25}
for(c=0;c<5;c++)
for(d=0;d<5-c-1;d++)
if(array[d]>arra[d+1])
r=array[d]
array[d]=array[d+1]
array[d+1]=r
end if
end for
Question 12

end for
for(c=0;c<=5;c++)
print array[c]
end for A: 67 45 23 13
B: 67 45 23 13 12
C: 45 67
D: 12 13 23 25 45 67
Question 13

what will be the ouput of the following the pseudocode?


int a=2,b=3,c=3,d=4
if(d<5 & d>(c=a+b))
print A
A: B 3
else
B: B 5
print B
C: A 3
print c
D: A 5
Question 14

what will be the output of the following the pseudo code for the input
n=6745?
read n
assign the given integer to a new variable q=n and set rn=0
r=q mod 10
rn=rn*10+r
A: 5476
q=q/10
B: 7645
repeat steps 4 to 6 while q>0
C: 3423
print rn
D: 457
Question 15
what will be the output of the following the pseudo code?
int a=10,b=4,I
if(a>b)
if(a+b>14)
print a
else
A: 4
for(i=1 to 3)
B: 14
a=a+i
C: 16
end for
D: 10
print a
else print b
Question 16
what will be the output of the following the pseudo code for input 4
int sum(int num)
if num is not equal to 0
return num + num*sum(num-1)
else print num

A: 26
B: 15
C: 44
D: 64
Question 17
what will be the output of the following the pseudo code for the input
x=22 and y=3?
declare x,y,m,n
set m=x and n=y
while m not equal to n then
if m greater than n
m=m-1
A: 4
else
B: 12
n=n-1
C: 3
end while
D: None of the mentioned
print n
Question 18
what will be the output of the following the pseudo code if we call fun1()
and the value of n is 5?
fun(int n, int a)
if(n==0) return a
A: 15
return fun(n-1,n*a)
B: 16
fun1(int n)
C: 120
return fun(n,1)
D: 24
Question 19
what will be the output of the following the pseudo code?
int a,b,c
set a=10,b=20
for(c=a;c<=b;c=c+2)
a=a+c A: 20 32
b=b-a+c B: 20
if(a>10) C: 22
print a D: 20 23
else
print b
Question 20
what will be the output of the following the pseudo code?
int a=6,b=9
intger n
set res=1
if(a>10 && b<a)
print error message
A: 21
else
B: 30
for(n=a;n<b;n=n+1)
C: error
res=res*n
D: 20
print res
Question 21
what will be the output of the following the pseudo code for a=3
void fun(int a)
if(a<1)
return
else A: 1 2
print a B: 3 1 1 3
fun(a-2) C: 2 1 1 2
print a D: 2 1 0
return
Question 22
what will be the output of the following the pseudo code?
int a=1,b=2
for (int i=0;i<=6;i=i+2)
a=a+b+I
a=a+b
b=a-b
print b A: 3 9 23 70
B: 3 7 10
C: 3 10 27 71
D: 3 10 27 70
Question 23
what will be the output of the following the pseudo code?
int a=2,b=3
int result=1
while(b!=0)
result =result*a
b=b-1
if(result>5) A: 8 1
a=a-1 B: 7 3
else C: 3 4
a=a+1 D: 6 1
print result,a
Question 24
what will be the output of the following the pseudo code?
int p=4,q=7,r=10
p= q mod r
q= q+p
r= r+q
print p,q,r
A: 7 11 17
B: 4 11 17
C: 7 14 24
D: 7 14 21
Question 25
what will be the output of the following the pseudo code?
input f=6,g=9 and set sum=0
integer n
if(g>f)
for(n=f;n<g;n=n+1)
sum=sum+n
end for loop A: 21
else B: 15
print error message C: 9
print sum D: 6
Question 26
what will be the output of the following the pseudo code?
1.int m=0,n=13,flag=0,I
2.m=n/2
3.for(i=2 to m)
4. if(n mod i=0)
5. flag=1 A: 1
6. goto line 9 B: 13
7.end if C: error
8.end for loop D: none
if flag=0 print n
else print 1
Question 27
what will be the output of the following the pseudo code?
int a,b
set a=125, b=122
if((a+b) MOD 2 EQUALS 0)
while(a>0)
b=a+b ; a=a/5
end while A: 234
print b B: 274
else C: 278
a=a-b; a=a/2 D: 2
print a
Question 28
what will be the output of the following the pseudo code?
int y,z,k,c; set y=8,z=3,k=1
if(z+k<y)
if(z mod 2 not equals 0)
c=y+z
else
c=y+k A: 8
y=y+z+k+c B: 20
else C: 21
y=y+c+k D: 23
print y
Question 29
what will be the output of the following the pseudo code for p=3, q=4
int fun1(int p,int q)
if(q equals 0)
return 0
if(q mod 2 equals 0)
return fun1(p+p,q/2)
return fun1(p+p,q/2)+p A: 12
B: 8
C: 7
D:None
Question 30
what will be the output of the following the pseudo code?
declare a, I,b
for i=0 to 4
increment a by 1
if i=3
print hello
get out of loop A: hello
end if B: 1
end for C: hello4
print a D: 4
Question 31
what will be the output of the following the pseudo code?
int i , N=5
int sum=0
for i=1 to 5
sum= sum+(i*i)
print sum
A: 70
B: 65
C: 25
D: 55
Question 32
what will be the output of the following the pseudo code?
int a=3,b=13,c=14,d=7,I,j
if(a+c > b+d)
for(i=a to d)
c=c+i+b
i=i+1
print c A: 32
else B: 23
for (int j=b to c) C: 46
a=a+j+d D: 44
print a
Question 33
what will be the output of the following the pseudo code?
main()
{
int num[]={1,4,8,12,16}
int *a,*b;
int I;
a=num; A: 1,4,8
b=num+2; B: 2,4,8
i=*a++ C: 4,4,8
print(“%d,%d,%d”,i,*a,*b); D: 2,1,8
}
Question 34
what will be the output of the following the pseudo code?
int m=3 n=2, o=4
while(n>0)
m=m*o+n
n=n-1
end while
o=o+m A: 57 0 61
print m,n,o B: 3 2 4
C: 3 0 4
D: 61 0 57
Question 35
what will be the output of the following the C code?
#include<stdio.h>
void main()
{
int x=9,y=2,z=6;
int a=x & y | z;
printf(“%d”,a); A: 2
} B: 6
C: 0
D: None
Question 36
what will be the output of the following the pseudo code for Num=10?
declare i,j and Num
repeat for i=1 to Num
declare static sap and set sap=0
sap=sap+I
j=sap
end loop A: 65
print j B: 85
C: 75
D: 55
Question 37
what will be the output of the following the pseudo code ?
Integer a=1,b=2
for (int i=0;i<=6;i=i+2)
a=a+b+I A: 3 9 23 70
a=a+b B: 3 7 10
b=a-b C: 3 101 27 71
print b D: 3 10 27 70
end for
Question 38
what will be the output of the following the pseudo code for input 134?
int fun1(int num)
static int a=0
if(num>0)
a=a+1 A: 2
fun1(num/10) B: 8
else C: 3
return a D: 431
Question 39
what will be the output of the following the pseudo code ?
integer num,x,y,count=0
x=num<<1
y=x^num
y=y+1
while((y/2) NOT EQUALS 0)
if( y MOD 2 NOT EQULAS 0)
count=count+1
else
y=y/2
Question 39
if(count)
print “0”
print y
else
print “1”
print x

A: 0 85
B: 0 1
C: 1 171
D: 1 170
Question 40
what will be the output of the following the C code?
#include<stdio.h>
int main()
{
int y=5;
int z=y+(y=10)
print(“%d\n”,z); A: 4
} B: 20
C: 12 or 20
D: 12
Question 41
the following pseudo code is used for;
let LB be the lower bound and UB be upper bound of a linear array
initialize count kat lower bound LB
repeat for k=LB to UB
print a[k]

A: Inserting element in an array


B: sorting an array
C: deleting an element from an array
D: traversing of array
Question 42
what will be the output of the following the pseudo code?
Integer i,j,sum,n
set sum=0, n=7
repeat for i=1 to n
repeat for j=1 to i-1
sum=sum+j
end loop A: 35
end loop B: 84
print sum C: 147
D: 56
Question 43
what will be the output of the following the C code?
#include<stdio.h>
int main()
{
int x=4, y=0; A: 1
int z; B: 0
z=(y++,y); C: undefined behavior
printf(“%d”,z); D: compilation error
return 0;
}
Question 44
comment on the output of the following C code.
#include<stdio.h>
void main()
{
int k=4; A: it will print address of r
int *const p=&k; B: it will print address k + address of r
int r=3; C: it will print address of k
p=&r; D: compile time error
printf(“%d”,p);
}
Question 45
what will be the output of the following the pseudo code for x=11 y=5?
fun(int x, int y)
if(x==0)
return y
else A: 71
return fun(x-1, x-y) B: 15
C: None
D: Infinite loop
Question 46
what will be the output of the following the pseudo code for input 7?
1.read the value of N
2.set m=1, T=0
3.if m>N
4. go to line no 9
5.else
6. T=T+m
A: 56
7. m=m+1
B: 76
8. go to line no 3
C: 28
9. display the value of T
D: 32
Question 47
what will be the output of the following the pseudo code ?
declare variable x,y and I
set x=0 and y=1
for(int i=1;i<=4;i++)
print x
x=x+y
y=x/y
A: 0 1 2 4
end for
B: 0 1 2 3
C: 1 0 2 4
D: 0 1 3 8
Question 48
what will be the output of the following the pseudo code?
int n=343, r, s, m
set m=n
while(n is not equal to 0)
r=n mod 10 A: 343 344
s=s*10+r B: 343 342
n=n/10 C: 340 342
end while D: 300 342
print s
If n is equal to m print m+1
else print m-1
Question 49
what will be the output of the following theC code?
#include<stdio.h>
union sti{
int nu;
char m;
};
int main() A: 12
{ B: 16
union sti m; C: 5
printf(“%d”, sizeof(m)); D: 4
}
Question 50
what will be the output of the following the pseudo code for n=2
int fun(int n)
if n equals to 4
return n
else
return 2*fun(n+1)

A: 4
B: 2
C: 16
D: 8
Question 51
what will be the output of the following the pseudo code?
Integer a,b
set a=10, b=7
for (int i=1;i<=5;i++)
A: 3 -3 -8 -12 -15
a=a+i+b
B: -6 -13 -19 -24 -28
while(a>6)
C: 3 -3 -8 -15
a=a+b
D: 3 2 1 0 -3
b=b-1
a=a-1
end while
print a
Question 52
what will be the output of the following the pseudo code ?
declare integer n,value,x1,x2
set value to 0, x1 to 0 and x2 to 1
set n to 5
repeat n times A: 10
print value B: 0 1 1 2 3
value = x1+x2 C: 0 1 2 3 5
x2=x1 D: 1 2 3 5 8
x1=value
end loop
Question 53
what will be the output of the following the pseudo code?
Integre a,b
a=2, b=50
while(b>0)
A: 50 10 2
a=b MOD 2+a
B: 50 3 2
if(a MOD 3 IS EQUAL TO 0)
C: 49 3 1
print a
D: 3 3 3
else
print b-1
b=b/5
a=a+1
Question 54
what will be the output of the following the pseudo code ?
integer i,f,num
set f=1, num=8
repeat for i=1 to num
A: 0
f=f*I
B: 8
end loop
C: 1
print f
D: 40320
Question 55
what will be the output of the following the pseudo code?
char str[10]=“India”, ch=‘n’
int ind[10], loop, j=0
for(loop =0;str[loop]!=‘\0’;loop=loop+1) A: 4
if(str[loop]==ch) B: 3
int[j++]=loop C: 1
for(loop=0;loop<j;loop++) D: 0
print int[loop]
Question 56
what will be the output of the following the pseudo code if we call fun1()
and the value of n is 5?
fun(int n, int a)
if(n==0) return a
return fun(n-1,n*a) A: 16

fun1(int n) B: 15

return fun(n,1) C: 120


D: 24
Question 57
what will be the output of the following the pseudo code ?
itn a
int main()
while(a)
A: infinite loop
fun1()
B: flower
main()
C: Lilly
print flower
D: flower Lilly
int fun1()
print Lilly
Question 57
what will be the output of the following the pseudo code ?
itn a
int main()
while(a)
A: infinite loop
fun1()
B: flower
main()
C: Lilly
print flower
D: flower Lilly
int fun1()
print Lilly
Question 58
what will be the output of the following the pseudo code?
Intger n=1234
Intger q,r and rn
set q=n and rn=0
while(q>0) A: 100
r=q mod 10 B: 36
rn=rn+r^3 C: 321
q=q/10 D: 10
end while
print rn
Question 59

what will be the output the following pseudocode?


Int a=2,b=3,c=3,d=4
A: B 3
If(d>5 && d>(c=a+b))
B: A 3
print A
C: A 5
Else
D: B 5
Print B
print c
Question 60

what will be the output the following pseudocode for a given array
a[5]=3,4,6,1,2 and pos is 2?
declare I,j,n,pos A: 3 4 2 1 2

repeat for j =pos to n-1 B: 3 2 4 6 1 2

set a[j]=a[j+1] C: 3 6 1 2

n=n-1 D: 3 4 1 2

display the new array


Question 61

consider the following pseudocode. How many multiplications will be


performed
m=2 A: one sixth of the product of 3 consecutive
for i=1 to N numbers
for j=i to N B: half of the product of the 3 consecutive
for k=j+1 to N integers
M=M*3 C: None of the mentioned
end for D: one third of the product of the 3
end for consecutive integers
end for
Question 62

what will be the output the following C code?


#include<stdio.h>
int main()
A: compile time error
{
B: inside if
int x=0;
C: inside else
if(x==1)
D: inside else if
if(x==0)
printf(“inside if”);
else
printf(“inside else if”);
else printf(“inside else”);}
Question 63
what will be the output the following pseudocode?
integer result and set num1=5,num2=7,num3=6
if(num1>num2)
if(num1>num3) A: 5
result=num1 B: 4
else C: 7
result=num3 D:logical error
else if(num2>num3)
result=num2
else result=num3
print result
Question 64

what will be the output the following pseudocode for input a=9 and b=9
function(input a, input b)
if(a<b) A:65
return function(b,a) B: 72
elseif(b!=0) C: 56
return (a+function(a,b-1)) D: 88
else
return 0
Question 65
what will be the output the following pseudocode ?
input 5
Algorithm(int num) A: successful
set int i=2 B: un successful
while i<=num/2 C: it will not print anything
if num mod i=0 D: undefined behavior of algorithm
print “un successful” and exit
i=i+1
if(i==(num/2)+1)
print “successful”
Question 66

what will be the output the following C code?


#include<stdio.h>
int main()
{
int x=2,y=0,z=3;
A: 3
x>y?printf(“%d”,z):return z:
B: Run time error
}
C: Compile time error
D: 1
Question 67

what will be the output the following pseudocode ?


input m=9,n=6
m=m+1
n=n-1
m=m+n A: 15
if(m>n) B: 5
print m C: 6
else D: 10
print n
Question 68

what will be the output the following pseudocode ?


declare f,g and I
set f=0 and g=1
for i=1 to 4
print f
A: 0 1 3 8
f=f+g
B: 0 1 1 8
g=f+g
C: 0 2 5 8
end
D: 0 1 1 2
Question 69

what will be the necessary condition to get desired element from a given
array by using the following algorithm?
if LOC=-1
Do_something(DATA, N, ITEM, LOC)
initialize counter set LOC=0, LOW=0,HI=N-1
repeat while LOW<=HI
MID=LOW+HI/2
if ITEM=DATA[MID]
LOC=MID
return LOC
if ITEM <DATA[MID]
Question 69

if ITEM <DATA[MID]
HI=MID-1
else
LOW=MID+1

A: The array should contain more then one element


B: The elements in an array should be in the sorted form
C: No pre-condition required for the algorithm to work
D:The elements in an array should be unsorted
Question 70

what will be the output of the following C code?


#include<stdio.h> printf(“%d”,a);
int main() return 0;
{ int a=0,i=0,b; }
for(i=0;i<5;i++)
{
a++; A: 2
if(i==3) B: Hello World
printf(“hello world”); C: 1
break; D: 4
}
Question 71

what will be the value of b at the end of the pseudocode?


a=1
b=1
while(a<=500)
begin
A: 4
a=2^a //( 2 power a)
B: 6
b=b+1;
C: 7
end
D: 5
Question 72

what will be the output of the pseudocode?


integer x,y,z
if x>y
if z>y A: it will display two if z<=y
display “one” B: it will display two if x>y>z
else C: it will display four if x<=y
if z is equal to x D: it will display four if x>y>z
display “two”
else
display “three”
else display “four”
Question 73

what does the run() do in general?


int fun(int x,int y)
{
int(y==0)
return 0;
A: calculate x+x*y
return (x+fun(x,y-1));
B: calculate x^y
}
C: calculate c*y
int run(int a,int b)
D: calculate y^x
{
if(b==0) return 1;
return fun(a,run(a,b-1)); }
Question 74

consider the following fragment.


which of the following statements will be executed in this case?
Integer x=10,y=3 and z=7
if(x/y!=0)
if y>z s1
else s2 A: statement s2 will be executed
else s3 B: statement s1 will be executed
C: statement s3 will be executed
D: non of the mentioned
Question 75

1. what will be the output of the pseudocode?


2. integer i=0
3. i=i+12
4. print I
5. if(i<60) A: 12 24 36 48 60 61
6. goto line 2 B: 0 12 0 12 13
7. else C: 0 12 24 25
8. print i+1 D: None of the mentioned
9. end if
Question 76

what will be the output of the pseudocode?


integera=5, b=8, c
If (a>8 OR b<7)
c=a+b
elseif(a+b>9) A: 5 1
c=a-b B: 5 -3
else C: 2 0
a=a+5 D: 2 -3
c=c-2
a=a+b
print a and c
Question 77

data structure representation in memory is termed as:

A: File structure
B: Recursive data type
C: Storage structure
D: Abstract data type
Question 78

what is the output of the following pseudocode?


integer a[5],j,m;
set m=0;
set a[5]={5,4,3,2,1}
for each I from 0 to 4
A: 10
if i mod EQUAL 0|| I mod 3 EQUAL 0
B: 9
m=m+a[i]
C: 11
end if
D: 15
end for
print m
Question 79

in binary trees nodes with no successor are called?

A: end nodes
B: Terminal nodes
C: Final nodes
D: Last nodes
Question 80

what is the complexity of bellman for single source shortest path


algorithm on a completer graph of n vertices ?

A: (n^3)
B: (n^2)
C: (n^3 log n)
D: (n^2 log n)
Question 81

---- sorting algorithm is frequently used when n is small where n is total


number of elements

A: bubble sort
B: heap sort
C: insertion sort
D: Quick sort
Question 82

What will be the output of the following code?


Integer a,b,x,y
Set a=-1,b=-a
x=(a>0 AND (b<0) OR (a<0) AND (b>0)
y=(a<=0) OR (b>=0) AND (a>=0) OR(b<=0)
If(x IS EQUAL TO Y) A: error
print 1 B: 0
Else C: 1
print 0 D:Non e of the above
Question 83

What will be the output of the following code?


Char str[20]
Integer s
Set str=“ABCDEFGHIJK”
s=string_length(str)
A: 11
str[3]=NULL
B: 3
s=strlen(str)
C: 4
print s
D: 2
Question 84

which of the following data structure does not keep the track of address
of every element in the list?

A: String
B: Linear array
C: Queue
D: stack
Question 85

what will be the output of the following pseudocode?


Integer p,q,r
set q=20
for each p from 2 to 6
q=q+p A: 10
r=q/5 B: None
print c C: 6
D: 8
Question 86

what will be the output of the following pseudocode?


Integer n,t,d,c,r
set t=n
while(t>0)
r=t mod 10 A: 2
if(r EQUALS d) B: 25
c=c+1 C: 1
t=t/10 D: 8
print c
Question 87

what will be the output of the following pseudocode?


Integer a,c
char test =“TESTSTRING”
char ch=‘T’
c=0 A: 6
for each a from 0 to length of text) B: 1
if text[a]==ch C: 20
c=c+1 D: 3
if(c>0)
print c
else print”0”
Question 88
Integer a,b,c
Set a=8,b=10,c=6
if(a>c AND (b+c)>a)
print a A: 0

end if B: 1

if(c>b OR (a+c>b)) C: 2
D: 3
print b
end if
if((b+c) MOD a EQUALS 0)
print c
end if
Question 89
Integer n,t,d,c,r
set n=854323,d=3,c=0
set t=n A: 2
while(t>0) B: 2.5
r=t mod 10 C: 1
if(r EQUALS d) D: 8
c=c+1
end if
t=t/10
end while
print c
Question 90
pick out the correct statement to be filled in if to meet the queue
"is empty" condition.
bool isempty()
{ A: front>0 && front<rear
if(________) B: front<0||front>rear
return true; C: front<0 && front>rear
else D: front>0 || front<rear
return false;
}
Question 91
what will be the output of the following pseudo code
Integer array[]={0,2,4,6,7,5,3}
integer n, result=0
for(n:0 to 7)
A: 14
if n MOD 2 EQUALS 1
B: 13
result+=array[n]
C: 15
end if
D: 17
end for
print result
Question 92
what will be the output of the following pseudo code
Integer array[]={0,2,4,9,16,5,3}
integer n, result=0
for(n:0 to 7) A: 14
if n MOD 2 EQUALS 0 B: 25
result+=array[n] C: 23
end if D: 17
end for
print result
Question 93
what will be the output of the following pseudo code
Integer x,y,z
x=0
y=1 A: 1
x=y=z=0 B: 0
Print x C: error
D: 8
Question 94
what will be the output of the following pseudo code
Integer arr[5][5],I,j
for i:0 to 4
for j: 0 to 4
if I EQUALS 4 or I EQUALS 0
print arr[i][j]
end if A: print first and last row
end for B: print first and last column
End for C: print all boundaries of matrix
D: all elements of matrix
Question 95
what will be the output of the following pseudo code
Integern1,n2,n3,a
n1= a MOD 10; n2= a MOD 2; n3= a/100 Inputs:
If(n1+n2>n3) 1. a =987
print “Inside 1st if” 2. a=314
Else if(n1+n2+n3>n3+3) 3. a=247
print “Inside 2nd if”
Else if((n1_n2)/n3 equals 0)
print “Inside 3rd if”
Else
print “else”
Question 96
what will be the output of the following pseudo code
Integer arr[]={4,5,6,7}
Integer *p=(arr+1)
Print *p
A: 7
B: 6
C: 4
D: 5
Question 97
what will be the output of the following pseudo code for n=1
Void reverse (int n)
if (n greater then 5)
A: None of these
exit
B: it will print 1 infinite times
print n
C: 1 2 3 4 5
return reverse(n+1)
D: 1 2 4 6 8
Question 98
What do we call the binary tree with no successor?

A: Terminal Nodes
B: Last Nodes
C: Final Nodes
D: End Nodes
Question 99
what will be the output of the following pseudo code c=1
Integer fun(int c)
print c
if(c<3) A: 1 3 5 5
c=c+2 B: 1 3 3 3
fun( c) C: 1 3
end if D: None of the above
return c
End fun
Question 100
what will be the output of the following pseudo code
Integer p,q,r
Set p=2,q=7,r=-1
p=p+q+r-9
A: Good Bye
q=p+r-9
B: Take Care
If(p>q)
C: None
print “Good Bye”
D: Good bye Take Care
Else
print “Take Care”
Question 101
what will be the output of the following pseudo code
Integer i,sum
Set i=1,sum=0
sum=sum+i //Line 3
If(sum>500) A: 36
print I B: 45
Else C: 32
i=i+1 D: 28
goto line 3
End if
Question 102
what will be the output of the following pseudo code for n=5
Integer fun(Integer n)
if (n IS EQUALS TO 0)
return 0 A: 25
otherwise if(n is equal to 1) B: 40
return 1 C: 35
otherwise D: 45
return n*n+fun(n-2)
Question 103
If f(a,b) is called, what is returned?
Function g(int n)
{
if (n>0) return 1
else return -1 A: 1 if a>b,-1 if a<b, 0 otherwise

} B: 0 if a equal b, -1 other wise

Function f(int a,int b) C: -1 if a>b, 1 if a<b, 0 otherwise


D: Always +1
{
if (a>b) return g(b-a)
if(a<b) return(-a+b)
return 0
}
Question 104
What will be the output of the following pseudo code?

Integer array[]={10,20,30}
Print - 2[array] A: garbage value
B: -12
C: -30
D: -15
Question 105

What will be the output of the following pseudo code?

Integer array[]={4,5,6,7}
Integer *p={arr+1} A: 12
Print *arr+ 9 B: 13
C: 90
D: 5
Question 106
what will be the output of the following pseudo code
Integer arr[5][5],I,j
for i:0 to 4
for j: 0 to 4
if i EQUALS 4 or i EQUALS 0 or j Equals 0 or j Equals 4
print arr[i][j]
end if
A: print first and last row
end for
B: print first and last column
End for
C: print all boundaries of matrix
D: all elements of matrix
Question 107
what will be the output of the following pseudo code
Integer a=5,b=10,c=15
Print(a+b)
Print(c<<3)

A: 10 20
B: 15 120
C: 15 30
D:some random numbers
Question 108
How many times A is printed
Integer I,j,k
For each i=0 to 4
for each j 0 to 2 A: 12
for each k 0 to j-1 B: 15
print A C: 18
end for D: 5
end for
End for
Question 109

What will be the output of the following code?


Const integer arr[4]={1,2,3,4}
Integer *p
P=arr+3 A: 5
*p=5 B: 4
Print arr[3] C: 9
D: 3
Question 110

What will be the output of the following code?


declare x,y,I
Set x=2,y=4
For i=6 to x+1
A: 10 15 22 23
y=y+I
B: 9 14 18 19
print y
C: 10 15 19 22
i=i-1 D: 12 17 21 22
End for
Question 111
what will be the output of the following pseudo code
Integer arr[5][5],I,j
for i:0 to 4
for j: 0 to 4
if i EQUALS j print arr[i][j]
if i+j equals 4 print arr[i][j]
end if
A: print transpose
end for
B: print left diagonal
End for
C: print right diagonal
D: print both diagonals but
alternatively
Question 112

What will be the output of the following code?


Intger arr[]={4,5,6,7}
Integer *p=(arr+1)
Print arr A: 7
B: address of array
C: 4
D:5
Question 113
If f(a,b) is called, what is returned?
Function g(int n)
{
if (n>0) return 1
else return -1 A: 1 if a>b,-1 if a<b, 0 otherwise

} B: 0 if a equal b, -1 other wise

Function f(int a,int b) C: -1 if a>b, 1 if a<b, 0 otherwise


D: Always +1
{
if (a>b) return g(a-b)
if(a<b) return(b-a)
return 0
}
Question 114

What will be the output of the following code?


Integer arr1[]={1200,200,2300,1230,1543}
Integer arr2[]={12,14,16,18,20}
Integer temp, result=0
A: 6533
For temp 0 to 4
B: 6522
result +=arr1[temp]
C: 12200
For temp 0 to 4 D: 6553
result+=arr2[temp]
Print result
Question 115
What will be the output of the following code?
Integer arr1[]={6,9,12}
Integer x,y
If(a[0] mod 2 equals 0)
A: 16 12
x=a[1]<<1
B: 18 6
y=a[2]>>1
C: 12 6
End if
D: 9 6
Print x,y
Question 116
What will be the output of the following code?
Declare arr[5]
Set arr[]={4,5,7,2,6}
For i=0 to 5 For k=0 to 4
for j = 0 to 4 print arr[k]
declare t
if(arr[j]>arr[j+1])
t=arr[j]
A: 2 4 5 6 7
arr[j]=arr[j+1]
B: 7 6 5 4 2
arr[j+1]=t
C: 5 4 6 2 7
end if D: 5 4 7 6 2
end for
Question 117
What will be the output of the following code?
Integer arrat[]={0,2,4,6,7,5,3}
Integer n,result=0
For(n:0 to 6) A: 25
result+=array[n] B: 27
n=n+1 C: 21
D: 26
Print result
Question 118
Which of the following statements are true for undirected graph

P: Number of odd degree vertices is even


Q: Sum of degree of all vertices is even

A: Both P & Q
B: P only
C: Q only
D: Neither P nor Q
Question 119
Periodic collection of all the free memory spaces from contiguous block
Of the free space by an operating system is called

A: Garbage Collection
B: Concatenation
C: collision
D: Dynamic memory allocation
Question 120
Predict the output of the following pseudocode?

Integer a=2,b=50
a=a+b A: 52 48

b=a-b B: 2 52

Print a C: 52 2
D: 2 50
Print b
Question 121
What does the code do ?

Read n
for each k from 1 to n
r=k mod 10 A: print all the numbers divided by 7 from 1 to n
if r not equals to 0 B: none
print k C: To print all integers from 1 to n omitting those
values which are divided by 7
end if
D: prints all the multiples of 7
end for
stop
Question 122
What will be the output of the following code?
Integer a,b,v,c
Set a=7,b=12,v=70
While(v>5)
a=a-v
c=(a+b)mod 10
while(c>7)
b=b+c
end while A: 14 -2
v=v/2 B: 16 82
End while C: 12 1
D: 12 -1
Print b,c
Question 123

What will be the output of the following code?


Integer a,b,c,d
Set a=8,b=7,c=4,d=6
A: 18
a=b+c-d
B: 3
b=a+d-c
C: 8
d=a+b+d D: 12

Print d
Question 124
When all the data that is to be sorted can be fitted at a time in the main
Memory, it is called

A: Radix sort
B: merge sort
C: External sort
D: Internal sort
Question 125

What will be the output of the following code?


Integer a=2,b=6,c,I
C=(a+b)-3
For each I from 0 to c-1
A: 0
a=a-I
B: 2
c=c+a
C: 3
End for
D: -3
Print c
Question 126
How many leaf nodes are present in a binary tree having a depth H has

A: 2^(H+1)-1
B: 2^H +1
C: 2^H
D: 2^(H-1)-1
Question 127
A binary tree in which all the levels except possibly last, have the
maximum number of nodes and all the nodes at the last level appear as
Left as possible is known as ?

A: Full- Binary tree


B: Threaded Binary tree
C: AVL tree
D: Complete Binary tree
Question 128
what will be the output of the following pseudocode?
1. integer a, b, count, count1
2. set a=1, b=1
3. while(a<=5)
4. b=1
5. while(b<=5)
6. b=b+1;
7. count1=count1+1
8. end while A: 5 5
9. q=a+1 B: 20 4
10. count=count+1
C: 25 5
11. end while
D: 5 25
12.print count, count1
Question 129
what will be the output of the following pseudocode?
1. input n=1234
2. integer q, r and rn
3. set q=n and m=0
4. while(q>0)
5. r = q mod 10
6. rn=rn+r^3
7. q=q/10
8. end while loop
9. print rn

Ops: A. 10 B. 36 C. 100. D. None of the mentioned options D. 321


Question 130
what will be the output of the following pseudocode?
1. int c=0, d=0
2. while (d<6)
3. d=d+2
4. c=c+1
5. end while loop
6. print c

Ops: A. 3 B. 4 C. 5 D.6
Question 131
what will be the output of the following pseudocode?
1. input =5
2. algorithm
3. set integer i=2
4. while i<=num/2
5. if num mod i =0
6. print “unsuccessful” and exit;
7. i=i+1
8. if(i==(num/2)+1)
9. print”successful”
Ops: A. unsuccessful B. it will not print anything C. successful D.
undefined behaviour of the algorithm
Question 132
what will be the output of the following pseudocode?
1. intput f=6, g=9 and set sum= 0
2. integer n
3. if(g>f)
4. for (n=f;n<g;n=n+1)
5. sum=sum+n
6. end for loop
7. else
8. print error message
9. print sum

Ops: A. 9 B. 21 C.6 D.15


Question 133

what will be the output of the following pseudocode?


Character str[5]= ‘ABC’
Print str[2]
Print str

A. AC B. null ABC
C. ABCD D. AB
Question 134
what will be the output of the following pseudocode?
1. interger a=5, b=10, c=15
2. integer x=a+b
3. integer y=x<<1
4. integer z=y+c
5. print(z)

A. 10
B. garbage value
C. 45
D. 18
Question 135
Consider the given pseudocode and determine the output of the code?
1. declare an integer variable n,value, x1,x2
2. set value to 0
3. set x1 to 0 and x2 to 1
4. set value to 0
5. set x1 to 0 and x2 to 1
6. set n to 5
7. repeat n times
8. print value
9. value=x1+x2
10.x2=x1
11.x1=value
12.end loop
Ops A. 1 2 3 5 8 B. 0 1 2 3 4 5 C. 10 D. 0 1 1 2 3
Question 136
what will be the output of the following code? For a= 12 and b=-26?
1. start
2. take 2 variables a and b
3. check if a is less than 0 set a= -a
4. check if b is less than 0 set b= -b
5. repeat while a is not equal to b
6. if a>b set a=a-b
7. else set b=b-a
8. print a
9. stop

Ops: A. 2 B. 12 C. 4 D. 8
Question 137
what will be the output of the following pseudocode?
1. Character *ptr
2. Character Str[]=”abcdefg”
3. ptr=str
4. ptr+=5
5. print ptr

Ops: A. fg B. abcd C. defg D. cdef


Question 138
what will be the output of the following pseudocode?
interger arr[5][5],i,j
for i= 0 to 4
for j= 0 to 4
if i EQUALS 4 or i EQUALS 0 or j EQUALS 4 or j EQUALS 4
print arr[i][j]
end if
end for
end for

A. print boundary of matrix B. all elements of matrix


C. print first and last column D. print first and last row
Question 139
what is the output of following program x=30?

void fun(integer x)
integer y= 20
print(y)
return 0

A.17 B. 20 C. 30 D. 15
Question 140
what will be the output of following ?
1. Integer a[4]={3,2,6,9}
2. sum=0
3. for(i=0 to 4)
4. sum=sum+a[i]
5. i=i+1
6. end for
7. if(sum mod 2 equals 1)
8. print sum-1
9. otherwise
10.print sum
Ops: A. 11 B.19 C.21 D. 20
Question 141

what will be the output of the following pseudocode?


int a=9, b=7, c=,d=4, e
e=a+b+c+d/4
if(e>5)
print’PASS’
else
print”FAIL”

Ops: A. PASS B.FAIL C. 1 D.0


Question 142

for the following pseudocode a =10


1. integer fun(integer a)
2. if(a equals 0)
3. return 0
4. otherwise if(a equals 1)
5. return 1
6. otherwise
7. return (a*(a-1)+fun(a-3))
8. end function fun()

Ops: A. none B. 121 C. 145 D. 140


Question 143
what will be the output of the following pseudo code
int a=10,b=4,i
if(a>b) A: 4
if(a+b>14) B: 13
print a C: 16
else D: 17
for(i=1 to 3)
a=a+i
print a
else
print b
Question 144
Integer a=6,b=9
interger n
set res=1
if(a>10 && b<a)
print error message A: 336
else B: 333
for(n=a;n<b;n=n+1) C: error message
res=res*n D: None of the above
end for
print res
Question 145
Suppose a stack implementation supports an insertion REVERSE, which
reverses the order of elements on the stack, in addition to that PUSH
and POP instructions which of the following statements is TRUE with
respect to this modified stack?

A: a queue can be implemented where ENQUEUE takes a sequence of


three instructions and DEQUEUE takes a single instruction
B: a queue can be implemented where both ENQUEUE and DEQUEUE
take a single instruction each
C: A queue cannot be implemented using the stack
D: A queue can be implemented where ENQUEUE takes a single
instruction and DEQUEUE takes a sequence of two instructions
Question 146
A machine took 200 sec to sort 200 names , using sort, in 800 sec it can
approximately sort?

A: 800 names
B: 750 names
C: 400 names
D: 850 names
Question 147
For which the following purposes, the given pseudocode can be used?
Read n
For k=1 to n
r=k mod 7
if r not equal to 0
print k
end
A: to print all integers from 1 to n deleting those integers which are
divisible by 7
B: to print the maximum number from 1 to n which is not divisible by 7
C: To print all the integer from 1 to n those are divisible by 7
D: None of the mentioned
Question 148
What will be the output of the following pseudocode?
Decalre x,y,i
Set x=2, y=4
For i=6 to x+1 A: 9 14 18 19
y=y+I B: 10 15 22 23
print y C: 12 17 21 22
i=i-1 D: 10 15 19 22
End for
Question 149
How many times “A” will be printed is the following pseudocode?
Integer a,b,c
For a=0 to 4
for b=0 to 2 A: 8
if a is greater then b B: 9
print A C: 7
end if D:10
end for
End for
Question 150
What will be the output of the following pseudocode for a=10, b=6
Integer func(Integer a, Integer b)
{
Integer temp
A: 4
while(b)
B: 3
temp=a MOD b
C: 1
a=b
D: 2
b=temp
end while
return a
}
Question 151
Which of the following formula will correctly calculate the memory
address of the third element of an array?
(w is the number of words per memory cell for the array)

A: LOC( Array[3])=Base(Array[3]+(3- lower bound)


B: LOC(Array[3])=Base(Array[4]+(3-upper bound)
C: LOC(Array[3]=Base(Array)+w(3-lower bound)
D: information is not adequate to solve the given
problem
Question 152
What will be the output of the following pseudocode?
Integer n, j, k,c,t,b, array[5]
Set n=7,c=1
Set array[5]={1,6,7,11,13}
B=arra[0]
For (each k from 1 to n-3)
b=b^array[k]
For (each k from 2 to n-1)
A: None
c=c^b
B: 4
c=c^k
C: 17
Print c
D: 5
Question 153
What will be the output of the following pseudocode?
Integer a,b,c
Set a=10,b=3
c=a/b A: 10 1 3
b=a mod c B: 0 0 0
print a,b,c C: 10 0 3
D: 10 3 3
Question 154
What is the maximum degree of any vertex in a simple graph with n
vertices?

A: n+1
B: n
C: 2n-1
D: n-1
Question 155
identify the point that is NOT true with respect to a Stack

A: it is not possible to insert or remove elements anywhere else except


the top of the stack
B: Stack is a dynamic set where elements are removed in the reverse
order of their insertions
C: stack supports LIFO (Last in First Out) order of deletion of elements
D: All the mentioned options are correct
Question 156
which of the following is a direct search technique?

A: Tree search
B: Binary Search
C: Hashing
D: Linear search
Question 157
suppose queue is implemented using a linked list and its front node and
rear nodes are tracked by reference variables will change during an
insertion into a NONEMPTY queue?

A: None of them will change


B: only the front will change
C: only the rear will change
D: both will change
Question 158
what will be the probability of selecting random node from a single
linked list?

A: N/2(N-1)
B: 2N-1
C: 1/N
D: 2(N-1)/N
Question 159
maximum height of an AVL tree with 7 nodes is:

A: 3
B: 4
C: 5
D: 6
Question 160
information about which of the following options is not present in the
adjacency matrix representation of graph?

A: Edges
B: Nodes
C: Direction of edges
D: Parallel edges
Question 161
consider following functions and their complexities:

f1(n)=2^n
f2(n)=n^(3/2)
f3(n)=nlogn A: F3 < F2 < F4 <F1
f4(n)=n^logn B: F2 < F3 < F1 < F4
C: F3 < F2 < F1 < F4
D: None of the mentioned options
Question 162
consider a complete graph vertex set {01,2,3,4}. Entry Wij in the matrix
W below is the weight of the edge {I,j}.
what is the minimum possible weight of a spanning tree T in this graph
such that vertex 0 is a leaf node in the tree T??

A. 10
W
B. 8
C. 7
D. 9
Question 163
let G= (V,E) be a directed graph with n vertices. A path from “vi” to “vj”
in G

A: F3 < F2 < F4 <F1


B: F2 < F3 < F1 < F4
C: F3 < F2 < F1 < F4
D: None of the mentioned options
Question 163
Question 164
how much time will be required to generate all the connected
components in tan undirected graph G with ‘n’ vertices and ‘e’ edges
when the graph is represented by an adjacency list

A. O(e^2)
B. O(n)
C. O(e+n)
D. O(e)
Question 165
in which of the following situations Queue implementations is useful?

A. load Balancing
B. When a resource is shared among multiple consumers
C. when data is transferred asynchronously between two processes
D. All the mentioned
Question 166
which of the following applications may use a stack?

A. syntax analyzer for a compiler


B. keeping track of local variables at run time
C. a parenthesis balancing program
D. All the above
Question 167
consider a Binary tree having two pointer for each of its children. These
pointers are set to NULL if the corresponding child is empty. How many
NULL pointers does a Binary Tree with N nodes have?

A. The number depends on the shape of the tree


B. N
C. N+1
D. N-1
Question 168
find out the number of interchanges needed to convert the given array
into a max heap.
89,19,50,17,12,15,2,5,7,11,6,9,100

A. 5
B. 4
C. 2
D. 3
Question 169
The order of an internal node in a B+ tree index is the maximum number
of children it can have. suppose that a child pointer takes 6 bytes. the
search field value takes 14 bytes, and the block size is 512 bytes. what is
the order of the internal node

A. 24
B. 26
C. 25
D. 27
Question 170
which of the following data structure may give overflow error, even
though the current number of elements in it is less than its size?

A. priority queue
B. circular queue
C. simple queue
D. none
Question 171
let the following circular queue can accommodate maximum six
elements with the following data
front =2 rear=4
queue =__________; L,M,N,_,_
what will happen after ADD O operation takes place?
A. None of the mentions options below
B. front =3 rear=4
queue=_______; L,M,N,O,___
C. front =3 rear=5
queue=L,M,N,O,___
D. front=2 rear=5
queue=_______: L, M,N,O,_____
Question 172
consider the list of 12 numbers:

44,33,11,55,77,90,40,60,99,22,88,66
if we try to sort the list using quick sort by taking 44 as pivot element,
then which of the following list will be obtained after the fourth
iteration?

A. 22,33,11,77,44,40,90,60,99,55,88,66
B. 22,33,11,55,77,90,40,60,99,44,88,66
C. 22,33,11,40,44,90,77,60,99,55,88,66
D. 22,33,55,11,77,90,40,60,99,44,88,66
Question 173
what is the prefix from of an infix expression p+q-r*t?

A. +pq-*rt
B. -+pq*rt
C. -+pqr*t
D. None of the above
Question 174
what will be the complexity, when two matrices of order p*q and q*r are
multiplied?

A. pq
B. pqr
C. pq^2r
D. pr
Question 175
which of the following is a type of sorting which relatively passes
through a list to exchange the first element with any element less than it
and then repeats with a new first element

A. bubble sort
B. heap sort
C. quick sort
D. selection sort
Question 176
consider an unsorted array A[1…n] with n distinct values, the following
algorithm can be used to search a given number x in that array

1.choose a k uniformly at random from 1…n


2.if A[k]=x then stop else goto 1:

Assume that x is the present in the array A, what will be the expected
number of comparisons required by the algorithm before it terminates?
A. n-1
B. n
C. n/2
D. 2n
Question 177
how much time will be required to generate all the connected
components in tan undirected graph G with ‘n’ vertices and ‘e’ edges
when the graph is represented by an adjacency list

A. O(e^2)
B. O(n)
C. O(e+n)
D. O(e)
Question 178
Four matrices A1, A2,A3 and A4 of dimensions a x b, b x c, c x d and d x
e respectively can be multiplied in several ways with the different
number of total scalar multiplications
If a =10, b=100, c=20, d=5, and e=80, then at least how many scalar
multiplications are required here?

A. 80000
B. 14000
C. 44000
D. None of the mentioned options
Question 179
The number of values that can be held by an array arr(-1……n,1,n) is :

A. n
B. n(n+2)
C. n(n+1)
D. n^2
Question 180
if a binary tree has 10 nodes, then what is the height of the tree?

A. 3
B. 11
C. 9
D. 12
Question 181

The height of a tree is defined as the number of edges on the longest path in
the tree. The function shown in the pseudo-code below is invoked as height
(root) to compute the height of a binary tree rooted at the tree pointer root.

int height(treeptr n)
{ if(n == NULL) return -1;
if(n -> left == NULL)
if(n -> right == NULL) return 0;
else return B1; // Box 1
Question 182

else{h1 = height(n -> left);


if(n -> right == NULL) return (1+h1);
else{h2 = height(n -> right);
return B2; // Box 2
}
}
} A. B1: height(n->right), B2: max(h1,h2)
B. B1: height(n->right), B2: (1+max(h1,h2))
C. (1+height(n->right), B2:max(h1,h2)
D. B1: (1 + height(n->right), B2: (1+max(h1,h2)
Question 183
if a node having two children is deleted from a binary tree, its is
replaced by its:

A. inorder successor
B. inorder predecessor
C. preorder predecessor
D. none of the mentioned options
Question 184
consider the following graph:
which of the following sequence are Depth first traversals of the above
graph?
1. a b e g h f
2. a b f e h g
3. a b f h g e
4. a f g h b e
A. only 1 3 and 4
B. only 2 3 and 4
C. only 1 and 4
D. only 1 2 and 4
Question 185
consider the following operation along with enqueue and dequeue
operations on queries, where k is global parameter
multidequeue(Q)
{ what is worst case complexity of a
n=k sequence of m multidequeue()
operations on an initially empty
while(Q is not empty) and (n>0)
queue ?
{
A. (m)
Dequeue(Q)
B. (m^2)
n=n-1
C. (mk)
}
D. (m+k)
}
Question 186
maximum possible number of nodes in the Binary Tree at level 5 is:

A. 16
B. 31
C. 30
D. 28
Question 187
if L is the left node, M is the root node and R is the right node of node of
a binary tree, then an L-M-R traversal can be termed as:

A. Pre-order traversal
B. In-ordered traversal
C. Post-Order traversal
D. None of the mentioned
Question 188
suppose a binary search tree is generated by inserting in order of the
following integers.
50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24
what would be the number of nodes in the left subtree and right subtree
of the root respectively

A. 8, 3
B. 7, 4
C. 4, 7
D. 3, 8
Question 189
the complexity of the selection sort algorithm in worst case is:

A. O(n^2)
B. O(n-1)
C. O(n)
D. O(n log n)
Question 190
which of the following is a direct search technique?

A. hashing
B. tree search
C. binary search
D. linear search
Question 191
consider a Binary tree having two pointers for each of its children.
These pointers are ser to NULL. if the corresponding child is empty. how
many NULL pointers does a binary tree with N nodes have?

A. The number depends on the shape of the


tree
B. N+1
C. N-1
D. N
Question 192
A complete graph can have __________ spanning trees.

A. n^(n-2)
B. n^(n+1)
C. n^2
D. n^n
Question 193
when we update an imperative data structure we typically accept that:

A. the old version of the data structure will be available


B. both old and new version of data structure will be available
C. none of the mentioned options
D. the old version of the data structure will no longer be available
Question 194
which of the following data structure uses hierarchical data model?

A. Array
B. Queue
C. Tree
D. Stack
Question 195
the working principle of the queue is
1. First-In-First-Out(FIFO)
2. Last-In-Last-Out(LIFO)
choose the correct answer from the options given below

A. only 2
B. Neither 1 nor 2
C. Both 1 and 2 depending on the situation
D. only 1
Question 196
To which of the following domain problems does the knapsack problem
belong?

A. Linear solution
B. NP complete
C. Sorting
D. Optimization
Question 197
An acyclic digraph, which has only one node with indegree 1 is called:

A. Disjoint tree
B. Direction oriented tree
C. undirected tree
D. direct tree
Question 198
what would be the minimum number of arithmetic operations required to
evaluate the polynomial p(x)=x^5 +4x^3+6x+5 for given value of x using
only one temporary variable?

A. None of the mentioned


B. 6
C. 7
D. 8
Question 199
what will be the result of the following code snippet for the
input=1,2,3,4,5?
void test2(struct node* head)
{ A. 1,3,5,4,2
if(head==NULL) return ; B. 1,3,5,5,3,1
printf(“%d “,head->data); C. 5,4,3,2,1
D. 2,4,4,2,1
if(head->next!=NULL)
Test2(head->next->next);
printf(“%d”, head->data);
}
Question 200
what will be the output of the following pseudocode? A. 3
Intger a=0, b=1, i, c, n=3,j 23
for (each I from 1 to n) 123
a=0,b=1 B.3
print b 32
for (each j from 1 to i-1) 321
c=a+b C. 1
print c 11
a=b,b=c 112
end for D.1
next line 12
end for 123
Question 201
what will be the output of the following for pseudocode for a =10?
Integer fun(Integer a)
if(a EQUALS 0)
return 0
otherwise if(a EQUALS 1)
return 1
otherwise A. 121
return (a*(A-1)+fun(a-3)) B. 140
end fun() C. 145
D. None
Question 202
what will be the output of the following pseudocode for n=1?
void reverse(int n)
if(n greater than 5)
exit
print n
return reverse(n++) A. it will print 1 infinite times

end reverse() B. 1 2 3 4 5
C. 1 2 4 6 8
D. None
Question 203
what will be the output of the following pseudocode?
1. Intger I, sum
2. set i=1, sum=0
3. sum=sum+I
4. if(sum>500) A. 32
5. print I B. 28
6. else C. 45
7. i=i+1 D. 36
8. goto line 3
9. end
Question 204
what will be the output of the following pseudocode?
Integer n,d,a,b
set n=456,a=0,b=1 A. 15
while(n>0) 120
d=n mod 10 B. 654
a=a+d 120
b=b*d C. 12
n=n/10 24
end while D. None
print a
print b
Question 205
what will be the output of the following ?
Integer x,y,z
x=0
y=1
x=y=z=8 A. 1
print x B. 0
C. 8
D. None
Question 206
what will be the output of the following ?
Integer x,y,z,a
set y=2
A. 7
set x=(y=y*2)+(z=a=y)
B. 8
print x
C. 5
D. 9
Question 207
what will be the output of the following ?
1. Integer c,n
2. set n=6
3. set c=n
4. print c A. 2 4 6
5. c=c-2 B. 6 4 2 0
6. if(c>0) C. 6 4 2
7. goto line 4 D. 0 2 4 6
8. end if
Question 208
what will be the output of the following ?
Integer x,y,
for each x from 1 to 11
x=x+2
end for A. 12
print x B. 10
C. 11
D. 13
Question 209
what will be the output of the following ?
Integer n,j,k,c,t,b,array[5]
set n=7, c=1
set arra[5]={1,6,7,11,13}
b=array[0] A. 5
for each k from 1ro n-3 B. 4
b=b^array[k] //(^ bitwise XOR) C. 17
for each k from 2 to n-1 D. None
c=c^b
c=c^k
print c
Question 210
what will be the output of the following ?
Integeri,j,k,sum=0
for(i=0;i<5;i++)
for(j=0;j<3;j++)
sum=i+j A. 9
for(k=0;k<2;k++) B. 17
sum=sum+k C. 13
end for D. 7
end for
end for
print sum
Question 211
what will be the output of the following ?
Integera[], k, l ,m
set a[10]={24, 16, 22, 32, 18}
set l=0
A. 34
for(k from 1 to 6) and increment k by 2
B. 20
l=l+a[k+1]
C. 62
end for
D. 18
m=l/2
print m
Question 212
what will be the output of the following ?
integer p,q,r
set q=20 A. 6
for each p from 2 to 6 B. 8
q=q+p C. 10
end for D. 40
r=q/5
print q
Question 213
what will be the output of the following for a=1?
Integer fun(Integer a)
if(a<3)
a=a+2 A. 1
fun(fun(a)) B. 3
end if C. 5
return a D. 0
end fun()
Question 214
what will be the output of the following ?
Integer n,beg,end
set beg=5 end =7,sum=0
if(beg>end)
print sum+1 A. 7
else B. 9
for(n=end;n>=beg;n=n-1) C. 6
sum=sum+1 D. 3
n=n-1
print n
Question 215
data structure representation in memory is termed as:

A. file structure
B. recursive data type
C. storage structure
D. abstract data type
Question 216
what do we call the binary tree nodes with no successor?

A. End nodes
B. Last nodes
C. Terminal nodes
D. Final Nodes
Question 217
what is the time complexity of Bellman –Ford single source shortest
path algorithm

A. (n^2)
B. (n^3 log n)
C. (n^3)
D. (n^2 log n)
Question 218
what will be the output of the following pseudocode for n=99?

Integer fun(Integer n)
if(n>100)
return n-10 A. 91
return fun(fun(n+11)) B. 99
end fun() C. 110
D. 121
Question 219
what will be the output of the following pseudocode?
Integer value, n
set value =1, n=45
while(value less than equal to n)
value =value<<1 A. 32
end loop B. 60
print value C. 45
D. 64
Question 220
what will be the output of the following pseudocode if n=3 and elements
of the array are 12 24 64 72 88?
Integer fun(integer a[], integer n)
integer x
if(n IS EQUAL TO 1)
return a[3]
else
A. 24
x=fun(a,n-2)
B. 100
end if
C. 60
if(x<a[n]) return x
D. 88
else return a[n+1
Question 221
what will be the output of the following pseudocode?
Integer a,b,c
set a=10, b=3
c=a/b
b=a MOD c
print a b c

A. 10 1 3
B. 10 3 3
C. 0 0 0
D. 10 0 3
Question 222
which of the following operations is possible on array?

A. Insertion
B. Sorting
C. Searching
D. All of the mentioned
Question 223
for which of the following tasks, sorting is useful?
1.Report Generation
2.Minimizing the storage needed
3.Making searching easier and efficient

A. only 1
B. only 2 3
C. only 3
D. only 1 3
Question 224
which of the following is the simplest way of implementing a graph in C
or C++

A. Both adjacency matrix and associative lists


B. None of the mentioned
C. Associative lists
D. Adjacency matrix
Question 225
The running time of an algorithm is given by:
T(m)=T(m-1)+T(m-2)-T(m-3), if m>3 otherwise T(m)=m;
then what will be the time complexity of the given algorithm?

A. m^m
B. m^3
C. log m
D. m
Question 226
If the only use of lazy lists in a given application is monolithic, then that
application:

A. Should use complex unsuspended lists


B. should use streams
C. should use simple suspended lists rather than streams
D. None of the above
Question 227
what will be the output of the following pseudocode?
Integer x,y,l,z
set x=1, y=0
set z=y=1, l=x AND y
A. Logical error
print l
B. 0
C. 1
D. None of the above
Question 228
what will be the output of the following code?
Integer a[], k, t, m
set a[]={25,20,30,18,17} A. true true true true false
set t=0 22
for (each k from 0 to 4) B. true false true true false
t=t+a[k] 20
if(t mod 2 EQUALS 1) C. true false true true false
print True 15
otherwise D. false true true true false
print False 20
m=t/5; print m
Question 229
what will be the output of the following pseudocode?
Integer rows=4, k, l, number=1
for (k=1 to rows)
for(l=1 to k)
print number
print space
number=number+1
l=l+1
end for
next line
k=k+1
end for
Question 229
A. 1 2 3 4 5 B. 1
1234 23
123 456
1 7 8 9 10

C. 1
C. 1 2 3 2
1 1 34543
1 2 1 4 5 6 7 6 5 4
1 3 3 1
Question 230
what will be the output of the following pseudocode?
Integer n, f0, f1, f, I
Set n=5, f0=0, f1=3
for(each I from 1 to n)
A. 1 4 2 5 3
f=f0+1
B. 1 4 2 5 7
print f
C. 1 4 3 2 5
f0=f1
D. 1 4 3 7 3
f1=f
Question 231
what will be the output of the following pseudocode?
Integer x
set x=2
if(x IS EQUAL TO 1)
A. B
if(x IS EQUAL TO 0)
B. A
print “A”
C. C
else
D. B C
print “B”
else
print “C”
Question 232
what will be the output of the following pseudocode?
Integer a[5], b[5], c[5], k, l
set a[5]={5, 9, 7, 3, 1}
A. 7 13 13 11 11
set b[5]={2, 4, 6, 8, 10}
B. -3 -5 -1 5 9
for(each k from 0 to 4)
C. 3 5 1 -5 -9
c[k]=a[k]-b[k]
D. None of the mentioned options
for (each l from 0 to 4)
print c[l]
Question 233
what will be the output of the following pseudocode?
Integer x
set x=259
if(x EQUALS 0) A. 16

print “0” B. 7

otherwise if(x MOD 9 EQUALS 0) C. 8

print ”9” D. None of the mentioned

otherwise
print x MOD 9
Question 234
what will be the output of the following pseudocode?
1. Integer c, n
2. set n=6
A. 2 4 6
3. set c=n
B. 0 2 4 6
4. print c
C. 6 4 2 0
5. c=c-2
D. 6 4 2
6. if(c>0)
7. goto line 4
8. end if
Question 235
what will be the output of the following pseudocode?
Integer x, y, z, a
set x=2, y=1, z=5
a=(x AND y) OR (increment z by 1)
print a
A. 3
B. 1
C. 5
D. 2
Question 236
what will be the output of the following pseudocode for x=4 and y=5?
Integer fun(int x, inty)
if(x>1)
fun(x-2,y+2)
A. 4 5 6
end if
B. 7 6 5
print y
C. 9 7 5
end fun()
D. None
THANK YOU

You might also like