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 November exam 2016

Rating
-
Sold
-
Pages
9
Grade
A
Uploaded on
17-10-2022
Written in
2016/2017

This document contains answers for the November examinations

Institution
Course

Content preview

COS1511_Nov2016_MEMO TUTORIALS CAMPUS www.tutorialscampus.co.za

1.1 45
1.2 Twice
1.3 0
1.4 6
1.5 7
1.6 Name.size()
1.7 0
1.8 Classic basic primitive types may include:



Character (character, char);

Integer (integer, int, short, long, byte) with a variety of precisions;

Floating-point number (float, double, real, double precision);

Boolean, logical values true and false



1.9 SAfrica

1.10 #include <iostream>

Question 2)

2.1) To add all the even numbers in the array to sum variable, and display sum

2.2) To accept values to variable a and b, swap the values in the variables and display the
variables.

Question 3)

3.1)

if(level == 1 || level == 2)
cout<<"Basic";
else if(level == 3)
cout<<"Intermediate";
else if(level == 4)
cout<<"Advance";
else
cout<<"Not a valid level";

3.2)
A prime number is a whole number greater than 1, whose only two whole-number factors are 1
and itself. The first few prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29.

int i=2, j;


1|Page -)For more info call Nicholas on 083 33 13 124

, COS1511_Nov2016_MEMO TUTORIALS CAMPUS www.tutorialscampus.co.za

bool prime = true;
while(i < 10)
{
prime = true;
j = 2;
while(j<i)
{
if((i%j) == 0)
prime = false;
j++;
}
if(prime)
cout<<i<<endl;
i++;
}
4.1)
A named memory location used to store data of a specific datatype

4.2)
Global variable are variables which are declared outside all function and can be accessed by all
the functions within that program.

Local variable are variable which are declared within a function or block of code(e.g for_loop)
and are visible within that function or block.

4.3)
float f1;

4.4)
A function is a group of statements that together perform a task. A function declaration
tells the compiler about a function's name, return type, and parameters. A function
definition provides the actual body of the function.

4.5)Refer to Appendix D of the leaner guide, page 376
getline(istream, string &, char)
srand(int)
int rand( )
char tolower(char)

4.6)
Acutal parameters are values in a function calling statement that are passed to the function
being called.

Formal are parameter are variables in the function definition that are used to receive values for
that function.




2|Page -)For more info call Nicholas on 083 33 13 124

Written for

Institution
Course

Document information

Uploaded on
October 17, 2022
Number of pages
9
Written in
2016/2017
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$6.00
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
lindelanitshikalange0

Also available in package deal

Get to know the seller

Seller avatar
lindelanitshikalange0 University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
5
Member since
3 year
Number of followers
4
Documents
14
Last sold
3 year ago

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions