GATE 2008 Computer Science and Information Technology (CS) Questions with Solutions

GATE 2008

185 questions

MCQ 1851-mark 52 · 2-mark 133

Questions 106–110 of 185

Q106Recurrence Relation2 marksMCQ−0.67 if wrong
Let xnx_{n} denote the number of binary strings of length n that contain no consecutive 0s.

Which of the following recurrences does xnx_{n} satisfy?

Q107Dynamic Programming2 marksMCQ−0.67 if wrong
The subset-sum problem is defined as follows. Given a set of n positive integers, S={a1,a2,...,ana_{1},a_{2},...,a_{n}} and positive integer W, is there a subset of S whose elements sum to W? A dynamic program for solving this problem uses a 2-dimensional Boolean array, X, with n rows and W+1 columns. X[i,j], 1≤i≤n1\leq i\leq n, 0≤j≤W0\leq j \leq W, is TRUE if and only if there is a subset of {a1,a2,...,aia_{1},a_{2},...,a_{i}}whose elements sum to j.

Which entry of the array X, if TRUE, implies that there is a subset whose elements sum to W?

Q108Dynamic Programming2 marksMCQ−0.67 if wrong
The subset-sum problem is defined as follows. Given a set of n positive integers, S={a1,a2,...,ana_{1},a_{2},...,a_{n}} and positive integer W, is there a subset of S whose elements sum to W? A dynamic program for solving this problem uses a 2-dimensional Boolean array, X, with n rows and W+1 columns. X[i,j], 1≤i≤n1\leq i\leq n, 0≤j≤W0\leq j \leq W, is TRUE if and only if there is a subset of {a1,a2,...,aia_{1},a_{2},...,a_{i}}whose elements sum to j.

Which of the following is valid for 2≤i≤n2\leq i\leq n and ai≤j≤Wa_{i} \leq j \leq W?

Q109Graph Traversal (BFS and DFS)2 marksMCQ−0.67 if wrong
Consider the following sequence of nodes for the undirected graph given below:
1.a b e f d g c
2.a b e f c g d
3.a d g e b c f
4.a d b c g e f
A Depth First Search (DFS) is started at node a. The nodes are listed in the order they are first visited. Which of the above is/are possible output(s)?
c b a e f d g

Q110Graph Traversal (BFS and DFS)1 markMCQ−0.33 if wrong
The Breadth First Search algorithm has been implemented using the queue data structure. One possible order of visiting the nodes of the following graph is
MNO RQP