Saturday, 19 November 2016

test

Note from Cracking the coding Interview
How to improving Coding skills
These are the questions you actually want to know. Here are a few ideas of questions that are valuable to many candidates:
1. “How much of your day do you spend coding?”
2. “How many meetings do you have every week?”
3. “What is the ratio of testers to developers to product managers? What is the interaction like? How does project planning happen on the team?”


These questions are designed to demonstrate your deep knowledge of programming or technologies.

  1.  “I noticed that you use technology X. How do you handle problem Y?” 
  2. “Why did the product choose to use the X protocol over the Y protocol? I know it has bene!ts like A, B, C, but many companies choose not to use it because of issue D.

               
Fail fastfail safeAge
immediately throw ConcurrentModificationException if a collection is modified while iterating over it Fail-Safe iterators don’t throw any exceptions if a collection is modified while iterating over it 50
operate on the clone of the collection, not on the actual collection 94
When collection is structuraly modified (add, remove, update) by its instance, Accepted by iterator's remove method Doe 80
use modCount ConcurrentHashMap 80


List list = new ArrayList(Arrays.asList("a","b","c","d","e"));
Iterator i = list.iterator();
while (i.hasNext()) {
//i.remove(); //IllegalStateException
System.out.println(i.next());
i.remove(); // OK

//list.remove("d"); // Always throw concurrent modification exception
//list.add("f"); // Always throw concurrent modification exception
}

h1b good article from nytimes


Use of Logical shift
 right-shift ( >> 1 ) is equivalent to  a /= 2
left shift ( << 1) is equivalent  a=a*2


ii >> 1i >> 2i >> 3
1000
2100
3100
4210
5210
6310
7310
8421
9421
ii << 1i << 2i << 3
1248
24816
361224
481632
5102040
6122448
7142856
8163264
9183672


Spring Controller is singleton and class level parameters are shared among all the request

for each new request a new thread is created

7 comments:

  1. why string class is immutable

    ReplyDelete
  2. Yielding and Sleeping
    Iterator
    Rules of overriding and interface
    SerialVersionId
    Garbage Collection-
    Revice memory model for java-stack,,,heap
    increase size of array runtime--and its implications
    Pessimistic lock-optimistick lock

    ReplyDelete
  3. use of xor, bit shifting gates in java programming

    ReplyDelete
  4. How to compare the elements in two csv files ?

    ReplyDelete
  5. The ConcurrentModificationException and UnsupportedOperationException are two exceptions that are
    unique (so far) to the Collections Framework. They provide support for the fail−safe behavior of collections

    ReplyDelete
  6. http://www.geeksforgeeks.org/

    ReplyDelete
  7. treeMap.put("x","2");
    treeMap.put("x","2a");

    treeMap.get("x"); ==> 2a
    So it replaces the value on same key

    ReplyDelete