# Intern Interview Questions

intern interview questions shared by candidates

## Top Interview Questions

Given an array of integers [1,2,3,4]. and target t = 5. Come up with a solution that will print out all the unique pairs in the array that are equal t. Found this very hard, but the interviewer gave subtle hints, and I eventually came up with the idea of using a nested for loop. But I was not completely correct as I had set the inner incrementer to j = 0 instead of j = i+1 . array a=new array(); foreach(int i in a) { if(i==t) { console.writeline(i.toString()); } } //c# code,i am not sure if this is what they whanted public class CalculateTuple { /** * @param args */ public static void main(final String[] args) { final int arr[] = { 1, 2, 3, 4 }; final int sum = 5; solution(arr, sum, false); } /** * find possible tuple for provided sum * * @param input * input array * @param expectedSum * expected sum value for the tuple * @param isCommutative * true : (1,2) != (2,1) will give you both tuple <br> * false : (1,2) == (2,1) are same and give you only (1,2) */ public static void solution(final int input[], final int expectedSum, final boolean isCommutative) { final Map indexedArray = new HashMap(); final Map uniquePair = new HashMap(); final int length = input.length; for (int i = 0; i < length; i++) { indexedArray.put(input[i], i); } int count = 0; for (int i = 0; i < length; i++) { final Integer integer = indexedArray.get(expectedSum - input[i]); if (integer != null && integer != i) { if (isCommutative || (null == uniquePair.get("(" + i + "," + integer + ")") && null == uniquePair.get("(" + integer + "," + i + ")"))) { System.out.println("(" + i + "," + integer + ")"); uniquePair.put("(" + i + "," + integer + ")", "(" + i + "," + integer + ")"); count++; } } } System.out.println("Found " + count); } } |

A king wants to hold a party, for which he has 8 kegs of wine, one of which he knows is poisoned. If someone consumes any of the poisoned wine, he will drop dead in exactly one months time. The king has 3 servants who have volunteered their lives to test the kegs of wine. What is the shortest amount of time in which the king can identify which keg of wine is poisoned and dispose of it so he can hold the party. |

The expectation of a dice roll. |

Compute all the intersections of two sets of segments in a line. |

What is dhcp |

If a shooting star has an 80% chance of appearing in the next hour, what is the chance of it appearing in the next half hour? |

Given a set of cities, each with a given population, select randomly a city with a probability that is proportional to the population. |

Very broad questions like my favourite and least favourite thing about my course? Not very technical questions. What would you do if your internet wasn't working was a particularly annoying one. |

What is the output of the Linux uptime command? What is the meaning of load average? How is the load average affected by SMP? |

How would you describe our target audience? |

**1**–

**10**of

**347**Interview Questions