3i Infotech Papers: Sample Questions 1104 - 1105 of 1245

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 1104

» Languages » Java

Essay Question▾

Describe in Detail

What is inheritance?

Explanation

Image shows the class

Image Shows the Class

Image shows the class

  • Deriving an object from an existing class is inheritance

  • Inheritance is the process of inheriting all the features from a class.

  • A class derived from another class is called a subclass, whereas the class from which a subclass is derived is called a superclass.

  • A subclass can have only one superclass, whereas a superclass may have one or more subclasses.

  • A subclass inherits the characteristics (properties and methods) of its superclass.

  • A vehicle is a superclass and a car is a subclass.

  • The car inherits all of the vehicle’s properties.

  • The inheritance mechanism is very useful in code reuse.

Question number: 1105

» Languages » Java

Appeared in Year: 2004

MCQ▾

Question

Stateless session bean is instantiated by

Choices

Choice (4) Response

a.

Create ()

b.

New Instance ()

c.

None of the above

d.

All of the above

Answer

a.

Explanation

When an instance transits from non-exist state to method ready pool three operations are performed:

  • Bean instance is instantiated by invoking the class. new Instance () method on stateless session bean.

  • In stateless session beans calling create () method results in creating EJB object for the client.

  • Ejb Create () of a stateless bean is invoked once in the life cycle of a particular instance.