Dashboard / My courses / COS2611-23-EX10 / Welcome to the COS2611 Examination / COS2611-Exam Oct/Nov 2023
Time left 1:04:21
Question 1
Answer saved
Marked out of The table shows the running time against input size ( n ) of algorithm B:
2.00 What is the running complexity of algorithm B?
Algorithm n=2 n=8 n = 32
B 4 64 1024
a.O( n )
b.O(log n)
c.O(n)2
d.O(1)
Clear my choice
Jump to...
, lOMoAR cPSD| 18998289
Dashboard Calendar
Dashboard / My courses / COS2611-23-EX10 / Welcome to the COS2611 Examination / COS2611-Exam Oct/Nov 2023
Question 2
Give the algorithmic complexity of the code fragment:
Answer saved
Marked out of
for (int i = 1; i < n; i= i*2)
2.00
sum++;
a.O(log n)
b.O(n)2
c.O( n )
d.O(n log n)
Clear my choice
Time left 1:00:50
Question 3
Answer saved
Marked out of Suppose an algorithm has a time complexity of O( n ) and takes 10 seconds to process an input of size 1000.
2.00
How long would it approximately take to process an input of size 200 if the input size and runtime are linearly
related?
a.20 seconds
b.5 seconds
c.2 seconds
d.None of the provided options.
e.10 seconds
Clear my choice
Jump to...
, lOMoAR cPSD| 18998289
Dashboard Calendar
Dashboard / My courses / COS2611-23-EX10 / Welcome to the COS2611 Examination / COS2611-Exam Oct/Nov 2023
Question 4
Consider the follow incomplete code. Indicate which of the following code (i) will correctly display the list of
Answer saved
students in the class.
Marked out of
3.00
#include <stack>
a. while (!stackClass.empty()) {
std::cout << stackClass.top();
stackClass.pop();
}
b. for (int i=1; stackClass.top()-1;i++)
{
cout << stackClass.top();
}
c. while (!stackClass.empty()) {
stackClass.pop();
std::cout << stackClass.top();
}
d.None of the available options.
e. while (!stackClass.isEmptyStack()) {
stackClass.pop();
std::cout << stackClass.top();
}
Clear my choice
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller mulah11. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $3.43. You're not tied to anything after your purchase.