• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Few Questions from John Hunt's Mock Exam.

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the name of the method used to schedule a thread for execution?
init();
start();
run();
resume();
sleep();
What should be the answer...start() or run() ???
What is the effect of adding the sixth element to a vector created in the following manner:

new Vector(5, 10);
A.An IndexOutOfBounds exception is raised.
B.The vector grows in size to a capacity of 10 elements
C.The vector grows in size to a capacity of 15 elements
D.Nothing, the vector will have grown when the fifth element was added
The answer given is C......But I feel it should be B.
Thanks & Regards.
sonkalp@yahoo.com
 
Gene Ehli
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The constructor used to create the vector is:
public Vector(int initialCapacity, int capacityIncrement)
So the vectors new size would be the initialCapacity + capacityIncrement. In this problem it was constructed with Vector(5, 10), 5 + 10 = 15, so C is the correct answer.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic