Interview Questions and Answers - Order By Newest Q61. What is the access time for ArrayList and LinkedList ? Data Structure
Ans. O(1) for ArrayList
O(n) for LinkedList Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 2 Companies Ans. == compares values === is used in scripting languages for comparing two values as well as there data tpe. like in js,php. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  ==  ===  == vs === Asked in 13 Companies basic   frequent Q63. How to sort objects based on one of the field ? Core Java
Ans. Using comparable and comparator and sorted collections like TreeSet or TreeMap.
or
use stream api from java 8 onwards which internally refers to comparable and comparator through lambda expressions Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sort  sorting  comprator  comparable  treeset  treemap  sorting collections Asked in 1 Companies Basic   frequent Q64. Where to use interface and abstract class ? Core Java
This question was recently asked at 'Exterro,Equator Business Solutions'.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. Route 53 Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  AWS DNS  aws Route 53 Asked in 4 Companies Ans. Cname doesn't support naked domain names whereas aliasis does. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  aws route53 Asked in 3 Companies Q67. How to write an iterator for an iterator of iterators? Core Java
Ans. CustomArrayList myarrayList = new CustomArrayList();
myarrayList.add("Value 1");
myarrayList.add("Value 2");
myarrayList.add("Value 3");
for (String string : myarrayList) {
System.out.println(string);
}
package sample.utils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class CustomArrayList implements Iterable {
private ArrayList mylist = new ArrayList();
public void add(T t) {
this.mylist.add(t);
}
@Override
public Iterator iterator() {
return new CustomIterator(mylist);
}
class CustomIterator implements Iterator {
private int indexPosition = 0;
private List internalList;
public CustomIterator(List internalList) {
this.internalList = internalList;
}
@Override
public boolean hasNext() {
if (internalList.size() >= indexPosition 1) {
return true;
}
return false;
}
@Override
public E next() {
E val = internalList.get(indexPosition);
indexPosition ;
return val;
}
}
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  iterator Asked in 1 Companies Q68. How many heaps will be there with 3 threads ? Core Java
Ans. All threads share a common heap.
Each thread has a private stack, which it can quickly add and remove items from. This makes stack based memory fast, but if you use too much stack memory, as occurs in infinite recursion, you will get a stack overflow. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  memory management  heap memory Asked in 1 Companies Ans. SNMP or Simple Network Management protocol is an application layer protocol for exchanging management information between network devices.
Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 15 Companies Q70. Which of the following is true for == operator ? Core Java
a. For primitives, == checks if the variables on left and right have same data type b. For primitives, == checks if the variables on left and right have same value c. For Objects, == checks if the references on left and right have same data type d. For Objects, == checks if the references on left and right have same valueAns.b. For primitives, == checks if the variables on left and right have same value
Q71. Which of the following is equivalent to following logic ?
Not X && Not Y Core Java
a. x || Y b. Not(X || Y) c. Not(X && Y) d. Not X && YAns.b. Not(X || Y)