100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS1511 EXAM PACK 2023 $2.82   Add to cart

Exam (elaborations)

COS1511 EXAM PACK 2023

 8 views  0 purchase
  • Course
  • Institution
  • Book

Latest exam pack questions and answers and summarized notes for exam preparation. for assistance. All the best on your exams!!

Last document update: 2 year ago

Preview 3 out of 244  pages

  • December 8, 2021
  • October 21, 2022
  • 244
  • 2022/2023
  • Exam (elaborations)
  • Questions & answers
avatar-seller
COS1511

EXAM PACK

, Oct/Nov 2021




75 Marks




This examination question paper consists of 9 pages.




INSTRUCTIONS:

Use word Document to answer the questions
Convert to PDF before submitting
Marks are awarded for part of an answer, so do whatever you are able to in each question.
This exam is IRIS invigilated. Please make sure you use IRIS.




ALL THE BEST!




[TURN OVER]

, 2 COS1511
Oct/Nov 2021




QUESTION 1 6 MARKS

1.1 Consider the C++ code segment below. What value will newvalhave after this code has been
executed? (2)

int var1 = 4;
int var2 = 10;
int newval = 0;
if (var1 * 2 >= var2)
newval = 5 + 2 * var2;
else if (var1 < var2)
newval = var2 - var1 * 2;
else
newval = var1;

1.2 Suppose the input value for a is 5. What is the value of a after the following C++ code has
been executed? (2)

int a;
cin >> a;
switch (a)
{
case 1: a += 3;
case 3: a = a * 3; break;
case 5: a = ++a + 10;
case 6: a /= 2;
default: a = a + 1;
}

1.3 Consider the following C++ code segment: (2)

int findValue(int numberP)
{
int count = 0;
int value = 20;
while (count < numberP)
{
value += count;
count ++;
}
return value;
}

What will be the output of the following statement executed in the main function?

cout << findValue(3);




[TURN OVER]

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 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 these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller iStudy. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $2.82. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

81989 documents were sold in the last 30 days

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

Start selling
$2.82
  • (0)
  Add to cart