Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a) Examine the following class declaration: class DateType { public: void Initialize(int, int, int); int YearIs() const; // returns year int MonthIs() const; // returns

a) Examine the following class declaration:

class DateType

{

public:

void Initialize(int, int, int);

int YearIs() const; // returns year

int MonthIs() const; // returns month

int DayIs() const; // returns day

private:

int year;

int month;

int day;

};

i) Which of the following statements in a client program correctly prints out the year of the variable day1 of type DateType?

A. cout << day1.YearIs;

B. cout << YearIs(day1);

C. cout << YearIs.day1;

D. cout << day1.YearIs();

E. The year cannot be printed by a client program.

----------------

ii) Which of the following statements in a client program correctly initializes a variable day1 of type DateType to 10/12/90?

A. Initialize(10,12,90);

B. day1.month = 10;

day1.day = 12;

day1.year = 90;

C. day1.Initialize(10,12,90);

D. cin>>month>>day>>year;

E. The client program cannot initialize the date.

---------------

b) The members of a class are public by default.

A) True

B) False

-----------------

c) The member variables and functions declared following the word __(1)___ are accessible only to the class's member functions, while those declared following the word __(2)___ are accessible to the client program.

1.

A. public

B. private

2.

A. public

B. private

-----------

d) Fill in the first and second line (see comments) in the following function (use the specification given with this exam, if needed).

void UnsortedType::InsertItem(ItemType item)

// Post: item is in the list.

{

info[length] = ____________ ; //first line

______________ ; //second line

}

e) Describe what information hiding means.

f) Describe why we use header files, implementation files, and specification files. Include what each file contains.

g) Use a typedef statement to declare twoDimType, which is a two dimensional array with 10 rows and 25 columns. Then define a variable, Table1, of type twoDimType.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming Languages 12th International Symposium Dbpl 2009 Lyon France August 2009 Proceedings Lncs 5708

Authors: Philippa Gardner ,Floris Geerts

2009th Edition

3642037925, 978-3642037924

More Books

Students also viewed these Databases questions

Question

please dont use chat gpt 1 7 4 .

Answered: 1 week ago

Question

1. Why do we create anything?

Answered: 1 week ago