Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers for 'Compro technologies' - 12 question(s) found - Order By Newest | ||||
Frequently asked in all types of companies especially Indian Services companies. Frequently asked in CTS (Based on 2 feedback) | ||||
| ||||
Ans. Hashcode is used for bucketing in Hash implementations like HashMap, HashTable, HashSet etc. The value received from hashcode() is used as bucket number for storing elements. This bucket number is the address of the element inside the set/map. when you do contains() then it will take the hashcode of the element, then look for the bucket where hashcode points to and if more than 1 element is found in the same bucket (multiple objects can have the same hashcode) then it uses the equals() method to evaluate if object are equal, and then decide if contain() is true or false, or decide if element could be added in the set or not. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   collections   hashcode   advanced  hashtable Asked in 33 Companies intermediate   frequent | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. It is the process of examining / modifying the behaviour of an object at runtime. | ||||
Sample Code for reflection | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   reflection   reflection api   ebay   mindtree Asked in 29 Companies basic   frequent | ||||
| ||||
This question was recently asked at 'Myntra,Compro Technologies'.This question is still unanswered. Can you please provide an answer. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 2 Companies | ||||
| ||||
Ans. First Find the number of nodes in the linked list and take it as n.then find the data at n-3 element. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  linkedlist Asked in 1 Companies | ||||
| ||||
Ans. Destructor is used to de-allocate memory allocated by objects. There are no destructors in Java. Alternatively, Java provides Automatic garbage collection i.e automatically releasing the un-referenced memory. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  destructor  garbage collection Asked in 11 Companies Basic   frequent | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. public class BuggyBread { public static void main(String args[]) { Map<Character, Integer> countMap = new HashMap(); String str = "hello world"; for (char character : str.toCharArray()) { if (countMap.containsKey(character)) { countMap.put(character, countMap.get(character) + 1); } else { countMap.put(character, 1); } } System.out.println(countMap); } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  String  Code  Coding  Character Asked in 1 Companies | ||||
| ||||
This question was recently asked at 'Compro Technologies'.This question is still unanswered. Can you please provide an answer. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  code.coding.0 and cross game Asked in 1 Companies | ||||
| ||||
Ans. import java.util.*; class LinkedListSolution{ protected LinkedList list; public LinkedListSolution(){ list = new LinkedList(); } public Object pop() throws NoSuchElementException{ if(list.isEmpty()) throw new NoSuchElementException(); else return list.removeFirst(); } public void push(Object obj){ list.addFirst(obj); } public Object peek() throws NoSuchElementException{ if(list.isEmpty()) throw new NoSuchElementException(); else return list.getFirst(); } public boolean isEmpty(){ return list.isEmpty(); } public String toString(){ return list.toString(); } } class TestStack{ public static void main(String args[]){ LinkedListSolution s = new LinkedListSolution(); s.push("First"); s.push("Second"); s.push("Third"); System.out.println("Top: " s.peek()); s.push("Fourth"); while(!(s.isEmpty())) System.out.println(s.pop()); } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Linkedlist  data structures  algorithm Asked in 2 Companies basic | ||||
| ||||
Ans. Number 1 - Fill the 5 litre can from the tap Empty the 5 litre can into the 3 litre can leaving 2 litres in the 5 litre can. Pour away the contents of the 3 litre can.Fill the 3 litre can with the 2 litres from the 5 litre can leaving 2 litres in the 3 litre can. Fill the 5 litre can from the tap.Fill the remaining 1 litre space in the 3 litre can from the 5 litre can.Leaving 4 litres in the 5 litre can. Number 2 - Fill the 3 litre can from the tap.Empty the contents of the 3 litre can into the 5 litre can. Fill the 3 litre can from the tap.Empty the contents of the 3 litre can into the 5 litre can leaving the 5 litre can full and 1 litre in the 3 litre can. Pour away the contents of the 5 litre can. Pour the 1 litre from the 3 litre can into the 5 litre can. Fill the 3 litre can from the tap. Empty the contents of the 3 litre can into the 5 litre can leaving 4 litres in the 5 litre can. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 1 Companies | ||||
| ||||
Ans. Garbage collection mechanism frees up the memory that is no longer needed. In languages like C / C++ the deallocation needs to be done explicitly by the programmer and hence any leniency may result in memory leak. Garbage collection in java ensures that all unused memory is reclaimed and hence there are no memory leaks.Moreover it relieves the programmer from the hassle of carefully releasing all memory. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Garbage Collection  memory management Asked in 2 Companies | ||||
| ||||
Ans. We can merge two sorted array by using quick sort algorithm | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  arrays  merge sorted arrays Asked in 2 Companies | ||||
| ||||
This question was recently asked at 'Compro Technologies'.This question is still unanswered. Can you please provide an answer. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 1 Companies | ||||