Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

COS1511 EXAM PACK 2023

Rating
-
Sold
-
Pages
244
Grade
A+
Uploaded on
08-12-2021
Written in
2022/2023

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

Institution
Module

Content preview

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]

Connected book

Written for

Institution
Module

Document information

Uploaded on
December 8, 2021
File latest updated on
October 21, 2022
Number of pages
244
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

£3.47
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
EduPal University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
151349
Member since
7 year
Number of followers
36015
Documents
4799
Last sold
1 hour ago

At EduPal we provide assignment assistance, exam preparation, detailed notes, and exam packs to help college students study with confidence. Our tutoring is comprehensive and personalised, focusing on your subject needs and deadlines. We guarantee quality support, clear guidance, and proven strategies that improve understanding, marks, and pass rates. For more information Whats-App 0.8.1..2.7.8..3.3.7.2..

4.2

13938 reviews

5
8093
4
2729
3
1814
2
471
1
831

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions