TCS Placement Questions & Answers :: TCS
491 / 652
#include<stdio.h>
int main(){
int i=0;
for(i=0;i<20;i++){
switch(i){
case 0:i+=5;
case 1:i+=2;
case 5:i+=5;
default: i+=4; break;
}
printf("%d ",i);
}
return 0;
}
A0 5 9 13 17
B5 9 13 17
C12 17 22
D16 21
ESyntax error
Answer: Option D
Explanation:Here is no explanation for this answer
Submit Your Solution
492 / 652
#include<stdio.h>
int main(){
enum number { a=-1, b= 4,c,d,e};
printf("%d",e);
return 0;
}
A1
B3
C5
D7
E9
Answer: Option D
Explanation:Here is no explanation for this answer
Submit Your Solution
493 / 652
#include<stdio.h>
auto int tcs(int);
int main(){
int a=5;
a=tcs(a);
printf("%d",a);
return 0;
}
auto int tcs(int x){
return x++;
}
ACompilation error
B6
C5
DNone of the above
Answer: Option A
Explanation:Storage classes allowed with return type are static, extern, typedef.
=> auto and register storage class with the return type of any function
Submit Your Solution
494 / 652
#include<stdio.h>
long unsigned static const ddlg(){
static const long unsigned a=0101;
return a;
}
int main(){
long number;
number=ddlg();
printf("%X",number);
return 0;
}
A41
B43
CCompilation error
DNone of the above
Answer: Option A
Explanation:Here is no explanation for this answer
Submit Your Solution
495 / 652
User defined data types are:
Astructure
Bunion
Carray
Dfunction
EBoth A and B
Answer: Option E
Explanation:User defined data types are: structure, union, enum
Submit Your Solution
496 / 652
Derived data types are:
Aarray
Bdouble
Cfunction
Denum
EBoth A and C
Answer: Option E
Explanation:Derived data types are: array, function, pointer
Submit Your Solution
497 / 652
#include <stdio.h>
void print(char *p);
int main()
{
char s[] = "T.C.S", *A;
print(s);
return 0;
}
void print(char *p)
{
while (*p != '\0')
{
if (*p != '.')
printf ("%s", *p);
p++;
}
}
ATCS
BT.C.S
CSegmentation fault
DNone of the above
Answer: Option C
Explanation:Here is no explanation for this answer
Submit Your Solution
498 / 652
#include<stdio.h>
int main(){
char c=-64;
int i=-32;
unsigned int u =-16;
if(c>i){
printf("pass1");
if(c<i)
printf("pass2");
else
printf("Fail2");
}
else
printf("Fail1”);
if(c==i)
printf("pass2");
else
printf("Fail2");
return 0;
}
APass1Pass2
BPass1Fail2
CFail1Pass2
DFail1Fail2
ENone of these
Answer: Option D
Explanation:Here is no explanation for this answer
Submit Your Solution
499 / 652
extern int s;
int t;
static int u;
main ()
{
}
Which of s, t and u are available to a function present in another file.
Aonly s
Bs & t
Cs, t, u
DNone of the above
Answer: Option A
Explanation:Here is no explanation for this answer
Submit Your Solution
500 / 652
main ()
{
}
int a;
f1(){}
f2(){}
Which of the functions is int a available for?
AAll of them
Bonly f2
Conly f1
Df1 and f2 only
Answer: Option D
Explanation:Here is no explanation for this answer
Submit Your Solution
Here is the list of questions asked in TCS Aptitude Test Question with Answers page 50. Practice TCS Written Test Papers with Solutions and take Q4Interview TCS Online Test Questions to crack TCS written round test. Overall the level of the TCS Online Assessment Test is moderate. Only those candidates who clear the written exam will qualify for the next round, so practic all the questions here and take all the free tests before going for final selection process of TCS