Question: SECTION B [ 4 5 Marks ] Question 1 is compulsory, answer any 2 of the other 3 questions in this section Question 1 [

SECTION B [45 Marks]
Question 1 is compulsory, answer any 2 of the other 3 questions in this section
Question 1[15 marks]-[THIS QUESTION IS COMPULSORY]
A. In the C++ Standard Template Library, arrays and vectors are commonly used data structures. What is the key difference between arrays and vectors?
[1 Mark]
B. Write a function called displayData() that accepts a vector of integers, this function should display to the screen the maximum value, minimum value and the average of the numbers in the vector.
[7 Marks]
C. A small number generator for primary school students requires you to write a C++ function that takes an integer as input and determines whether it is even or odd. If the input is even, the function should display all even numbers from 0 to the input. If the input is odd, the function should display all odd numbers from 0 to the input.
Allow the user to call on the function up to 20 times, and each time store the integers provided in an array.
Your solution should show the call to the function and the return from the function in a small C++ program. When the user is finished the program should display all of the integers provided.
[7 Marks]
Question 2[15 marks]
A. Explain with examples the concepts of function overloading and function overriding within the context of object-oriented programming. [4 Marks]
B. Describe composition in the context of object-oriented programming.
[2 Marks]
C. Why is it common for a typical class in C++ to include public accessors (getters) and mutators (setters) functions? [2 Marks]
D. Given the following UML Class Diagram, write the class declaration and definition code. [7 marks]
\table[[Player],[\table[[-name : string],[-age : int],[-score : int]]],[\table[[+player()],[+player(n: string, a : int
SECTION B [ 4 5 Marks ] Question 1 is compulsory,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!