A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

61. Consider an implementation of unsorted single linked list. Suppose it has its representation with a head and a tail pointer (i.e. pointers to the first and last nodes of the linked list). Given the representation, which of the following operation cannot be implemented in O(1) time ?
a. Insertion at the front of the linked list
b. Insertion at the end of the linked list
c. Deletion of the front node of the linked list
d. Deletion of the last node of the linked list
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).Deletion of the last node of the linked list

62. Consider an undirected graph G where self-loops are not allowed. The vertex set of G is {(i, j) | 1 ≤ i ≤ 12, 1 ≤ j ≤ 12}. There is an edge between (a, b) and (c, d) if |a – c| ≤ 1 or |b–d| ≤ 1. The number of edges in this graph is
a. 726
b. 796
c. 506
d. 616
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).616

63. The runtime for traversing all the nodes of a binary search tree with n nodes and printing them in an order is
a. O(lg n)
b. O(n lg n)
c. O(n)
d. O(n^2)
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).O(n)

64. Consider the following statements :

S1: A queue can be implemented using two stacks.
S2: A stack can be implemented using two queues.

Which of the following is correct ?
a. S1 is correct and S2 is not correct
b. S1 is not correct and S2 is correct
c. Both S1 and S2 are correct
d. Both S1 and S2 are not correct
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).Both S1 and S2 are correct

65. Given the following prefix expression:

* + 3 + 3 ↑ 3 + 3 3 3

What is the value of the prefix expression?
a. 2178
b. 2199
c. 2205
d. 2232
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).2205

66. A priority queue is implemented as a max-heap. Initially, it has five elements. The level-order traversal of the heap is as follows:

20, 18, 15, 13, 12

Two new elements ‘10’ and ‘17’ are inserted in the heap in that order. The level-order traversal of the heap after the insertion of the element is:
a. 20, 18, 17, 15, 13, 12, 10
b. 20, 18, 17, 12, 13, 10, 15
c. 20, 18, 17, 10, 12, 13, 15
d. 20, 18, 17, 13, 12, 10, 15
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).20, 18, 17, 13, 12, 10, 15

67. If there are n integers to sort, each integer has d digits, and each digit is in the set  {1, 2, …, k}, radix sort can sort the numbers in:
a. O (k (n + d))
b. O (d (n + k))
c. O ((n + k) l g d)
d. O ((n + d) l g k)
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).O (d (n + k))

68. Match the following:

a. Prim’s algorithm                  i. O(V^2E)
b. Bellman-Ford algorithm     ii. O(VE lgV)
c. Floyd-Warshall algorithm   iii. O(E lgV)
d. Johnson’s algorithm           iv. O(V^3)

Where V is the set of nodes and E is the set of edges in the graph.

Codes :
     a    b   c   d
a. i    iii   iv  ii
b. i    iii   ii   iv
c. iii  i    iv   ii
d. iii  i    ii   iv
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).iii  i    iv   ii

69. Constructors have ............. return type.
a. void
b. char
c. int
d. no
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).no

70. Method over-riding can be prevented by using final as a modifier at ...............
a. the start of the class
b. the start of method declaration
c. the start of derived class
d. the start of the method declaration in the derived class
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).the start of method declaration