Languages-Java [3i Infotech Placement]: Sample Questions 79 - 81 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 79

Appeared in Year: 2004

Question

MCQ▾

Which is the data structure used to store sorted map elements?

Choices

Choice (4)

a.

Hash map

b.

Map

c.

Hash Set

d.

Tree Map

Answer

d.

Explanation

Understanding the Node of Treemap
  • Tree map Data structure is used to store the sorted map elements.
  • Tree Map is used to store unique elements in a sorted order.
  • Java. util. Tree Map uses a red-black tree in the background to ensure there are no duplicates and also maintains the elements in a sorted order.

Tree Map h map new Tree Map

Tree Map based implementation can solve the search problem with slightly more time complexity O (nLogn) compared to other algorithms with O (n) complexity.

Question 80

Edit

Write in Short

Short Answer▾

What is the layout for toolbar?

Explanation

  • Toolbar provides users with common used features of application.
  • Placed directly below the menu bars at the top of a frame.
  • Acts as a container for other components including button, combo box and menu.
  • A menu is a group of commands located in a menu bar- has buttons providing common commands in the application.

Question 81

Question

MCQ▾

A Vector is declared as follows. What happens if the code tried to add 6th element to this Vector new vector

Choices

Choice (4)

a.

Array Index Out Of Bounds Exception

b.

The element will be successfully added

c.

The Vector allocates space to accommodate up to elements

d.

Question does not provide sufficient data or is vague

Answer

b.

Explanation

  • The 1st argument in the constructor is the initial size of Vector.
  • The 2nd argument in the constructor is the growth in size.
  • This Vector is created with elements and when an extra element 6th is added, the vector automatically grows in size by

Developed by: