[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Placement Questions & Answers :: TCS Ninja

51. Vijay wants to print the following pattern on the screen: 1
1 2
1 2 3

He writes the following program:

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 \takes the cursor to the next line i = i + 1
}

Will this program function correctly? If not which one statement will you modify to make the program function correctly?

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

TCS NQT TCS Ninja TCS Digital 

52. Linked lists are not suitable for

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

TCS NQT TCS Ninja TCS Digital 

53. Which of the following abstract data types can be used to represent a many-to-many relation?

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

TCS NQT TCS Ninja TCS Digital 

54. Pankaj and Mythili were both asked to write the code to evaluate the following expression:
a - b + c/(a-b) + (a-b)2
Pankaj writes the following code statements (Code A):
print (a-b) + c/(a-b) + (a-b) (a-b)
Mythili writes the following code statements (Code B):
d = (a-b)
print d + c/d + d d
If the time taken to load a value in a variable, for addition, multiplication or division between two operands is same, which of the following is true?

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

TCS Ninja 

55. Consider the following code:
if (condition 1) { if (condition 2)
{ // Statement A } else
if (condition 3)
{ // Statement B } else
{ // Statement C } else
if (condition 4)
{ // Statement D } else
{ // Statement E}
}
Which of the following conditions will allow execution of statement C?

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

TCS Ninja 

56. Every element of a data structure has an address and a key associated with it. A search mechanism deals with two or more values assigned to the same address by using the key. What is this search mechanism?

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

TCS NQT TCS Ninja TCS Digital 

57. The array A has n elements. We want to determine the position of X in the array. We know that X is present in the array A and X can be present at any location in the array with equal probability. How many comparisons will be required on average to find the element X using linear search?

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

TCS NQT TCS Ninja TCS Digital 

58. What is the output of the following code statements? The compiler saves the first integer at the memory location 4165 and the rest at consecutive memory spaces in order of declaration. Integer is one byte long.
integer a pointer c, d a = 30
c = &a d = c
a = a + 10 print c

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

TCS NQT TCS Ninja TCS Digital 

59. Which of the following is useful in traversing a given graph by breadth first search?

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

TCS Ninja 

60. A hash table can store a maximum of 10 records. Currently there are records in locations 1, 3, 4, 7, 8, 9, 10. The probability of a new record going into location 2, with a hash function resolving collisions by linear probing is

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

TCS Ninja