TISL Previous Years Solved Sample Placement Papers
-
What does the following function do for a given Linked List with first node as head?
void fun1(struct node* head) { if (head == NULL) return; fun1(head->next); printf("%d ", head->data); }
a) Prints all nodes of linked lists
b) Prints all nodes of linked list in reverse order
c) Prints alternate nodes of Linked List
d) Prints alternate nodes in reverse order
Answer: b
Explanation: fun1() prints the given Linked List in reverse manner. For Linked List 1->2->3->4->5, fun1() prints 5->4->3->2->1.
-
What must be the missing logic in place of missing lines for finding the sum of nodes of a binary tree in alternate levels?
//e.g: consider complete binary tree: height-3, [1,2,3,4,5,6,7] - answer must be 23
n = power(2, height) - 1; // assume input is height and a[i] contains tree elements
for(i = 1; i <= n;)
{
// present level is initialized to 1 and sum is initialized to 0
for(j = 1; j <= pow(2, currentlevel - 1); j++)
{
sum = sum + a[i];
i = i + 1;
}
// missing logic
}
A) i = i + pow(2, currentlevel); currentlevel = currentlevel + 2; j = 1; (Ans)
B) i = i + pow(2, currentlevel); currentlevel = currentlevel + 2; j = 0;
C) i = i - pow(2, currentlevel); currentlevel = currentlevel + 2; j = 1;
D) i = i + pow(2, currentlevel); currentlevel = currentlevel + 1; j = 1;
-
Consider a situation of writing a binary tree into a file with memory storage efficiency in mind, is array representation of a tree good?
A) Yes, because we are overcoming the need for pointers and so space efficiency
B) Yes, because array values are indexable
C) No, it is not efficient in case of sparse trees, and remaining cases it is fine (Ans)
D) No, linked list representation of tree is only fine
-
Which of the following is the product of data processing?
A) information (Ans)
B) data
C) software program
D) system
-
The process of putting data into a storage location is called?
A) reading
B) writing (Ans)
C) controlling
D) hand shaking
-
You have two jars, one jar which has 10 rings and the other has none. They are placed one above the other. You want to remove the last ring in the jar. And the second jar is weak and cannot be used to store rings for a long time.
A) Empty the first jar by removing it one by one from the first jar and placing it into the second jar
B) Empty the first jar by removing it one by one from the first jar and placing it into the second jar and empty the second jar by placing all the rings into the first jar one by one (Ans)
C) There exists no possible way to do this
D) Break the jar and remove the last one
-
Given only a single array of size 10 and no other memory is available. Which of the following operations is not feasible to implement (Given only push and pop operation)?
A) Push
B) Pop
C) Enqueue (Ans)
D) Returntop