Filters
Question type

Study Flashcards

A member function of a class that only accesses the value(s) of the data member(s) is called a(n) ____ function.


A) accessor
B) mutator
C) constructor
D) destructor

Correct Answer

verifed

verified

Given this declaration: class myClass { public: void print(); //Output the value of x; MyClass(); private: int x; }; myClass myObject; The following statement is legal. myObject.x = 10;

Correct Answer

verifed

verified

  -Consider the UML class diagram shown in the accompanying figure. Which of the following is the name of the class? A)  clock B)  clockType C)  Type D)  +clockType -Consider the UML class diagram shown in the accompanying figure. Which of the following is the name of the class?


A) clock
B) clockType
C) Type
D) +clockType

Correct Answer

verifed

verified

With ____________________ functions, the definitions of the member functions are placed in the implementations file.

Correct Answer

verifed

verified

A class object can be ____. That is, it can be created once, when the control reaches its declaration, and destroyed when the program terminates.


A) static
B) automatic
C) local
D) public

Correct Answer

verifed

verified

If a member of a class is ____, you cannot access it outside the class.


A) public
B) automatic
C) private
D) static

Correct Answer

verifed

verified

A ____ sign in front of a member name on a UML diagram indicates that this member is a public member.


A) +
B) -
C) #
D) $

Correct Answer

verifed

verified

A program or software that uses and manipulates the objects of a class is called a(n) ____________________ of that class.

Correct Answer

verifed

verified

  -Consider the accompanying class definition. Which of the following variable declarations is correct? A)  rectangle rectangleType; B)  class rectangleType rectangle; C)  rectangleType rectangle; D)  rectangle rectangleType.area; -Consider the accompanying class definition. Which of the following variable declarations is correct?


A) rectangle rectangleType;
B) class rectangleType rectangle;
C) rectangleType rectangle;
D) rectangle rectangleType.area;

Correct Answer

verifed

verified

In C++ terminology, a class object is the same as a class instance.

Correct Answer

verifed

verified

If a function of a class is static, it is declared in the class definition using the keyword static in its ____.


A) return type
B) parameters
C) heading
D) main function

Correct Answer

verifed

verified

The header file is also known as the ____________________.

Correct Answer

verifed

verified

interface ...

View Answer

In C++, you can pass a variable by reference and still prevent the function from changing its value by using the keyword ____ in the formal parameter declaration.


A) automatic
B) private
C) static
D) const

Correct Answer

verifed

verified

In C++, the ____ is called the member access operator.


A) .
B) ,
C) ::
D) #

Correct Answer

verifed

verified

A ____ sign in front of a member name on a UML diagram indicates that this member is a protected member.


A) +
B) -
C) #
D) $

Correct Answer

verifed

verified

A(n) ____________________ function of a class changes the values of the member variable(s) of the class.

Correct Answer

verifed

verified

  -Consider the accompanying class definition, and the object declaration: rectangleType bigRect(14,10) ; Which of the following statements is correct? A)  bigRect.setLengthWidth() ; B)  bigRect.setLengthWidth(3.0, 2.0) ; C)  bigRect.length = 2.0; D)  bigRect.length = bigRect.width; -Consider the accompanying class definition, and the object declaration: rectangleType bigRect(14,10) ; Which of the following statements is correct?


A) bigRect.setLengthWidth() ;
B) bigRect.setLengthWidth(3.0, 2.0) ;
C) bigRect.length = 2.0;
D) bigRect.length = bigRect.width;

Correct Answer

verifed

verified

If a class object is passed by ____________________, the contents of the member variables of the actual parameter are copied into the corresponding member variables of the formal parameter.

Correct Answer

verifed

verified

Which of the following is true about classes and structs?


A) By default, all members of a struct are public and all members of a class are private.
B) A struct variable is passed by value only, and a class variable is passed by reference only.
C) An assignment operator is allowed on class variables, but not on struct variables.
D) You cannot use the member access specifier private in a struct.

Correct Answer

verifed

verified

If an object is created in a user program, then the object can access both the public and private members of the class.

Correct Answer

verifed

verified

Showing 21 - 40 of 43

Related Exams

Show Answer