# TCS Placement: Sample Questions 485 - 486 of 502

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

## Question 485

Edit

### Describe in Detail

Essay▾

If you are using C language to implement the heterogeneous linked list, what pointer type will you use?

### Explanation

• A linked list is known as heterogeneous when nodes of linked list can contain different type of information.
• A void pointer can point to any type of data either in-built data type or user defined structure.
• We can do this by creating an array or linked list of elements that encode both the data and the type of data.
• We could use a struct that includes a type indicator and a union of the various types that we want to handle, and the create an array or linked list of that struct:

typedef struct {int type_indi; union {float f; int i; double d; void ⚹ p; char c;} } item;

item array [10] ;

• For a linked list instead of an array, we would also need to add a item ⚹ next pointer.

## Question 486

Edit

### Write in Short

Short Answer▾

Fathers age is 5 times his son ′ s age. 4 years back the father was 9 times older than son. Find the fathers ′ present age.

### Explanation

• Let the present ages of father and son be F and S.
• At present, father՚s age is 5 times his son՚s age, i.e..
• Four years back, father was 9 times older than son, i.e..

• Substituting the value of F from equation (i) ,

• Substituting value of S in equation (i) ,
• So, at present father is 40 years old and son is 8 years old.

Developed by: