Quiz


1.  

What is encapsulation?

encapsulation is a technique of linking together attributes and procedures to form an object.

2.  

What is the benefit of using encapsulation?

encapsulation enables a programmer to institute checks and balances by placing attributes and procedures in a class and then defining rules in the class to control its access.

3.  

What is an access specifier ?

an access specifier is a programming language keyword that tells the computer what part of the application can access data and functions/methods defined within the access specifier.

4.  

What is a public access specifier?

the public access specifier determines attributes and procedures that are accessible by using an instance of the class.

5.  

What is a private access specifier?

the private access specifier identifies attributes and procedures that are only accessible by a procedure that is defined by the class.

6.  

What is a protected access specifier?

the protected access specifier stipulates attributes and procedures that can be inherited and used by another class.

7.  

What portions of a super class can be used by a subclass?

a subclass inherits public and protected portions of the super class.

8.  

How are access specifiers used differently in Java and C++?

in c++, access specifiers define a section of a class that contains attributes and member functions. in java, each attribute and member method contains the access specifier.

9.  

Can a super class access portions of a subclass?

a super class cannot access any portion of a subclass.

10.  

Why do programmers require that some attributes of a class be accessed only by a member procedure?

programmers require that some attributes of a class be accessed only by a member procedure in order to validate values assigned to attributes. a programmer who wants access to some attributes calls a member procedure, which applies any validation rules before assigning values to attributes.

Answers

1.  

Encapsulation is a technique of linking together attributes and procedures to form an object.

2.  

Encapsulation enables a programmer to institute checks and balances by placing attributes and procedures in a class and then defining rules in the class to control its access.

3.  

An access specifier is a programming language keyword that tells the computer what part of the application can access data and functions/ methods defined within the access specifier.

4.  

The public access specifier determines attributes and procedures that are accessible by using an instance of the class.

5.  

The private access specifier identifies attributes and procedures that are only accessible by a procedure that is defined by the class.

6.  

The protected access specifier stipulates attributes and procedures that can be inherited and used by another class.

7.  

A subclass inherits public and protected portions of the super class.

8.  

In C++, access specifiers define a section of a class that contains attributes and member functions. In Java, each attribute and member method contains the access specifier.

9.  

A super class cannot access any portion of a subclass.

10.  

Programmers require that some attributes of a class be accessed only by a member procedure in order to validate values assigned to attributes. A programmer who wants access to some attributes calls a member procedure, which applies any validation rules before assigning values to attributes.




OOP Demystified
OOP Demystified
ISBN: 0072253630
EAN: 2147483647
Year: 2006
Pages: 130

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net