100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Tentamen (uitwerkingen)

COS1512 EXAM PACK 2025

Beoordeling
-
Verkocht
2
Pagina's
192
Cijfer
A+
Geüpload op
02-11-2025
Geschreven in
2025/2026

COS1512 EXAM PACK 2025 GOOD LUCK WITH YOUR PREPARATION!

Instelling
Vak








Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
2 november 2025
Aantal pagina's
192
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

COS1512

EXAM
PACK

2025

, lOMoARcPSD|58918787




Question1
Correct
Mark 1.00 out of 1.00

Flag question

Question text
This question is based on question 1 in the written Assignment 4.
The program in question 1 of the written assignment, contains an incomplete recursive
functionraised_to_power(). This function returns the value of the first
parameternumber of typefloat raised to the value of the second parameter
power of
typeint for all values of
power greater than or equal to 0.
The correct function header for the function
raised_to_power() is
Select one:
float raised_to_power(float number, int power)
int raised_to_power(float number, int power)
float raised_to_power(int number, float power)
float raised_to_power(float number, float power)
Feedback
The correct answer is:
float raised_to_power(float number, int power)

Question2
Correct
Mark 1.00 out of 1.00

Flag question

Question text
This question is based on question 1(b) in the written Assignment 4.
The program in question 1 of the written assignment, contains an incomplete recursive
function raised_to_power(). This function returns the value of the first
parameternumber of typefloat raised to the value of the second parameter
power of
typeint for all values of
power greater than or equal to 0.
Based on the fact that any value raised to the power of 0 is 1, the base case for this
function is
Select one:
else if (power == 0)
return (1.0);
else if (power == 1)
return (1.0);
else if (power > 0)
return (1.0);




Downloaded by Jonah Njenga ()

, lOMoARcPSD|58918787




else if (power == 0)
return (number * raised_to_power(number, power - 1));
Feedback
The correct answer is:
else if (power == 0)
return (1.0);

Question 3
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text
This question is based on work for question 1 in the written Assignment 4.
With recursion, the base case must eventually be reduced to a general case.
Select one:
True
False
Feedback
The correct answer is 'False'.

Question 4
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text
This question is based on question 2(a) in the written Assignment 4. Question 2 included
code fragment that you had to answer questions on. This is an extract from the code
fragment:
6: class A
7: {
8: private:
9: int x;
10: protected:
11: int getX();
12: public:
13: void setX();
14: };
15:
16: int A::getX()




Downloaded by Jonah Njenga ()

, lOMoARcPSD|58918787




17: {
18: return x;
19: }
20:
21: void A::setX()
22: {
23: x=10;
24: }


The reason why line 18 is a valid access in this code fragment, is because the variable x is
private data member of the class A. Private data members can only be accessed by other
member functions and operators of the class A. getX() is a member function of class A and
therefore line 18 is a valid access.
Select one:
True
False
Feedback
The correct answer is 'True'.

Question 5
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text
This question is based on question 2(c) in the written Assignment 4. Question 2 included
code fragment that you had to answer questions on. This is an extract from the code
fragment:
27: class B
28: {
29: private:
30: int y;
31: protected:
32: A objA;
33: int getY();
34: public:
35: void setY();
37: };




Downloaded by Jonah Njenga ()

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
FocusZone University of South Africa (Unisa)
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
383
Lid sinds
6 maanden
Aantal volgers
2
Documenten
506
Laatst verkocht
1 week geleden
Focus Zone

On this page you will find Uploads and Package Deals by the seller FOCUS ZONE.

4.3

57 beoordelingen

5
33
4
11
3
11
2
0
1
2

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo eenvoudig kan het zijn.”

Alisha Student

Veelgestelde vragen