The worm

This Article was very interesting and thought of sharing!!

" The Most complicated code ever written!! 

The most sophisticated software in history was written by a team of people, whose names we do not know.
It’s a computer worm. The worm was written, probably, between 2005 and 2010.
Because the worm is so complex and sophisticated, I can only give the most superficial outline of what it does.
This worm exists first on a USB drive. Someone could just find that USB drive lying around, or get it in the mail, and wonder what was on it. When that USB drive is inserted into a Windows PC, without the user knowing it, that worm will quietly run itself, and copy itself to that PC. It has at least three ways of trying to get itself to run. If one way doesn’t work, it tries another. At least two of these methods to launch itself were completely new then, and both of them used two independent, secret bugs in Windows that no one else knew about, until this worm came along.

Java/Rest/Spring

Theory Interview Question Java/J2EE

1. In Spring MVC how to handle exceptions?
  • Controller Based: We annotate our controller with @ExceptionHandlerThis takes exception class as argument.
  • Global Exception Handler: Here we use @ControllerAdvice annotation that we can use with any class to define our global exception handler.
  • HandlerExceptionResolver: Interface that we can implement to create global exception handler

2. What are the annotations would you use?
 @ControllerAdvice,@ExceptionHandler

3. For Global exception handler? What would you use?
@ControllerAdvice

4. For Controller Based?
@ExceptionHandler

5. Get and Load Method?

Find Intersection Between 2 Arrays

Find Intersection Between 2 Arrays

Example:1
Array-1 -- {1,2,3,10,20,5,8}
Array-1 --{20,1,90,30}

Output: 1,20

Example:2
Array-1 -- {10,20,10,10,50,80}
Array-1 --{10,10,10,10}

Output: 10

Steps & Complexity
Step:1 Sort any array[eg:Array-2]
Step:2 Take each element from an array:1, do a binary search for each element in array-1 with Array2
Step:3 If found- add into the set
Step:4 Else increment

Complexity : O(nlogn)