CSD Key
CSD Key
59:52
Q mark: 1 Total Marks: 50
Font Size: 10 : Time Left:
Multiple Choices
□ B
□ C
□ D
Next
Multiple Choices
Font Size:
10 : Time Left:
19:2
Multiple choices 2/50
Consider the following function:
Answer voidfun(int n)
{int m = n/3;
0A int k = n%3;
cout«k<<” if
□ B (m > 0)
{ftjn(m);
□ C }
}
0D
What is the output when the statement fun(22); is run?
□ E
A. 1 12
B. 201
Next
C. 1001
D. 122
E. 102 V
Multiple Choices
Font Size:
10 : Time Left:
18:52
Multiple choices 3/50
Answer State True or False:
In a singly-linked list there is no efficient way to insert a node before a given node in the middle or at the end of the list but we can insert a node after a given node or at the beginning of the list with time
□ A 0 complexity 0(1).
B A. False
B. True
Next
Multiple Choices
Font Size:
10 : Time Left:
18:42
Multiple choices 4/50
Consider the following pseudocode:
Answer
declare a queue of characters
while(there are more characters in the word to read)
□ A
{read a character if a character
isthen
0B
dequeue and write the dequeued character to the screen
else
□ C
enqueue the character into the queue
}
□ D
What is written to the screen for the input "HowAre**You**To*Day" ?
A. HowAre
B. HowAr
Next
C. erAwoH
D. owAreY
Multiple Choices
Font Size:
10 : Time Left:
18:32
Multiple choices 5/50
What is the result of the breadth first traverse of the binary search tree T. after inserting the following keys into the tree sequentially (suppose T is empty before insertion): 7. 8.
Answer
3.1. 2. 5. 9
0A A. 7. 3. 8.1. 5. 9. 2
□ B B. 7. 3.1.2. 5. 8. 9
□ C C. 7. 3. 8.1. 2. 5. 9
□ D D. 7. 3. 8.1.5. 2. 9
Next
Multiple Choices
Font Size:
10 : Time Left:
18:2
Multiple choices 6/50
Answer In a linked list the tail node is introduced for performance purpose only.
0 A □ A. True
B B. False
Next
A. 46
B. 50
C. 30
D. 48
E. 29
Answer
0A
□ B
□ C
0D
0E
Next
Exit
Exit
Machine: SU Student: supbse03068
Multiple Choices
Font Size:
10 : Time Left:
17:42
Multiple choices 9/50
Specify the correct implementation of popO method of a stack. This stack uses the list<string> t object for storing data and the front (head) of the list is treated as the top of the stack. (Choose the most suitable A one)
Answer
C. string popO
{assert(lisEmptyO); string x = tback(); tpop_frontO: return(x);
Next
D. void pop(stringx)
{assert(lisEmptyO);
string x = tfront();
tpop.frontQ: v
Multiple Choices
Font Size:
10 : Time Left:
17:2
Multiple choices 11/50
Answer What is the correct definition of a hash function? (Select the best answer)
□ A A. Hash function h(x) is a function which transforms a particular key x. be it a string, number, record, or the like, into a positive integer.
0B
B. Hash function h(x) is a function which transforms a particular key x. be it a string, number, record, or the like, into an index i = h(x) in the table T. where T[i] isused for storing an item having key x or its
address.
□ C
C. Hash function h(x) is a function which transforms a particular keyx (string, or number) into an index i = h(x) in the table T. where T[i] is used for storing an itemhaving key x or its address.
□ D D. Hash function h(x) is a function which transforms a particular key x. be it a string, number, record, or the like, into non-negative integer.
Next
Multiple Choices
Font Size:
10 : Time Left:
15:22
Multiple choices 15/50
Suppose a doubly linked list of integers is given below and p is a reference to the node with value 10 in the list (i.e. p->info=10): (head)
Answer
7 11 6 4 3 10 8 2 (tail)
0A What does the list look like after the following C++ code snippet is run?
intx = 9;
0B Node * pi.* p2; pi
= newNode(x);
□c p2 = p->next
0D p->next = pi: p1->prev = p;
p1->next = p2: p2->prev =
0 E pi;
7 11 6 4 3 10 8 2 9
A. 7 11 6 4 3 9 10 8 2
Next
B. 7 9 11 6 4 3 10 8 2
C. 9 7 11 6 4 3 10 8 2
7 11 6 4 3 10 9 8 2
Multiple Choices
Font Size:
10 : Time Left:
13:22
Multiple choices 18/50
Suppose a doubly linked list of integers is given below and p is a reference to the node with value 17 in the list (i.e. p->info=17): (head)
Answer
7 1 6 4 31 17 8 2 (tail)
What does the list look like after the following C++ code snippet is run?
□ A
intx = 13;
Node * f = p->prev; //prev is a link to predecessor node
□ B
Node * q = new Node(x); q->prev = t q->next = p: f->next
= q: p->prev = q;
0C
A 7 1 6 4 31 17 8 2 13
.
□ D
0E B 13 7 1 6 4 31 17 8 2
.
C 7 1 6 4 31 13 17 8 2
.
Next D 7 1 6 4 31 17 13 8 2
.
E 7 13 1 6 4 31 17 8 2
.
Multiple Choices
Font Size:
10 : Time Left:
12:52
Multiple choices 19/50
Answer Consider the following function:
intfun(int n)
□ A
{if(n==11| n==2) return(1); else
return(fun(n-1) + 2*fun(n-2));
□ B }
0D A. 5
□ E B. 4
C. 11
Next
D. 3
E. 12
Multiple Choices
Font Size:
10 : Time Left:
12:42
Multiple choices 21/50
Select the statement that is most correct
Answer
Which of the following applications may not use a queue?
□ A
A. Auxiliary data structure for algorithms.
□ B
B. Multi-programming.
0C
C. Undo sequence in a text editor.
□ D
D. Store a waiting list of printing jobs.
Next
12:2
Q mark: 1 Total Marks: 50
Font Size:
10 : Time Left:
Multiple Choices
Multiple choices 22/50
Answer Suppose the graph G = (V.E) satisfies the conditions for the existence of an Eulerian cycle. The following is
an algorithm for finding Euler cycle from the vertex X using stack:
□ A
declare a stack S of characters (a vertex is labeled by a character) declare an empty array E (which will
□ B contain Euler cycle) push the vertex X to S while(S is not empty)
{ch = top element of the stack S
□ C if ch is isolated then remove it from the stack and put it to E else
select the first vertex Y (by alphabet order), which is adjacent to ch.push Y to S and remove the edge (ch.Y)
0D 0 from the graph
}
the last array E obtained is an Euler cycle of the graph
E
Suppose a multigraph G is given below (view picture). Which of the followings is the Euler cycle from the
vertex C. created by above algorithm?
Next
A. C.B.A.D.C.A.C
B. C.A.B.C.A.D.C
C. C.B.A.C.A.D.C
D. C.B.A.D.C
E. C.D.A.C.B.A.C
Machine: SU Student: supbse03068
Multiple Choices
Font Size:
10 : Time Left:
11:32
Multiple choices 23/50
Fill in the blank of the statement to form the most correct one:
Answer
In a _______ every element contains some data and a link to the ^3 element which allows to keep the structure.
□ A
A. binary search tree
□ B
B. doubly linked list
0C
C. singly linked list
□ D
D. skip list
Next
Multiple Choices
Multiple choices 25/50
Answer Given a graph below and colors numbered 1.2. 3.... are assigned to vertices with the sequential coloring
algorithm that orders vertices in decreasing order of their degrees, (i.e. vertices are put in the
largest first sequence)
□□
< CO
□C
0D
□E
Next V
Multiple Choices
Font Size:
10 : Time Left:
10:52
Multiple choices 26/50
Select the statement that is most correct
Answer
Which of the following applications may use a stack?
□ A
A. Store all variables in a program.
0B
B. Undo sequence in a text editor.
□ C
C. Multi-programming.
□ D
Next D. Store a waiting list of printing jobs.
Multiple Choices
Font Size:
10 : Time Left:
10:42
Multiple choices 27/50
Consider the following pseudocode:
Answer
declare a stack of characters
while(there are more characters in the word to read)
0A
{read a character if a character i s t h e n pop the stack else
push the character into the stack
□ B }
while(the stack is not empty) pop and write the poped character
□ C to the screen
A. gioG
B. Goig
Next
C. gioM
D. giod
Multiple Choices
Font Size:
10 : Time Left:
10:32
Multiple choices 28/50
□ A
A. Values in a node is greater than every value in children of it
□ B
B. Both of other conditions applies
0C
C. Values in a node is greater than every value in left sub tree and smaller than right sub tree
Next
10:12
Q mark: 1 Total Marks: 50
Font Size: Time Left:
10 :
Multiple Choices
Next
A. B.A.F.C.D.E.B
B. B.D.A.F.C.E.B
C. B.A.F.D.E.C.B
D. B.C.E.D.F.A.B
E. B.A.C.F.D.E.B
Multiple Choices
Font Size:
10 : Time Left:
9:2
Multiple choices 30/50
Partitioning is a technique used in quicksort The following is a partition pseudocode for sorting from smallest to largest
Answer
partition the array a from index low to index up x := a[low], i=low. j=up do
increase i and stop at i. where a[i]>x decrease j and stop at j. where a[j]<=x if(i<j) swap a[i] with a[j] while(icj)
□ A
swap a [low] with a[j]
Consider the list of eight integers (n=8) below:
□ B
6. 3. 9.10. 8. 2. 7. 5
What is the list after it is partitioned with low = 0 and up = n-1?
□ C
A. 2. 3. 6. 5. 8.10. 7. 9
0D
B. 2. 3. 5. 6. 7. 8.10. 9
C. 2. 3. 5. 6. 8. 7. 9.10
Next
D. 2. 3. 5. 6. 8.10. 7. 9
Multiple Choices
Font Size:
10 : Time Left:
8:52
Multiple choices 32/50
Answer Given the character frequencies
32%
□ A 28%
16%
□ B 6%
18%
0C Using Huffman encoding, what is the code for character E? (Suppose that when constructing a sub tree from 2 nodes we always place node with higher frequency on the left: and the left branch of a node gets value 0.
the right one gets value 1)
□ D
Next
Multiple Choices
Font Size:
10 : Time Left:
7:42
Multiple choices 34/50
Suppose a doubly linked list of integers is given below and p is a reference to the node with value 13 in the list (i.e. p->info=13): (head)
Answer
7 11 6 4 32 13 8 2 (tail)
What does the list look like after the following C++ code snippet is run?
□ A
intx = 17;
Node *q = new Node(x);
□ B
q->prev=null; q->next =
head; head->prev = q;
□ C
head = q;
0D 0
A. 7 11 6 4 32 13 8 2 17
E
B. 7 11 6 4 32 13 8 17 2
C. 7 17 11 6 4 32 13 8 2
Next
D. 7 11 6 4 32 13 17 8 2
E. 17 7 11 6 4 32 13 8 2
Multiple Choices
Font Size:
10 : Time Left:
7:22
Multiple choices 35/50
Consider the following function: voidfun(int n)
Answer
{if (n < 0)
{fun(-n);
□ A
cout«‘ n = '«n«endl;
}
□ B else if(n<15) cout«n); else
{cout«n%10«endl;
0C fun(n/15);
}
□ D }
A. n<0
Next B. n <15
D. n >= 15
□ A
□ B
0C
□ D
Next
A (4
. )
(3
CO
)
C (1
. )
D (2
. )
Multiple Choices
Font Size:
10 : Time Left:
6:12
Multiple choices 37/50
Answer
Binary search algorithm cannot be applied to
□ A
A. Binary search tree
□ B
B. sorted linear array
0C
Next C. sorted doubly linked list
Multiple Choices
Font Size:
10 : Time Left:
6:2
Multiple choices 38/50
Suppose a singly linked list of integers is given below:
Answer
(head) 7 1 6 4 3 12 8 2 (tail)
What does the list look like after the following C++ code snippet is run?
□ A
intx = 9;
Node *f= head; while(f->next != tail) f = f->next Node * q = new Node(x);
□ B
q->next = tail: f->next = q:
□ C A. 71643 12 829
0D B. 71643 12 982
0 E
C. 971643 12 82
□ A
0B
□ C
□ D
What is the breadth-first traversal of a tree below after deleting the node 5 by copying?
A. 2.1.4. 3. 7. 6. 8
B. 4. 2. 7.1.3. 6. 8
C. 2.1.4. 3. 7. 8. 6
D. 2.1.4. 3. 6. 7. 8
Next
Exit
v
□ I want to finish the exam.
Finish
Machine: SU Student: supbse03068
Multiple Choices
Font Size:
10 : Time Left:
5:22
Multiple choices 40/50
The following is the main part of insertion sort pseudocode:
Answer
for i := 1 to n-1
insert a[i] into sorted sublist {a[0] ..... a[i-1]}
□ A
so that the sortedness is still kept
end for
□ B
Select the most correct solution:
Consider the list often integers below:
0C
16.4. 2.11.10. 8.12. 3. 8.5
What is the list after the FIRST TWO steps of insertion sort? (sorting from smallest to largest).
□ D
A. 2.3.16.11.10.8.12.4.8.5
B. 2.4.11.10.8.12.3.8.5.16
Next
C. 2.4.16.11.10.8.12.3.8.5
D. 2.3.4.11.10.8.12.16.8.5
Multiple Choices
Font Size:
10 : Time Left:
4:32
Multiple choices 41/50
Answer
0A
□ B
□ C
□ D
Next
Multiple Choices
Font Size:
10 : Time Left:
4:12
Multiple choices 42/50
Select the statement that is most correct
Answer
Basically, the complexity of getting an element at the middle of a singly linked lists is
0A
A. 0(1)
□ B
B. 0(log n)
□ C
C. 0(n)
□ D
D. 0(n~2)
Next
Multiple Choices
Font Size:
10 : Time Left:
2:52
Multiple choices 43/50
Answer Run length encoding is a lossless compression method in which repeated occurrences of a
symbol are replaced by one occurrence of the symbol followed by the number of
0 A □ occurrences.
A. True
B
B. False
Next
Multiple Choices
Font Size:
10 : Time Left:
1:52
Multiple choices 44/50
The following is the main part of bubble sort pseudocode: do
Answer
swapped := false for i := 0 to n-2 if a[i] > a[i+1] then swap(a[i].a[i+1]) swapped :=true end if end for while
swapped
□ A
Consider the list often integers below:
15.13.18.19.11.17.10.12.16.14
0B
What is the list after the FIRST iteration (for i = 0 to n-2) in a bubble sort ?(sorting from smallest to largest).
□ C A. 13.15.18.17.11.10.12.16.14.19
□ D B. 13.15.18.11.17.10.12.16.14.19
C. 13.15.18.10.11.17.12.16.14.19
D. 13.15.18.11.17.10.12.14.16.19
Next
1:22
Q mark: 1 Total Marks: 50
Font Size:
10 : Time Left:
Multiple Choices
Next
Multiple Choices
Font Size:
10 : Time Left:
0:52
Multiple choices 46/50
Answer Using the Huffman code tree below. What is the result of decoding the string: 00100100010001 ?
□ A
□ B A AABBABAB
0C B. BABABBBA
□ D C. BABABCBC
Next
D. BABABCAB
Multiple Choices
Font Size:
10 : Time Left:Exit
0:32
Multiple choices 47/50
Answer A. void pop(intx)
{assert(!isEmptyO);
□ A
intx = tback();
tpop_back();
□ B return(x);
}
□ C
B. intpopO
0D
{assert(!isEmptyO);
intx = tbackO:
tpop_front();
return(x);
}
C. intpopO
Next {if(temptyO) return;
intx = tbackO;
tpop_backO;
return(x);
}
D. intpopO
{assert(!isEmptyO);
intx = tback();
tpop_backO;
return(x);
}