Exam (elaborations) Introduction to Programming (COS1511) Introduction to Programming
COS1511 Assignment 2 (COMPLETE ANSWERS) 2024 (735127) - DUE 13 May 2024
COS1511 Assignment 2 2024 (735127)
All for this textbook (34)
Written for
University of South Africa (Unisa)
Introduction to Programming I (COS1511)
All documents for this subject (31)
Seller
Follow
VarsityC
Reviews received
Content preview
COS1511
EXAM PACK
Solutions, Explanations, workings, and references
+27 81 278 3372
, 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;
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)
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 VarsityC. 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.