You are on page 1of 2

D EPARTMENT OF M ATHEMATICS , FACULTY OF S CIENCE , C AIRO U NIVERSITY

Degree Program: Computer Science Class: 3rd Year


Course Title: Design and Analysis of Algo- Semester: 2nd Semester (Spring, 2023)
rithms Date of Examination: April 26, 2023
Course Code: CS305 Time Duration: 20 Minutes
Teacher’s Name: Dr. Hend Dawood Total Mark: 10 Marks
2 ND S EMESTER Q UIZ 5 (A)

Student’s Name: Student’s ID:

Choose the correct answer.

Question 1 (2 Points)
Consider the following graph. The 2-nd and 4-th edges of the minimum spanning tree produced by
Prim’s algorithm (starting with v1 ) are, respectively,

(A) (v6 , v5 ) and (v4 , v3 )


(B) (v1 , v2 ) and (v2 , v7 )
(C) (v1 , v6 ) and (v5 , v4 )
(D) (v6 , v5 ) and (v1 , v2 )

Question 2 (2 Points)
Consider the following graph. The 1-st and 4-th edges of the minimum spanning tree produced by
Kruskal’s algorithm are, respectively,

HY

3rd Year Page 1 of 2 April 26, 2023


CS305 2nd Semester Quiz 5 (A)

(A) (v1 , v2 ) and (v2 , v3 )


(B) (v2 , v3 ) and (v3 , v4 )
(C) (v1 , v2 ) and (v3 , v4 )
(D) (v1 , v3 ) and (v2 , v3 )

Question 3 (2 Points)
If a connected graph G has a very small number of edges, then to find a minimum spanning tree for
G you should apply
(A) Prim’s algorithm
(B) Kruskal’s algorithm

Question 4 (2 Points)
If a connected graph G has a very large number of edges, then to find a minimum spanning tree for
G you should apply
(A) Prim’s algorithm
(B) Kruskal’s algorithm

Question 5 (2 Points)
Assume you have the following letter frequencies

Huffman encoding of the letter M is


(A) 110
(B) 11111
(C) 111100
(D) 1110


Q UESTION A NSWER

1 A

2 C

3 B

4 A

5 B

End of Examination
Good Luck!
HY

3rd Year Page 2 of 2 April 26, 2023

You might also like