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 - Order By Newest | |||||||||||
| |||||||||||
Ans. list.get(index); | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  list Asked in 1 Companies | |||||||||||
| |||||||||||
This question was recently asked at 'adobe'.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  vector  collections  list Asked in 1 Companies | |||||||||||
| |||||||||||
Ans. No,we cannot.I t will give concurrentModificationExceptin error. It can be resolved by using ConcurrentClasses like ConcurrentHashMap,CopyOnWriteArrayList,BlockingQueue etc which are fail-safe and wont give exception. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  collections  list  iterator Asked in 1 Companies basic | |||||||||||
| |||||||||||
Ans. Arrays allows elements to be accessed directly using the index. As Array elements are stored in continuous memory locations it's very easy to find the memory address of any element using the formula as following Memory Address of Array start or index 0 + ( Size of array element * Index ) | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  arrays  linkedlist | |||||||||||
| |||||||||||
Ans. public class LinkedList { Node start = null; Node head = null; class Node { Integer body; Node nextNode; Node(Integer value) { body = value; } } public static void main(String[] args) { LinkedList ll = new LinkedList(); ll.addNodeToEnd(5); ll.addNodeToEnd(10); ll.addNodeToEnd(15); ll.traverse(); if(checkIfLoop(l1)){ System.out.println("There is a Loop"); } else { System.out.println("No Loop"); } } private boolean checkifLoop(Test l1) { Node slow = start; Node fast = start; Node faster = start; while(slow != null ) { fast = slow.nextNode; faster = fast.nextNode; if(slow == fast || slow == faster) { return true; } slow = slow.nextNode; } return false; } } Complexity of this algorithm is O(n) | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  LinkedList  Cyclic LinkedList | |||||||||||
| |||||||||||
This question was recently asked at 'Canopy Tax'.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  LinkedList Asked in 1 Companies | |||||||||||
| |||||||||||
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  arrays vs linkedlist | |||||||||||
| |||||||||||
Ans. Work with two pointers on the linked list - a slow pointer (increments by one node) and a fast pointer (increments by two nodes). If both of these pointers meet at the same node, then there is a cycle in the linked list. Otherwise, no cycle. | |||||||||||
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. List is an interface whereas ArrayList is an implementation of List. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  list  arraylist  list vs arraylist  difference between  collections Asked in 2 Companies basic | |||||||||||
| |||||||||||
Ans. Default size is 10. Regard how size will increase. Inside add() method there is one method called ensureCapacity() which will check list has enough size available. This ensureCapacity() method if found size of list need to increase then it will call grow() method which will create new list of extra size and copy existing list data to new one and return. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  list  default size of list Asked in 1 Companies | |||||||||||
| |||||||||||
Ans. ArrayList is a variable length collection class whereas arrays are fixed length primitive structure. We can use generics with arraylist but not with arrays. We can store primitive data types within arrays but can't with ArrayList. In ArrayList that needs to be converted to Wrapper objects. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  arraylist  arrays  collection classes  collections basic   frequent | |||||||||||
| |||||||||||
Ans. ArrayList is a list , i.e an implementation of List interface whereas HashSet is a Set and an implementation of Set interface. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  arraylist  hashset | |||||||||||
| |||||||||||
Ans. We can put the value in a set to enforce uniqueness and then dum those value into an arraylist. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  arraylist  design  collections | |||||||||||
| |||||||||||
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  observer   listener | |||||||||||
| |||||||||||
| |||||||||||