amol0010
10-28-2009, 09:55 PM
hey..
I am reading up on a test and it has the following questions:
I. Multiple Choice. For questions 1..6 choose the single best answer from the list below. Any answer may be used as many times as needed. Each question refers to the three sections commonly found in a complete program involving a single user defined class. Assume all member functions in the class are public and that all member data is private. Assume further that all member functions and friend functions have function prototypes in the header section. There is no static member data, nor static member functions.
(A) header section only
(B) implementation section only
(C) client section only
(D) header and implementation sections only
(E) header and client sections only
(F) implementation and client sections only
(G) all three sections
(H) none of the three sections
1. Which cannot access the member data directly.
2. Which can contain the reserved word "friend".
3. Which typically consists almost entirely of function definitions.
4. Which will always contain the scope resolution operator (::).
5. Which may sometimes require the use of the reserved word "this".
6. Which may call a member function.
I am guessing this is what the above means - I am not exactly on what the the terms - header, implementation and client section
header is the stuff in the .h file. Implementation is all the stuff after private: and client is all the stuff after public:
My answers are:
1. C
2. D
3. B
4. ?
5. B
6. F
II. True or False. Place T or F in the space provided. As we discussed only public and private access, these questions ignore the possibility of protected.
1. Friend functions may be public or private.
2. Member functions may be public or private.
3. Member data may be public or private.
4. A thrown exception might terminate a program.
5. Static member data may be initialized before the instantiation of any objects.
6. Static member data may be public or private.
7. A thrown exception may be handled locally in the same environment in which it was thrown.
8. An unthrown exception has no effect on the execution of the program.
9. Private inheritance is most commonly used.
10. Each object has its own copy of the non-static member data, but there is only one copy of the static member data.
1. F
2. T
3. T
4. T
5. T
7. F
8. F
9. T
10. T
Please tell me if I am correct or wrong ?
I am reading up on a test and it has the following questions:
I. Multiple Choice. For questions 1..6 choose the single best answer from the list below. Any answer may be used as many times as needed. Each question refers to the three sections commonly found in a complete program involving a single user defined class. Assume all member functions in the class are public and that all member data is private. Assume further that all member functions and friend functions have function prototypes in the header section. There is no static member data, nor static member functions.
(A) header section only
(B) implementation section only
(C) client section only
(D) header and implementation sections only
(E) header and client sections only
(F) implementation and client sections only
(G) all three sections
(H) none of the three sections
1. Which cannot access the member data directly.
2. Which can contain the reserved word "friend".
3. Which typically consists almost entirely of function definitions.
4. Which will always contain the scope resolution operator (::).
5. Which may sometimes require the use of the reserved word "this".
6. Which may call a member function.
I am guessing this is what the above means - I am not exactly on what the the terms - header, implementation and client section
header is the stuff in the .h file. Implementation is all the stuff after private: and client is all the stuff after public:
My answers are:
1. C
2. D
3. B
4. ?
5. B
6. F
II. True or False. Place T or F in the space provided. As we discussed only public and private access, these questions ignore the possibility of protected.
1. Friend functions may be public or private.
2. Member functions may be public or private.
3. Member data may be public or private.
4. A thrown exception might terminate a program.
5. Static member data may be initialized before the instantiation of any objects.
6. Static member data may be public or private.
7. A thrown exception may be handled locally in the same environment in which it was thrown.
8. An unthrown exception has no effect on the execution of the program.
9. Private inheritance is most commonly used.
10. Each object has its own copy of the non-static member data, but there is only one copy of the static member data.
1. F
2. T
3. T
4. T
5. T
7. F
8. F
9. T
10. T
Please tell me if I am correct or wrong ?