1. (TCO 2) Given the declaration: class myClass { public: void print(); int y; private: int x; }; myClass myObject; which statement is legal? (Points : 4) myObject.x = 10; myClass.x = 10; myObject.y = 10; myClass.y = 10; 2. (TCO 2) If a member of a class is _____, you cannot access it outside the class. (Points : 4) public automatic private static 3. (TCO 2) Given: bool clockType::equalTime(const clockType&) const {…} void clockType::getTime(int&, int&, int&) const {…} The word _____ at the end of the member functions in the class clockType specifies that these functions cannot modify the member variables of a clockType object. (Points : 4) void const clockType:: & 4. (TCO 2) A class and its members can be described graphically using a notation known as the _____ notation. (Points : 4) OON OOD UML OOP 5. (TCO 2) Consider the following class definition. class rectangleType { public: void setLengthWidth(double x, double y); //Postcondition: length = x; width = y; void print() const; //Output length and width; double area(); //Calculate and return the area of the rectangle; double perimeter(); //Calculate and return the parameter; rectangleType(); //Postcondition: length = 0; width = 0; rectangleType(double x, double y); //Postcondition: length = x; width = y; private: double length; double width; }; and the declaration rectangleType bigRect; Which of the following statements is correct? (Points : 4) rectangleType.print(); rectangleType::print(); bigRect.print(); bigRect::print(); 6. (TCO 3) Composition is when one or more members of a class are accessed by member functions of the same class. objects of another class type. defined in a separate file. created in a class tester program. 7. (TCO 8) Which preprocessor directive essentially inserts another file into your source file? ifndef define include fstream 8. (TCO 8) Which is a correct preprocessor directive statement? define PI = 3.141593 define PI = 3.141593; #define PI 3.141593 #define PI = 3.141593 9. (TCO 8) What is the namespace commonly used with ? std standard .h cin and cout 10.Which preprocessor directive is not used for conditional compilation? define ifndef ifdef endif



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *