Integer n
for (n = 6; n <> 0; n–)
Print n
n = n-1
end for
a) 6 4 2
b) 6 5 4 3 2 1
c) 6
d) Infinite Loop
A
READ INTEGER input a = 10 & b = 7.
Function(input a, input b)
If(a < b)
return function(b, a)
elseif(b != 0)
return (a + function(a,b-1))
else
return 0
A.17
B.107
C.70
D.701
C
What will be the value of even_counter if number = 2630?
Read number
Function divisible(number)
even_counter = 0, num_remainder = number;
while (num_remainder)
digit = num_remainder % 10;
if digit != 0 AND number % digit == 0
even_counter= even_counter+1
End If
num_remainder= num_remainder / 10;
End While
return even_counter;
A) 3
B) 4
C) 2
D) 1
A
What will be the value of t if first=0 ,second= 999?
READ first & second
Function Hello(first,second)
hey = 0
while (second!= 0)
temporary = temporary + first
second=second-1
End While
return temporary;
End Function
A.999
B.Infinite Loop
C.0
D.333
C
Input m=6,n=9
n=n+1
m=m-1
n=n-m
if (m>n)
print m
else
print n
A.6
B.5
C.55
D.9
B
Input fib=20,gn=24 and set sum=0
Integer num
if(gn>fib)
for(num=fib ;num<=gn;num=num+1)
sum=sum+num
End for loop
else
print error message
print sum
A.110
B.21
C.011
D.error message
A
FUNCTION s(input x,input y)
Input x=5 & y=3
Input m=0
m=x
x=y
y=m
m=x
x=y+2
y=m+2
m=x
x=y
y=m
print(x,y)
A. 3 5
B. 5 3
C. 5 7
D. 7 5
C
Function fun(input x,input y)
initialize m=0
m+=b
if((m%a==0 && m%b==0)
return m
else
return fun(x,y)
Endif
EndFunction
Function main(input a,input b)
Input a=8,b=9
If(a>b)
ans=fun(b,a)
Else
ans=fun(a,b)
Endif
Write ans
EnfFunction
A.17
B.72
C.81
D.63
B
What is the output of the given pseudocode for a=100?
START
Function cont(int a)
if(a==0)
return 0;
else
return (a%10+2*cont(a/10));
Endif
EndFunction
End
A.2
B.4
C.6
D.1
B
FUNCTION ch(input num){
INITIALIZE r_num=0, r
if(num!=0)
r=num%10
r_num=r_num*10+r
ch(num/10)
ENDIF
return r_num
ENDFUNCTION
FUNCTION main()
int num, r_num;
READ num equals to 142
r_num = ch(num);
if(num==r_num)
WRITE ”YES”;
else
WRITE “NO”;
A.NO
B.YES
C.141
D.241
A