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


Write in Short

Short Answer▾

Size of operator is executed during________


  • 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


Describe in Detail


What are the advantages of inheritance?


  • 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



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


Choice (4)


Get Servlet Config ()


Get Servlet Info ()


Get Init Parameters ()


None of the above




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: