BCS230 Final

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

42) If you do not furnish a(n) ________ for a class, a default will be provided for you by the compiler.

- copy constructor - constructor - assignment operator

58) In an inheritance situation, the new class that you create from an existing class is known as the

- derived class. - child class.

56) To dereference an object pointer and access one of the object's members, use the

-> operator.

4) The ________ operator may be used to assign one object to another.

=

66) In the statement class Car:protected Vehicle, what is being protected?

Base class members

65) In the statement class Car:protected Vehicle, which is the derived class?

Car

10) True/False: If you overload the prefix ++ operator, the postfix ++ operator is automatically overloaded also.

FALSE

13) True/False: If a function f is a friend of a class A, and the class A is a friend of a class B, then the function f is able to access private members of B.

FALSE

14) True/False: C++ permits you to overload the sizeof operator.

FALSE

19) True/False: When you overload the << operator, you must also overload the >> operator

FALSE

20) True/False: You can overload the conditional operator to make it function as an unconditional operator.

FALSE

26) True/False: In an inheritance situation, you can't pass arguments to a base class constructor.

FALSE

3) True/False: When a class declares an entire class as its friend, the friendship status is reciprocal. That is, each class's member functions have free access to the other's private members.

FALSE

30) True/False: A member function of a derived class may not have the same name as a member function of a base class.

FALSE

31) True/False: A derived class may not have any classes derived from it.

FALSE

46) True/False: You may overload any C++ operator, and you may use the operator function to define non-standard operators, such as @ and ^.

FALSE

50) True/False: In C++, if you overload the < operator, you must also overload the > operator.

FALSE

52) True/False: A static member function cannot be called if no objects of the class exist.

FALSE

54) True/False: The this pointer is automatically passed to static member functions of a class.

FALSE

21) ________ allows us to create new classes based on existing classes.

Inheritance

64) ________ is commonly used to extend a class, or to give it additional capabilities.

Inheritance

29) Arguments are passed to the base class destructor function by the ________ class ________ function. A) derived, constructor B) derived, destructor C) base, constructor D) base, destructor E) None of the above

None of the above

24) ________ members of a base class are never accessible to a derived class.

Private

15) True/False: A static member variable can be used when there are no objects of the class in existence.

TRUE

27) True/False: A derived class may become a base class, if another class is derived from it.

TRUE

32) True/False: Some C++ operators cannot be overloaded by the programmer.

TRUE

34) True/False: If an rvalue reference refers to a memory location, that memory location becomes an lvalue.

TRUE

38) True/False: A static member function can be called independently of any object of the class.

TRUE

40) True/False: It is possible to declare an entire class as a friend of another class.

TRUE

47) True/False: The this pointer is a special built-in pointer that is automatically passed as a hidden argument to all instance member functions.

TRUE

5) True/False: By default, when an object is assigned to another, each member of one object is copied to its counterpart in the other object.

TRUE

51) True/False: When you overload an operator, you cannot change the number of operands taken by the operator.

TRUE

53) True/False: The structure member selector operator . cannot be overloaded.

TRUE

57) True/False: A constructor that takes a single parameter of a type other than its class is called a convert constructor.

TRUE

61) True/False: The base class access specification can be viewed as a filter that base class members must pass through when becoming inherited members of a derived class.

TRUE

63) True/False: When arguments must be passed to the base class constructor, they are passed from the derived class constructor's header line.

TRUE

67) True/False: A base class cannot contain a pointer to one of its derived classes.

TRUE

9) True/False: When a class contains a pointer to dynamically allocated memory, it a good idea to have the class overload the assignment operator.

TRUE

28) In the statement class Car:public Vehicle, which is the base class?

Vehicle

8) When a class contains a pointer to dynamically allocated memory, it is a good idea to equip the class with

a copy constructor.

55) When overloading the operator ++, ________ is used to distinguish preincrement from postincrement.

a dummy integer parameter

68) An lvalue is

a memory location that is associated with a name that can be used by different parts of the program to access the memory location.

6) C++ requires that a copy constructor's parameter be

a reference to an object.

69) An rvalue is

a temporary value that cannot be accessed from a different part of the program.

59) The base class's ________ affects the way its members are inherited by the derived class.

access specification

23) A situation in which every object of a class A has a pointer to an object of a class B, and the objects of the class B may outlive objects of class A, is called

aggregation.

70) A function object is

an object of a class that overloads the function call operator ().

35) A lambda expression is

an object of a class whose only member is the function call operator.

25) The ________ class constructor is called before the ________ class constructor.

base, derived

11) A good reason for overloading an operator is to enable it to

be used with types defined by the programmer.

22) When you derive a class from an existing class, you

can add both new data and new functions.

17) It is a good idea to make a copy constructor's parameters ________ by specifying the ________ keyword in the parameter list.

constant, const

41) A(n) ________ is a special function that is called whenever a new object is created and initialized with data from another object of the same class.

copy constructor

62) The ________ class destructor is called before the ________ class destructor.

derived, base

39) A ________ function is not a member of a class, but it has access to the private members of the class.

friend

48) Object composition is useful for creating a ________ relationship between classes.

has-a

1) Each object of a class has its own copy of the class's

instance member variables.

12) The process of having a class contain an instance of another class is known as

object composition.

44) To overload the + operator, you would write a function called

operator +.

7) C++ allows you to overload

operators and functions.

43) When you redefine the way a standard operator works when it is used with class objects, you have ________ the operator.

overloaded

49) An ________ operator can work with programmer-defined data types.

overloaded

16) If you do not furnish a(n) ________, an automatic memberwise copy will be performed when one object is assigned to another object.

overloaded assignment operator

60) Protected members of a base class are like ________, with the exception that they may be accessed by derived classes.

private members

18) A reason to overload the ________ is to write classes that have array-like behavior.

square brackets [ ]

2) A(n) ________ member variable may be accessed before any objects of the class have been declared.

static

36) If a member variable is declared ________, all objects of that class share access to that variable.

static

37) A member function that is declared ________ cannot use the this pointer.

static

45) The ________ is a special built-in pointer that is available to a class's instance member functions.

this pointer

33) The library function move() can be used to

transfer ownership of a managed object from one unique_ptr object to another.


संबंधित स्टडी सेट्स

Chapter 2: Organizations That Shape Public Health

View Set

Federal Tax Considerations for Life Insurance + Annuities

View Set

Consumer Behavior Test 3 Practice Test

View Set

Chapter 41: Management of Patients with Intestinal and Rectal Disorders

View Set

Auditing Chapter 7- Internal Control Mcgraw Hill questions

View Set

Honors English 10 Semester 2 Final

View Set

Concepts of Biology Chapter 3 Section 3.2

View Set

Google Chrome Keyboard Shortcuts

View Set

Cultural Anthropology: Chapter Five- Globalization and Culture Quiz

View Set