algorithm
algorithm
4. If the entire list is searched sequentially without locating x in linear search, the
solution is __________(a)
a) 0
b) -1
c) 1
d) 2
5. To sort a list with n elements, the insertion sort begins with the __________
element.(b)
a) First
b) Second
c) Third
d) Fourth
6. __________ comparisons required to sort the list 1, 2, 3…….n using insertion sort.
(c)
a) (n2 + n + 2) / 2
b) (n3 + n – 2) / 2
c) (n2 + n – 2) / 2
2
d) (n2 – n – 2) / 2
1. An Algorithm is ___________(a)
a) A procedure for solving a problem
b) A problem
c) A real life mathematical problem
d) None of the mentioned
3. An algorithm which uses the past results and uses them to find the new results is
_________(c)
a) Brute Force
b) Divide and Conquer
c) Dynamic programming algorithms
d) None of the mentioned
5. An algorithm which tries all the possibilities unless results are satisfactory is and
generally is time-consuming is _________(a)
a) Brute Force
b) Divide and Conquer
c) Dynamic programming algorithms
d) None of the mentioned
10. There are two algorithms suppose A takes 1.41 milli seconds while B takes 0.9
milliseconds, which one of them is better considering all other things the same?(b)
a) A is better than B
b) B is better than A
c) Both are equally good
d) None of the mentioned
Explanation: The growth rate of that function will be logarithmic therefore complexity will be
logarithmic.
5. If for an algorithm time complexity is given by O(n2) then complexity will ____(b)
a) constant
b) quadratic
c) exponential
d) none of the mentioned
9. Which algorithm is better for sorting between bubble sort and quicksort?(b)
a) bubble sort
b) quick sort
c) both are equally good
d) none of the mentioned
Explanation: By binary Expansion of 11100111 is 1*20 + 1*21 + 1*22 + 1*25 + 1*26 + 1*27 is
equal to 231.
c) 4
d) 6
Explanation: According to the Division Algorithm 111 = 12(9) + 3. Hence, remainder when
111 divided by 12 is 3 = 111 mod 12.
Explanation: By the Division algorithm 155 = 9(17) + 2. Where remainder is 155 mod 9.
c) 3 and 2
d) 3 and 3
c) points
d) edges
3. From the following code identify the which traversal of a binary tree is this
_______(c)
a) Inorder traversal
b) preorder traversal
c) postorder traversal
d) Euler tour traversal
4. What is the minimum height for a binary search tree with 60 nodes?(d)
a) 1
b) 3
c) 4
d) 2
5. From the following code identify the which traversal of a binary tree is this __________
function traversal(node)
{
//Input:root node of the tree
//Output:None
visitLeft(node)
//if node has left child
traversal(node.left)
visit_Below(node)
//if node has right child
traversal(node.right)
visitRight(node)
14
a) Inorder traversal
b) Euler Tour traversal
c) Post-order traversal
d) Pre-order Traversal
Answer: b
6. For the expression (7-(4*5))+(9/3) which of the following is the post order tree
traversal?(c)
a) *745-93/+
b) 93/+745*-
c) 745*-93/+
d) 74*+593/-
7. The time complexity of calculating the sum of all leaf nodes in an n-order binary
tree is __________(d)
a) O(n2)
b) O(n+1)
c) O(1)
d) O(n)
c) O(n2 logn)
d) O(n3)
1. If a matrix A = [A11 A12 ⋯ A1n A21 A2n ⋮ ⋮ An1 An2 ⋯ Ann], order(nxn) Aii = 1, Aij = 0 for i ≠ j.
Then that matrix is known as ________(a)
a) Identity matrix
b) Null matrix
c) Singular matrix
d) None of the mentioned
7. A square matrix A = [aij ]nxn, if aij = 0 for i > j then that matrix is known as _______(a)
a) Upper triangular matrix
b) Lower triangular matrix
c) Unit matrix
d) Null matrix
8. A square matrix A = [aij ]nxn, if aij = 0 for i < j then that matrix is known as _______(b)
a) Upper triangular matrix
b) Lower triangular matrix
c) Unit matrix
d) Null matrix
3. For a skew symmetric even ordered matrix A of integers, which of the following
will not hold true?(c)
a) det(A) = 9
b) det(A) = 81
c) det(A) = 7
d) det(A) = 4
4. For a skew symmetric odd ordered matrix A of integers, which of the following will
hold true?(c)
a) det(A) = 9
b) det(A) = 81
c) det(A) = 0
d) det(A) = 4
5. Let A = [kaij]nxn, B = [aij]nxn, be an nxn matrices and k be a scalar then det(A) is equal
to _________(b)
a) Kdet(B)
b) Kndet(B)
c) K3det(b)
d) None of the mentioned