100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

COS1511 EXAM PACK 2025

Rating
4.0
(2)
Sold
6
Pages
278
Grade
A+
Uploaded on
01-10-2023
Written in
2024/2025

COS1511 Latest exam pack questions and answers and summarized notes for exam preparation. Updated for 2025 exams . For assistance Whats-App.0.6.7..1.7.1..1.7.3.9 . All the best on your exams!!

Institution
Course











Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Institution
Course

Document information

Uploaded on
October 1, 2023
Number of pages
278
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

COS1511
EXAM PACK




FOR ASSISTANCE WITH THIS MODULE +27 67 171 1739

, Jan/Feb 2023



70 Marks




This paper consists of 8 pages out of 70 marks


INSTRUCTIONS:

1. Answer all the questions on a Word document/by hand and convert to PDF.
2. Number your answers and label your rough work clearly.
4. Marks are awarded for part of an answer, so do whatever you are able to in each question.




ALL THE BEST




[TURN OVER]

,2

Choose the correct option and write only the number

Question 1 [20]
1.What is the output of the following code fragment? (2)

int x = 0;
while( x < 8)
cout << x << " ";
x ++;
cout << x << endl;

1. 0
2. infinite loop
3. 1 2 3 4 5 6 7 8
4. 0 1 2 3 4 5 6 7 8

2.What is the value of x after the following statements? (2)

int x, y, z; y = 10;
z = 3;
x = y * z - 3;

1. 0
2. 3
3. 10
4. 27

3.What is the value of x after the following statements? (2)

int x;
x = x + 15;

1. 0
2. 14
3. 15
4. not defined

4.What is the output of the following code? (2)

cout << "Where is the \\" << endl;

1. Where is the \
2.Where is the
3.Nothing, it is a syntax error
4.Where is the \ endl

5.What is the value of xafter the following statements? (2)

int x;
x = 19 % 5;

1. 4.0
2. 4
3. 3.8
4. 8

6.Given the following code fragment and the input value of 5, what output is generated? (2)
[TURN OVER]
float tax; float total;

cout << "Enter the cost of the item\n"; cin >> total;

, 3

if ( total >= 5.0)
{
tax = 0.14;
cout << total + (total * tax) << endl;
}
else
{
cout << total << endl;
}
1. 5
2. 5.7
3. 11
4. 11.4


7.Given the following code fragment and the input value of 3.0, what output is generated? (2)

float tax; float total;
cout << "Enter the cost of the item\n"; cin >> total;
if (total > 3.0)
{


}
else
{

}


tax = 0.10;
cout << total + (total * tax) << endl;

1. 3.0
2. 2.0
3. 3.3
4. 2.3

8.If x has the value of 3, y has the value of -2, and w is 10, is the following condition true or false? (2)

if( x < 2 && w < y)

1. true && true
true

2. false && false
false

3. false && false
true

4. true && false
false


9.Given the following code fragment, and an input value of 8, what is the output that is generated? (2)

int x;
[TURN OVER]
cout << "Enter a value\n"; cin >>
x;
if (x = 0)

Reviews from verified buyers

Showing all 2 reviews
1 month ago

1 year ago

very helpful

4.0

2 reviews

5
1
4
0
3
1
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

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
149163
Member since
7 year
Number of followers
35995
Documents
4310
Last sold
20 hours ago

4.2

13555 reviews

5
7803
4
2688
3
1790
2
455
1
819

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 tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right 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 aced it. It really can be that simple.”

Alisha Student

Frequently asked questions