Question: Write the letter A, B, C, or D in your answer sheet to indicate your correct answer. 1. Encapsulation provides A) inheritance B) information hiding

Write the letter A, B, C, or D in your answer sheet to indicate your correct answer.

1. Encapsulation provides

A) inheritance B) information hiding C) polymorphism D) none of the above

2. In Java, a class can contain several constructors

A) Yes B) No

3. How many instances of class C create the following code?

C x, u, v;

x = new C();

C y = x; C z = new C();

A) None B) Five C) Three D) Two

4. If there is at least one constructor with parameters and no constructor without parameters then the default constructor is always accessible?

A) Yes B) No

5. A class variable that is common to all instances of the class must be declared

A) private B) static C) final D) protected

6. In Java, a class can inherit from several parent classes at the same time?

A) Yes, since version 1.4

B) Yes, since version 5.0

C) No, unlike C++ D) Yes

7. Which statement is correct about interfaces in Java?

A) The interface is used to achieve multiple inheritance in Java

B) The object of an interface cannot be created

C) An interface can inherit another interface

D) All these statements are true

8. An object of which class is used to compile regular expressions?

A) Pattern class

B) Matcher class

C) PatternSyntaxException

D) None of the above

9. We cannot create instances of a __________________?

A) Anonymous class

B) Nested class

C) Parent class

D) Abstract class

10. We cannot inherit from a ___________________ ? A) Abstract class

B) Final class

C) Subclass

D) Inner class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!