TCS Placement Questions & Answers :: TCS
511 / 652
#include<stdio.h>
void main()
{
int a=2;
if(a-- , --a, a)
printf("Tom");
else
printf("Jerry");
}
ATom
BJerry
CTom Jerry
DError
Answer: Option B
Explanation:if(2, 0, 0) last value 0 ?False
Submit Your Solution
512 / 652
#include <stdio.h>
main()
{
int a=100,b=300;
if(a>50)
a=200;
b=400;
printf("%d",b);
}
A400
B300
C100
DError
Answer: Option A
Explanation:No braces, so only one immediate statement is part of if
Submit Your Solution
513 / 652
#include <stdio.h>
void main()
{
if(printf("O", printf("Two")))
printf("Face");
else
printf("Focus");
}
AError
BOTwoFace
CHaiFocus
DTwoOFace
EFace
Answer: Option D
Explanation:prints content of printf statement and takes length of the string for if case execution in this case its 4, So true
Submit Your Solution
514 / 652
void main()
{
if( printf(""))
printf("Face");
else
printf("Focus");
}
AError
BFace
C""Focus
DFocus
Answer: Option D
Explanation:prints content of printf statement and takes length of the string for if case case its 1, So true
Submit Your Solution
515 / 652
#include <stdio.h>
void main()
{
if( printf("Hai"))
printf("Face");
else
printf("Focus");
}
AError
BHaiFace
CHaiFocus
DFace
Answer: Option B
Explanation:prints content of printf statement and takes length of the string for if case execution in this case its 4, So true
Submit Your Solution
516 / 652
#include <stdio.h>
void main()
{
if(5,4,3,2,1,0,8,9)
printf("True");
else
printf("False");
}
ATRUE
BFALSE
CTrue False
DError
Answer: Option A
Explanation:Last value of if will be considered
Submit Your Solution
517 / 652
#include <stdio.h>
void main()
{
if(5,4,3,2,1,? 0 ? )
printf("True");
else
printf("False");
}
ATRUE
BFALSE
CTrue False
DError
Answer: Option B
Explanation:Last value of if will be considered
Submit Your Solution
518 / 652
#include <stdio.h>
void main()
{
if(1)
printf("hai");
else
printf("hello");
}
AError
Bhai
Chello
DNo output
Answer: Option A
Explanation:If condition will be always
Submit Your Solution
519 / 652
#include <stdio.h>
void main()
{
int a,x=2,3,4,5;
a=1,2,3,4,5;
printf("%d%d",x,a);
}
AError
B5,1
C2,1
D5,5
Answer: Option A
Explanation:Error because list is not within ( )
Submit Your Solution
520 / 652
#include <stdio.h>
void main()
{
int a,x=(2,3,4,5);
a=1,2,3,4,5;
printf("%d,%d",x,a);
}
AError
B5,1
C2,1
D5,5
Answer: Option B
Explanation:valid statement x = last value in list x = 5 during declaration list should be specified inside ( )
valid; a = 1; first value of the list is assigned to variable
Submit Your Solution
Here is the list of questions asked in TCS Aptitude Test Question with Answers page 52. 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