Computer Science | Kent State University



Multiple Choices:

1. OOP is the name given to a specific paradigm in the field of programming. What is OOP stand for?

a. Option-Orient Programming

b. Object-Open Programming

c. Object-Orient Programming

d. Open-Orient Programming

ANSWER: C

2. Five tenets of object-orient programming are Encapsulation, Data Abstraction, Information Hiding, Inheritance, and ______________.

a. Polymorphism

b. Polyphony

c. Polynomial

d. Paradigm

ANSWER: A

3. Which of following its goal is to bind data and the functions that operate on that data together in one “object”?

a. Emulation

b. Enantiomorphism

c. Enactment

d. Encapsulation

ANSWER: D

4. Which of following its goal is to force users interface with the object’s function rather than accessing data directly?

a. Information Hiding

b. Inheritance

c. Data Abstraction

d. Encapsulation

ANSWER: C

5. Polymorphism is refer to the ability to associate multiple meaning to one function name by means of a special mechanism known as “______________”.

a. Late Binding

b. Line Binding

c. Long Binding

d. Low Binding

ANSWER: A

6. When defining a class, the class should be composed of the kind of values a variable of the class can contain, and

a. member functions for that class

b. the keyword private

c. other class definitions

d. nothing else

ANSWER: A

7. What is one of OOP tenets that is to prevent the user from seeing how our functions are implemented exactly what they do?

a. Encapsulation

b. Data Abstraction

c. Information Hiding

d. Inheritance

ANSWER: C

8. Which of the following is the correct function definition header for the push function which is a member of the IntStack class?

a. int push (int x );

b. int push( int x )

c. int IntStack:push( int x )

d. int IntStack::push( int x )

ANSWER: D

9. Which of following is not the reason when you want to make data members private in a class?

a. no one can use the class.

b. ensure data integrity

c. provide data abstraction.

d. provide information hiding.

ANSWER: A

10. Data members or member functions of a class that are declared to be private may

a. only be accessed by the main program

b. only be accessed by members of the class

c. not be accessed by the class

d. are considered to be global variables

ANSWER: B

11. In a class, all members are ____________ by default

a. public

b. private

c. global

d. protect

ANSWER: B

12. Data members or member functions of a class can be declared as public, private, and _________ for Inheritance mechanism in C++ for object-orient programming.

a. provide

b. project

c. protect

d. propend

ANSWER: C

13. What is a major stepping stone on the path to polymorphism?

a. Data Abstraction

b. Inheritance

c. Encapsulation

d. Information Hiding

ANSWER: B

14. A member function of a class should be made private

a. always

b. only if it will never be used

c. if it will only be used by other members of the class

d. never, it is illegal to make a member function private.

ANSWER: C

15. A class member function that automatically initializes the data members of a class is called

a. the init function

b. an operator

c. a constructor

d. a cast

ANSWER: C

16. If you have a class named myPersonClass, which of the following correctly declare a constructor in the class definition?

a. myPersonClass::myPersonClass();

b. myPersonClass();

c. init();

d. cast();

ANSWER: B

17. Given the following class definition, what is missing?

class ItemClass

{

public:

ItemClass(int newSize, float newCost);

int getSize();

float getCost();

void setSize(int newSize);

void setCost(float newCost);

private:

int size;

float cost;

};

a. nothing

b. a default constructor

c. accessor functions

d. mutator functions

ANSWER: B

18. Given the following class definition, how would you declare an object of the class, so that the object automatically called the default constructor?

class ItemClass

{

public:

ItemClass();

ItemClass(int newSize, float newCost);

int getSize();

float getCost();

void setSize(int newSize);

void setCost(float newCost);

private:

int size;

float cost;

};

a. ItemClass() myItem;

b. ItemClass myItem(1, 0.0);

c. ItemClass myItem;

d. ItemClass myItem();

ANSWER: C

19. Given the following class, what would be the best declaration for a constructor that would allow the user to initialize the object with an initial age and cost?

class Wine

{

public:

Wine();

int getAge();

float getCost();

private:

int age;

float cost;

}

a. int getAge(int newAge);

b. Wine();

c. Wine(int age);

d. Wine(int newAge, float newCost);

ANSWER: D

20. Variable of data type (class or struct) is called?

a. Instance

b. Member

c. Object

d. Message

ANSWER: C

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download