OOPortal OOPortal


OO Encapsulation  «Prev  Next»

OOP and Encapsulation - Quiz

Each question is worth one point. Select the best answer for each question
 
1. The keyword private restricts the access of class or struct members to:
Please select the best answer.
  A. const functions
  B. static functions
  C. member functions
  D. clients

2. What is the difference between an object and a class?
Please select the best answer.
  A. An object is an extension of the class construct whose default access privilege is public.
  B. The term object is just another way of referring to the public data members of a class.
  C. An object is an initialized class variable.
  D. A class is an initialized object variable.

3. If we have
class card {
public:
   int s;
};

card a;
card* p;
we can use _________ to access int s:
Please select the best answer.
  A. p.s
  B. a.s
  C. p -> int
  D. a -> s


4. In object-oriented software design, there is at least one extra step before you get to the coding of algorithms. That step is the design of:
Please select the best answer.
  A. classes that are appropriate for the problem at hand
  B. member functions
  C. program control flow
  D. the class's interface

5. An interface in C++ is a
Please select the best answer.
  A. program that allows easy conversion of another program's data
  B. list of argument types in a function's parameter list
  C. library for performing input and output
  D. class's public members

6. What is the difference between a struct and a class in C++?
Please select the best answer.
  A. A struct cannot have member functions.
  B. A class has a default privacy specification of public.
  C. A class has a default privacy specification of private.
  D. A struct cannot have private members.

7. An object is _____________ of a class.
Please select the best answer.
  A. an instance
  B. an interface
  C. an encapsulation
  D. a member function
Score =
Correct answers: