3i Infotech Papers: Sample Questions 1232 - 1233 of 1245

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

Question number: 1232

» Languages » Java

Appeared in Year: 2004

MCQ▾

Question

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

Choices

Choice (4) Response

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)

Question number: 1233

» Basic CS » Algorithms

MCQ▾

Question

Which of the following sorting algorithms has average sorting behaviour?

Choices

Choice (4) Response

a.

Bubble sort

b.

Merge sort

c.

Heap sort

d.

Quick sort

Answer

d.

Explanation

  • The quick sort uses divide and conquer to gain the same advantages as the merge sort, while not using additional storage.

  • In the merge sort it is possible that the list may not be divided in half which could cause the performance to be diminished.

  • A quick sort first selects a value called the pivot value- among the many ways one can simply use the first item in the list.

  • Pivot value assists with splitting the list- actual position of pivot in the final sorted list- called the split point- divides the list for subsequent calls to the quick sort.

  • Let us understand with an example.

Example of quick sort:

Example of quick sort

Example of Quick Sort

Example of quick sort