Languages-Java [3i Infotech Placement]: Sample Questions 136 - 138 of 141

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 136

Edit

Write in Short

Short Answer▾

Size of operator is executed during________

Explanation

  • Size of is a used operator in the C programming language.
  • It is a compile time unary operator which can be used to compute the sizeof its operand.
  • The result of sizeof is of unsigned integral type which is usually denoted by size_t.
  • Size of can be applied to any data-type, including primitive types as an integer and floating-point types, pointer types.

Question 137

Edit

Describe in Detail

Essay▾

What are the advantages of inheritance?

Explanation

  • Reusability of code and accessibility of variables and methods of the superclass by subclasses.
  • The most frequent use of inheritance is for deriving classes using existing classes, which provides reusability.
  • Reusability -
    • Facility to use public methods of base class without rewriting the same.
  • Extensibility -
    • Extending the base class logic in derived class.
  • Data hiding -
    • Base class can keep some data private to prevent alteration by derived class
  • Overriding -
    • Inheritance can override methods of the base class so meaningful implementation can be designed in the derived class.

Question 138

Appeared in Year: 2004

Question

MCQ▾

In the init (ServletConfig) method of Servlet life cycle, what method can be used to access the ServletConfig object?

Choices

Choice (4)

a.

Get Servlet Config ()

b.

Get Servlet Info ()

c.

Get Init Parameters ()

d.

None of the above

Answer

a.

Explanation

Public servletconfig getservletconfig () .

  • Returns a servletconfig object, with initialization and startup parameters for this servlet.
  • ServletConfig object was passed to the init method.
  • Interface implementations are responsible for storing the ServletConfig object so that this method can return it.
  • GenericServlet class is compliant.
  • Returns:
    • The ServletConfig object that initializes this servlet
    • See Also:
  • Init (javax. servlet. Servlet Config)

Developed by: