Instructions
1. Attempt all questions.
2. Copy/Cheating is STRICTLY PROHIBITED. If anyone caught doing cheating simply whole
assignment will be canceled.
3. You can discuss assignment questions with other students but write your OWN code. Don’t
share your code with anyone.
4. Late submission will cause 50% deduction of marks.
5. Best of luck
struct Product
};
Question # 1 Write a definition for an array of 100 Product structures. Do not initialize the array.
Question # 2 Write a loop that will step through the entire array you defined in Question 11.4, setting
all the product descriptions to an empty string, all part numbers to zero, and all costs to zero.
Question # 3 Write the statements that will store the following data in the first element of the array
you defined in Question 1:
Question # 4 Write a loop that will display the contents of the entire array you created in Question 1.
struct Rectangle
int length;
int width;
};
Question # 5 Write a function that accepts a Rectangle structure as its argument and displays the
structure’s contents on the screen.
Question # 6 Write a function that uses a Rectangle structure reference variable as its parameter
and stores the user’s input in the structure’s members
Question # 7 Write a function that returns a Rectangle structure. The function should store the
user’s input in the members of the structure before returning it.
rptr->width
A) *rptr.width
B) (*rptr).width
C) rptr.(*width)
Question # 11 An object’s private member variables are accessed from outside the object by
B) any function
class Date
private:
public:
Question # 14 What is constructer and destructor? When they are called? Why can’t we have more
than one default constructer and a destructor? Write the purpose of destructor.
Design a class that has an array of floating-point numbers. The constructor should accept an integer
argument and dynamically allocate the array to hold that many numbers. The destructor should free the
memory held by the array. In addition, there should be member functions to perform the following
operations: