Académique Documents
Professionnel Documents
Culture Documents
1. Let A be a square matrix of size n x n. Consider the following program. What is the expected output?
= 100
C
for i = 1 to n do
for j = 1 to n do
{
Temp = A[i][j] + C
A[i][j] = A[j][i]
A[j][i] = Temp - C
}
for i = 1 to n do
for j = 1 to n do
Output(A[i][j]);
c) Adding 100 to the upper diagonal elements and subtracting d) None of the above
100 from diagonal elements of A
2. The inorder and preorder traversal of a binary tree are d b e a f c g and a b d e c f g, respectively. The
postorder traversal of the binary tree is:
a) d e b f g c a b) e d b g f c a
c) e d b f g c a d) d e f g b c a
3. Which of the following operations is not O(1) for an array of sorted data. You may assume that array
elements are distinct.
4. The minimum number of comparisons required to determine if an integer appears more than n/2 times in a
sorted array of n integers is
(A) (n)
(B) (logn)
(C) (log*n)
(D) (1)
a) A b) B
c) C d) D
5. Match the problem domains in GROUP I with the solution technologies in GROUP II
GROUP I GROUP II
(P) Service oriented computing (1) Interoperability
(Q) Heterogeneous communicating systems (2) BPMN
(R) Information representation (3) Publish-find-bind
(S) Process description (4) XML
c) 10 d) 0.000000
7. Following function is supposed to calculate the maximum depth or height of a Binary tree -- the number of
nodes along the longest path from the root node down to the farthest leaf node.
int maxDepth(struct node* node)
{
if (node==NULL)
return 0;
else
{
/* compute the depth of each subtree */
int lDepth = maxDepth(node->left);
int rDepth = maxDepth(node->right);
8. Which of the following pairs of traversals is not sufficient to build a binary tree from the given traversals?
10. Given an unsorted array. The array has this property that every element in array is at most k distance from its position in sorted array
where k is a positive integer smaller than size of array. Which sorting algorithm can be easily modified for sorting this array and what is the
obtainable time complexity?
a) Insertion Sort with time complexity O(kn) b) Heap Sort with time complexity O(nLogk)
c) Quick Sort with time complexity O(kLogk) d) Merge Sort with time complexity O(kLogk)
11. Given the basic ER and relational models, which of the following is INCORRECT?
a) An attribute of an entity can have more than one value b) An attribute of an entity can be composite
c) In a row of a relational table, an attribute can have more than one value d) In a row of a relational table, an attribute can have
exactly one value or a NULL value
12. Given 8 identical coins out of which one coin is heavy and a pan balance. How many minimum number of measurements are needed to
find the heavy coin?
a) 2 b) 3
c) 4 d) 7
13. In a village, people build houses in the same side of the road. A thief plans to loot the village. He wants maximum amount of money
without having any risk of getting caught. By some means, the villagers know that their adjacent house is being looted or not and thus they
become alert. So the thief cannot loot contiguous two houses. Given that the thief knows the amount of money stored in each house and
the road is straight and there is no turning, which is the most efficient algorithmic strategy to solve this problem?
14. Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values. F = {CH -> G, A -> BC, B -> CFH, E -> A, F -> EG}
is a set of functional dependencies (FDs) so that F+ is exactly the set of FDs that hold for R. How many candidate keys does the relation R
have?
a) 3 b) 4
c) 5 d) 6
15. Which of following statements is/are False?
1. XML overcomes the limitations in HTML
to support a structured way of organizing content.
a) 2 only b) 1only
16.
Table A
Id Name Age
----------------
12 Arun 60
15 Shreya 24
99 Rohit 11
Table B
Id Name Age
----------------
15 Shreya 24
25 Hari 40
98 Rohit 20
99 Rohit 11
Table C
Id Phone Area
-----------------
10 2200 02
99 2100 01
Consider the above tables A, B and C. How many tuples does the result of the following SQL query contains?
SELECT A.id FROM A WHERE A.age > ALL (SELECT B.age FROM B WHERE B. name = "arun")
a) 4 b) 3
c) 0 d) 1
a) 3 b) 9
c) 5 d) 6
18) If a class B network on the Internet has a subnet mask of 255.255.248.0, what is the maximum number of hosts per subnet?
a) 1022 b) 1023
c) 2046 d) 2047
19) There are 25 horses among which you need to find out the fastest 3 horses. You can conduct race among at most 5 to find out their
relative speed. At no point you can find out the actual speed of the horse in a race. Find out how many races are required to get the top 3
horses.
a) 5 b) 6
c) 7 d) 8
20) What does the following function do for a given binary tree?
int fun(struct node *root)
{
if (root == NULL)
return 0;
if (root->left == NULL && root->right == NULL)
return 0;
return 1 + fun(root->left) + fun(root->right);
}