solve(arr,f,s,num)
if s>=l
temp=f+(s-l)/2
if arr[temp]==num
return temp
elif arr[temp]>num
return solve(arr,f,temp-1,num)
else
return solve(arr,temp+1,s,num)
endif
else
return "Not Applicable"
endif
if arr=[3,4,2,1,4,5]
,num=6
,f=0
and s=6
:
a)6
b)2
c)Index Error
d)Not applicable
(d) is the correct option.
3.What will be the output of the following pseudocode?
Integer A
Assign A=2
if(A IS EQUAL TO 1)
if(A IS EQUAL TO 0)
Print(A)
else
print(B)
end if
else
print(C)
end if
a)B C
b)C
c)B
d)A
(b) is the correct option.
4.What will be the output of the following pseudocode?
Integer p=19,q=20,r=6
Integer c=q&p|p&r
c=c+r
r=q+c
Print p,q,r,c
a)19 20 0 0
b)19 20 19 20
c)19 20 44 24
d)19 20 33 56
(c) is the correct option.
5.What will be the output of the following pseudocode?
Integer a[]={19,3,14,63,23,53}
Integer i=0
for i=0 to 5
a[i]=(*a+i)+*(a+i)
if i%2==0
a[i]=(*a+i)-*(a+i);
print(a[i])
end if
end for
a)0 0 0 0 0 0
b)4 -4 4 -4 4 -4
c)0 4 -14 66 -23 58
d)12 4 -34 -35 34 67
(c) is the correct option.