![](https://sp-ao.shortpixel.ai/client/to_webp,q_glossy,ret_img,w_2048,h_414/https://codewindow.in/wp-content/uploads/2022/06/Copy-of-CS1-9-2048x414.png)
READ integer i to 1
switch(i)
case i:
WRITE “case 1 executed”;break
case i + 1;
WRITE“case 2 executed”;break
case i + 2;
WRITE“case 3 executed”;break
default:
WRITE“default block executed”;break
Question 1
Answer
Question 1
A. case 1 executed
B. case 2 executed
C. case 3 executed
C. default block executed
E. Error : i is not usable
Answer
E. Error : i is not usable
switch(3/3)
case 1:
WRITE“case 1 executed “
case 2:
WRITE“case 2 executed “
break;
case 3:
WRITE”case 3 executed “
break;
default:
WRITE“Default block executed”
Question 2
Answer
Question 2
A. Default block executed
B. case 1 executed
C. case 1 executed case 2 executed
D. Error:switch statements cannot hold
Answer
C. case 1 executed case 2 executed
READ i equals to 25if i
is equals to 25
i = 50
if i is equals to 25
add 1 to i
if i is equals to 25
add 1 to i
else
add 2 to i
else
add 1 to i
else
add 2 to i
WRITE i
Question 3
Answer
Question 3
A. 26
B. 27
C. 52
D. 55
Answer
C. 52
INITIALIZE false -1
INITIALIZE NULL 0
INITIALIZE true 1
if(NULL)
WRITE “NULL”
ELSEIF(false)
WRITE “TRUE”
ENDIF
ELSE
WRITE “FALSE”
ENDIF
Question 4
Answer
Question 4
A. TRUE
B. FALSE
C. NULL
D. Error
Answer
A. TRUE
What will be the value of sum if num=187?
Read num
iter=0,sum=0
Function Star(int num)
while(num>0)
rem=num%l0
po=8^iter
sum=sum+po*rem
iter++
num=num/10
End While
Return sum;
End Function
Question 5
Answer
Question 5
A. 187
B. 87
C. 135
D. 71
Answer
C. 135
Also Checkout: TCS NQT Sample Question Paper
Integer n
for (n = 6; n <> 0; n--)
Print n
n = n-1
end for
Question 6
Answer
Question 6
a) 6 4 2
b) 6 5 4 3 2 1
c) 6
d) Infinite Loop
Answer
a) 6 4 2
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
Question 7
Answer
Question 7
A. 17
B. 107
C. 70
D. 701
Answer
C. 70
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;
Question 8
Answer
Question 8
What will be the value of even_counter if number = 2630?
A) 3
B) 4
C) 2
D) 1
Answer
A) 3
![](https://sp-ao.shortpixel.ai/client/to_webp,q_glossy,ret_img,w_2048,h_442/https://codewindow.in/wp-content/uploads/2022/06/Copy-of-CS1-10-2048x442.png)
READ first & second
Function Hello(first,second)
hey = 0
while (second!= 0) temporary
= temporary + first
second=second-1
End While
return temporary;
End Function
Question 9
Answer
Question 9
What will be the value of t if first=0 ,second= 999?
A. 999
B. Infinite Loop
C. 0
D. 333
Answer
C. 0
Input m=6,n=9
n=n+1
m=m-1
n=n-m if
(m>n)
print m
else print n
Question 10
Answer
Question 10
A. 6
B. 5
C. 55
D. 9
Answer
B. 5
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
Question 11
Answer
Question 11
A. 110
B. 21
C. 011
D. error message
Answer
A. 110
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)
Question 12
Answer
Question 12
A. 3 5
B. 5 3
C. 5 7
D. 7 5
Answer
C. 5 7
![](https://sp-ao.shortpixel.ai/client/to_webp,q_glossy,ret_img,w_2048,h_425/https://codewindow.in/wp-content/uploads/2022/06/Copy-of-CS1-11-2048x425.png)
Function fun(input x,input
y)initialize m=0
m+=b
if((m%a==0 &&
m%b==0)return m
else
Endi
f
return fun(x,y)
EndFunction
Function main(input a,input
b)Input a=8,b=9
If(a>b)
Else
Endi
f
ans=fun(b,a)
ans=fun(a,b)
Write ans
EnfFunction
Question 13
Answer
Question 13
A. 17
B. 72
C. 81
D. 63
Answer
B. 72
START
Function cont(int a)
if(a==0)
return 0;
else
return (a%10+2*cont(a/10));
Endif
EndFunction
End
Question 14
Answer
Question 14
What is the output of the given pseudocode for a=100?
A. 2
B. 4
C. 6
D. 1
Answer
C) 0.1
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”;
Question 15
Answer
Question 15
A. NO
B. YES
C. 141
D. 241
Answer
A. NO
Also Checkout