اﻟﻤﻤﻠﻜﺔ اﻟﻌـﺮﺑﯿﺔ اﻟﺴﻌﻮدﯾﺔ
Kingdom of Saudi Arabia
Ministry of Higher Education وزارة اﻟﺘﻌﻠﯿﻢ اﻟﻌﺎﻟﻲ
Prince Sattam bin Abdulaziz University ﺟﺎﻣﻌﺔ اﻷﻣﯿﺮ ﺳﻄﺎم ﺑﻦ ﻋﺒﺪاﻟﻌﺰﯾﺰ
College of Computer Engineering and Sciences
ﻛﻠﯿﺔ ھﻨﺪﺳﺔ وﻋﻠﻮم اﻟﺤﺎﺳﺐ
Computer Science Department
ﻗﺴﻢ ﻋﻠﻮم اﻟﺤﺎﺳﺐ
Course Title: Data Structures and Algorithms :اﺳم اﻟطﺎﻟب
CS2321
Instructor: Dr. Mahdi Khemakhem Midterm Exam I :اﻟرﻗم اﻟﺟﺎﻣﻌﻲ
Date: November 1, 2015 2577 :اﻟﺸﻌﺒﺔ
Time: 60 minutes 1436-1437 (I) :اﻟﻤﺠﻤﻮع
Total Mark …../20
Question Total Marks Marks Obtained
1 3.50
2 3.50
3 4
4 3
5 3
6 3
Total Score 20
Instructions
1. Write down your name, your student Id, Section number and your college name in the area
provided above.
2. Sign Here:
Good Work
Midterm Exam I CS2321– Data Structures and Algorithms Page: 1 of 5
, Exercise 1:
Choose the correct answer:
Q 1 2 3 4 5 6 7 8 9 10 11 12 13 14
R a b c d d c b a a b c d a d
1. Analytical methods is better than Empirical methods in analyzing performance of algorithms because:
a) Empirical methods sometimes take very long time.
b) Empirical methods require supercomputers.
c) Empirical methods sometimes give bad estimations.
d) All of the above.
2. Algorithm analysis means
a) How to efficiently store, access, manage data
b) How to predict an algorithm’s performance
c) Data structures effect algorithm’s performance
d) None of the above
3. When comparing two algorithms they should be
a) Run on different machines.
b) Run on the same machine with different setup.
c) Run on the same machine with the same setup.
d) Run on a super computer.
4. Factors affecting the running time of an algorithm is(are):
a) Computer.
b) Compiler.
c) Input to the algorithm.
d) All the above.
5. Big-Oh means
a) f(N) = c g(N) when N ≥ n0
b) f(N) > c g(N) when N ≥ n0
c) f(N) < c g(N) when N ≥ n0
d) f(N) ≤ c g(N) when N ≥ n0
6. Big-Omega means
a) f(N) = c g(N) when N ≥ n0
b) f(N) > c g(N) when N ≥ n0
c) f(N) ≥ c g(N) when N ≥ n0
d) f(N) < c g(N) when N ≥ n0
7. Three-level nested for loop runtime response is:
a) O(N)
b) O(N3)
c) O(N2 )
d) O(log N)
8. Sorting a set of numbers in increasing order; given that the data is in decreasing order is called:
a) Worst case.
b) Average case.
c) Best case.
d) None.
Midterm Exam I CS2321– Data Structures and Algorithms Page: 2 of 5
Kingdom of Saudi Arabia
Ministry of Higher Education وزارة اﻟﺘﻌﻠﯿﻢ اﻟﻌﺎﻟﻲ
Prince Sattam bin Abdulaziz University ﺟﺎﻣﻌﺔ اﻷﻣﯿﺮ ﺳﻄﺎم ﺑﻦ ﻋﺒﺪاﻟﻌﺰﯾﺰ
College of Computer Engineering and Sciences
ﻛﻠﯿﺔ ھﻨﺪﺳﺔ وﻋﻠﻮم اﻟﺤﺎﺳﺐ
Computer Science Department
ﻗﺴﻢ ﻋﻠﻮم اﻟﺤﺎﺳﺐ
Course Title: Data Structures and Algorithms :اﺳم اﻟطﺎﻟب
CS2321
Instructor: Dr. Mahdi Khemakhem Midterm Exam I :اﻟرﻗم اﻟﺟﺎﻣﻌﻲ
Date: November 1, 2015 2577 :اﻟﺸﻌﺒﺔ
Time: 60 minutes 1436-1437 (I) :اﻟﻤﺠﻤﻮع
Total Mark …../20
Question Total Marks Marks Obtained
1 3.50
2 3.50
3 4
4 3
5 3
6 3
Total Score 20
Instructions
1. Write down your name, your student Id, Section number and your college name in the area
provided above.
2. Sign Here:
Good Work
Midterm Exam I CS2321– Data Structures and Algorithms Page: 1 of 5
, Exercise 1:
Choose the correct answer:
Q 1 2 3 4 5 6 7 8 9 10 11 12 13 14
R a b c d d c b a a b c d a d
1. Analytical methods is better than Empirical methods in analyzing performance of algorithms because:
a) Empirical methods sometimes take very long time.
b) Empirical methods require supercomputers.
c) Empirical methods sometimes give bad estimations.
d) All of the above.
2. Algorithm analysis means
a) How to efficiently store, access, manage data
b) How to predict an algorithm’s performance
c) Data structures effect algorithm’s performance
d) None of the above
3. When comparing two algorithms they should be
a) Run on different machines.
b) Run on the same machine with different setup.
c) Run on the same machine with the same setup.
d) Run on a super computer.
4. Factors affecting the running time of an algorithm is(are):
a) Computer.
b) Compiler.
c) Input to the algorithm.
d) All the above.
5. Big-Oh means
a) f(N) = c g(N) when N ≥ n0
b) f(N) > c g(N) when N ≥ n0
c) f(N) < c g(N) when N ≥ n0
d) f(N) ≤ c g(N) when N ≥ n0
6. Big-Omega means
a) f(N) = c g(N) when N ≥ n0
b) f(N) > c g(N) when N ≥ n0
c) f(N) ≥ c g(N) when N ≥ n0
d) f(N) < c g(N) when N ≥ n0
7. Three-level nested for loop runtime response is:
a) O(N)
b) O(N3)
c) O(N2 )
d) O(log N)
8. Sorting a set of numbers in increasing order; given that the data is in decreasing order is called:
a) Worst case.
b) Average case.
c) Best case.
d) None.
Midterm Exam I CS2321– Data Structures and Algorithms Page: 2 of 5