Monday, November 17, 2014

Interview Questions


  • 8 balls , 7 correct 1 heavy. What will be  the minimum value of iterations to find faulty ball ??
  • 8 balls , 7 correct 1 faulty [ don't know light or heavy ] . What will be  the minimum value of iterations to find faulty ball ??
  • In an array of integer, find pair of 2 numbers such that the sum is equal to k.
  • What is time complexity in Map for get and put operations ?
  • How to make class immutable ? 
  • What are patterns you know ?
  • What is singleton pattern ?
  • How mysql saves data ?
  • What are the optimization techniques in mysql ?
  • What are cons in using hibernate ?
  • How do you implement caching in hibernate ?
  • What is difference in GET and POST ?
  • How can you index a column in table  ?
  • What is generics ? 
  • What did you used to implement Web-services  ?
  • How will you find kth minimum number in array of integers ? 

Thursday, June 5, 2014

Java Programs For Various Series

Fibonacci Series :- 

Code :- 


import java.util.Scanner;


public class Fibonacci {


public static void main(String arg[]){

Scanner in = new Scanner(System.in);
int n = in.nextInt();

for (int i = 0; i <= n; i++) {
           System.out.print(fibonacci(i) + " ");
}
 
in.close();
}


public static int fibonacci(int n) {

      if (n == 0) {
          return 0;
      } else if (n == 1) {
          return 1;
      } else {
          return fibonacci(n - 1) + fibonacci(n - 2);
      }
  }
}



Output:-

10

0 1 1 2 3 5 8 13 21 34 55




Saturday, March 1, 2014

On The Cloud [AWS]

I was assigned to setting up new server on AWS and i was pretty much excited while i started working on it. Being a java guy, i am having no knowledge of working with servers, but let see:-

Setting up ISPConfig 3:-

Just followed the instruction given on this article. And yeah ISPConfig is installed.

Successfully generated SPF

Now i am stuck with DKIM, i have to set my mail server and i used Postfix for it, but my ClaimAV is real pain in the arse. I have created DKIM key and all other settings but now mail delivery is stopped. :'(

Dammn itt. I had no SWAP on AWS that is why it was failing.
I found out via:-
free -m

I added swap space by help of this link :-

SWAPFILE=/mnt/swapfile.swap
dd if=/dev/zero of=$SWAPFILE bs=1M count=512
mkswap $SWAPFILE
swapon $SWAPFILE


and voila its working......  ^_^