4 TCS Interview Questions With Answers

Below are few basic questions that can be expected on TCS interviews. These are not hard to answer but a good preparation is necessary so that you don't miss any.

Interview Question 1 :

1) What is the prime difference between While and Do While Loop ?

Answer :

Though while and do-while are loop statements, in Do While it is assured that the statements within the loop will be executed at least once (even if the condition fails.)

Interview Question 2 :

2) What is the difference between a = ++b and a = b++ ?

Answer :

The first statement a = ++b can be broken down into two statements b = b + 1 followed by a = b. Hence b will be incremented first and will be assigned to a. Hence values of a and b will be same at the end.

The second statement a = b++ can be broken down into two statements a = b followed by b = b + 1. Hence b will be assigned to a. Only after this assignment b will be incremented. Hence values of a and b will be different at the end.

Interview Question 3 :

3) A C program is compiled into native (binary) code by the compiler. Similary what will be generated out of JAVA program source by JAVA compiler ?

Answer :

JAVA program will get compiled into bytecode instead of native (binary) code.

Interview Question 4 :

Practive Question For Your Thought :

Given a for statement for(i = 1;i < 10;i++)
Now you can try by yourself rewriting the same logic using while statement.