![](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)
Input array elements 1,2,3,4,5,6,7,8
Initialize n as number of elements
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”;
Initialize sum equals 0
i=n-1
Function
SUM(array,i,sum) If(i<0)
Write sum
if((ar[i]%2==1)
sum+=(ar[i])
SUM(array,i-1,sum)
ENDIF
ENDFUNCTION
Question 1
Answer
Question 1
A. 36
B. 20
C. 16
D. 10
Answer
C. 16
32.input a=8,b=16
int fun(int a,int b)
{
int n=0
if(b<1)
return n
else
return fun(a+b+2,b-2)
}
Question 2
Answer
Question 2
A. 33
B. 88
C. 0
D. 128
Answer
C. 0
Integer a,b,c,d
Set a=14,b=15,c=16
If(a>6)
b=c-a
if(a>c)
d=b+c
else
d=b-c
else
d=a+b+c-3
print d
![](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)
Question 3
Answer
Question 3
A. 29
B. -14
C. 31
D. 18
Answer
B. -14
Function Sum(int num) (<> not equals to)
If(num<>0)
Return num+num*sum(num-1)
Else
Return num
END if
END function
Question 4
Answer
Question 4
A. 325
B. 188
C. 64
D. 320
Answer
A. 325
Integer n,beg,end
Set beg=5,end=7,sum=0
If(beg>end)
Print sum+1
Else
For(n=end;n>=beg;n=n-1)
Sum=sum+n
N=n-1
End for loop
Print n
Question 5
Answer
Question 5
A. 6
B. 4
C. 9
D. 3
Answer
D. 3
Also Checkout: TCS NQT Sample Question Paper
struct{
short s[5]
union{
float y;
long z;
}u;
}t;
Question 6
Answer
Question 6
Assume that objects of the type short,float and long occupy 2 bytes,4 bytes and 8 bytes respectively.The memory required for variable t,ignoring alignments considerations,is:
A. 22
B. 24
C. 18
D. 10
Answer
C. 18
bin1=1010 bin2=1000
READ input bin1,input bin2
INITIALIZE i equals 0,rem equals 0
INITIALIZE array ar of size 20
While(bin1!=0 or bin2!=0)
sum[i++]=(bin1%10+bin2%10+rem)%2
rem=(bin1%10+bin2%10+rem)/2
bin1=bin1/10
bin2=bin2/10
EndWhile
If(rem!=0)
sum[i++]=rem
--i
Endif
While(i>=0)
Print sum[i--]
EndWhile
Question 7
Answer
Question 7
A. 10011
B. 10010
C. 0010
D. 1000
Answer
B. 10010
num=12
FUNCTION factor(input num)int
i,j,primeno; for(i=2;i<=num;i++)
if(num%i==0)
SET primeno as TRUE
Endif
Endfor
for(j=2;j<=i/2;j++)
if(i%j==0)
SET primeno as FALSE
Break
Endif
Endfor
If primeno is TRUE
WRITE i
Question 8
Answer
Question 8
A. 2 3 4 6 12
B. 4 6 12
C. 2 3
D. 12
E. 1 2 3
Answer
C. 2 3
Read array a[5]={5,1,15,20,25}
Initialize i, j, m
i=++a[1]
j=a[1]++
m=a[i++]
Write i, j, m
Question 9
Answer
Question 9
A. 2, 1, 15
B. 1, 2, 5
C. 3, 2, 15
D. 2, 3, 20
Answer
C. 3, 2, 15
![](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)
Integer i=0,j
While(i<2)
{
j=0;
while(j<=3*i)
{
print j
print blank space
j=j+3
}
Print end-of-line
I=i+1
}
Question 10
Answer
Question 10
A. 0
0 3
B. 0 3
0
C. 0
3 6
0 3 6
0 3 6 9
D. 0 3 6
0 3 6 9
0 3 6 9 12
Answer
A. 0
0 3
integer i=1 //STATEMENT 1
while(i<=3)
{
int j //STATEMENT 2
while (j<=i) //STATEMENT 3
{
print j
print blank space
j=j+1 //STATEMENT 4
}
Print end-of-line
i=i+1
}
Question 11
Answer
Question 11
1
1 2
1 2 3
For this output, which is the incorrect statement in the given pseudocode?
A. STATEMENT 4
B. STATEMENT 3
C. STATEMENT 2
D. STATEMENT 1
E. NO ERROR
Answer
C. STATEMENT 2
![](https://sp-ao.shortpixel.ai/client/to_webp,q_glossy,ret_img,w_2048,h_406/https://codewindow.in/wp-content/uploads/2022/06/Copy-of-CS1-8-2048x406.png)
//Sum of the first 10 multiples of 10.
Integer i=0 //Statement 1 Integer
sum=0 //Statement 2
While(i<=1000){ //Statement 3
sum=sum+i //Statement 4
---MISSING STATEMENT---
}
Print sum
Question 12
Answer
Question 12
Identify the missing statement and the incorrect statement.
A. i=5
Statement 1
B.i=10*i
Statement 2
C.i=i+10
Statement 3
D.i=i+1
Statement 4
Answer
C.i=i+10
Statement 3
Also Checkout