Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

interview questions

 
Ayub ali khan
Ranch Hand
Posts: 394
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would appreciate if some one could answer the following questions:

How to calculate the maximum amount of memory that can be allocated to a program?

Different between Array and ArrayList?

How to avoid memory leaks?

Write a program to find the number of times a number is repeated ? eg: {1,2,3,1,1,3}

should return 1 repeated 3 times
2 once and 3 twice. What type of data structure can be used in this scenario?

Thanks in advance.
 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do read Some stuff. go thorough documentation for Java .. you would get answer to all these questions..search in google..

No fun in getting answers readymade. right?
 
Ayub ali khan
Ranch Hand
Posts: 394
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Anupam. I will do that
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Different between Array and ArrayList?

Is that:
1. "array"
2. java.lang.reflect.Array
3. java.sql.Array
4. java.util.Arrays
 
Praveena Jayanthi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q)How to calculate the maximum amount of memory that can be allocated to a program?

java -Xms32m -Xmx128m MyProgram

where 32m is minimum and 128m is maximum

Q)Different between Array and ArrayList

Ans. The ArrayList is a resizeable arrays. In arrays you cannot change the length of arrays once declared.

Q)How to avoid memory leaks

Memory leaks occur due to incomplete deallocation of memory. It could be avoided by deallocating the object references as soon as possible in a program.
 
Ayub ali khan
Ranch Hand
Posts: 394
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Praveena and all others who have answered.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic