100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS2611 EXAM PACK 2024/2025 R60,00
Add to cart

Exam (elaborations)

COS2611 EXAM PACK 2024/2025

 36 views  4 purchases

COS2611 EXAM PACK 2024/2025 QUESTIONS WITH DETAILED ANSWERS. PERFECT FOR EXAM PREPARATION.

Preview 4 out of 45  pages

  • October 6, 2024
  • 45
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
All documents for this subject (15)
avatar-seller
mulah11
lOMoAR cPSD| 18998289

, lOMoAR cPSD| 18998289




Dashboard Calendar

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>

#include <string>


int main(){
std::stack<std::string> stackClass;
stackClass.push("John");
stackClass.push("Peter");
stackClass.push("Mary");
//... (i) ... missing code
}




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

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

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

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 this summary 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 this summary for R60,00. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

49497 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Start selling
R60,00  4x  sold
  • (0)
Add to cart
Added