Intern Interview Questions | Glassdoor

# Intern Interview Questions

From retail to finance to medicine, every industry needs interns to provide additional support and assistance. Interview questions will vary greatly depending on the industry and role you are looking for. Expect to answer questions about how you work on teams and provide examples of any relevant work experience. To ace your interview, make sure to research the particular position you are applying for.

## Top Interview Questions

Sort: RelevancePopular Date

Sep 21, 2011
 Generate a new array from an array of numbers. Start from the beginning. Put the number of some number first, and then that number. For example, from array 1, 1, 2, 3, 3, 1 You should get 2, 1, 1, 2, 2, 3, 1, 1 Write a program to solve this problem.7 Answersint[] Reformat(int[] original, int length) { LinkedList list = new LinkedList(); int currentCount; for(int i=0;i 0 ){ \$a[] = \$c; \$a[] = \$number; } return \$a; } var_export( numberArray( array( 1,1,2,3,3,1 ) ) );\$val) { echo \$val . "\t"; } echo " \n"; } ?>Show More Responsesworking in php: sizeof(\$list)-2) || (\$list[\$i]!=\$list[\$i+1])){ \$result[]=\$count; for(\$j=0;\$jvector reformat(int arr[], int size) { vector res; int j, count = 0; for(int i = 0; i < size; ) { cout << i << endl; count = 0; for(j = i; j < size; j++) { if(arr[j] != arr[i]) break; count++; } res.push_back(count); res.push_back(arr[i]); i = j; } return res; }int i=0; int j=1; ArrayList array=new ArrayList(); while(i

### Financial Software Developer Intern at Bloomberg L.P. was asked...

Apr 17, 2012
 There are 20 floors in a building. If you're on an elevator and you're trying to get to the 20th floor, what is the probability that 4 people ahead of you click the 20th floor before you do? Assuming you click last.10 Answersassume there is one button for each floor, so 20 buttons. a person can press any 1 button out of the 20, prob is 1/20. Since there are 4 people, so1/16000These are independent events so the chances of one person before you going to the 20th floor is 1/20. Since this happens 4 times before you the probability is 4*(1/20) or 1/5.The above two are close, but wrong.. There are 20 buttons, thus 20 choices, sure. But you are getting on at one of the floor. No body will press the button for the floor they get on.. Thus, there is really only 19 choices. P = (1/19)^3 (Independent events mean (1/19)(1/19)(1/19)).Show More Responses1/19 + 1/18 + 1/17 + 1/16 assuming that there were no repeated destinations.based on question: P(all 4 ahead of you want to get off on 20th fl) = (1/19)^4 real life(all 4 want to get off on 20th fl, and one of them is the first person press the button to 20th fl, and that leave all others, including you, stay still): (1/19) * (1/4)about 20% is the right answer. I am surprised with some of the answers, they are all very small possibilities (some less than 1%).I'm quite sure you are all wrong: The real probability is 1 - P(nobody pushes 20) = 1 - (18/19)^3 = 15%1- (19/20)^4If one of the 4 press the button for the 20th floor then the others won't have to do anything. The chances of one of them pressing 20th is: 1/19 + 1/19 + 1/19 + 1/19 = 4/19The answer is 1-(19/20)^4

Mar 6, 2011
 Write a function that finds the minimum and maximum values within an unsorted array using divide-and-conquer.6 AnswersThe best I can do in Java: int findMinimum(int[] a, int start, int end){ if (end-start == 0){ return a[end]; } if (end-start == 1){ if (a[end] = 2){ int split = (start+end)/2; int leftLeast = findMinimum(a, start, split); int rightLeast = findMinimum(a, split+1, end); if (leftLeast 0) { mm[0] = a[0]; mm[1] = a[1]; } mm = minMax(a,0,a.length-1); return mm; } public static int[] minMax(int[] a, int low, int high) { int[] temp = new int[2]; if (low+1 < high) { int mid = (low+high)/2; int[] temp1 = minMax(a,low,mid); int[] temp2 = minMax(a,mid+1,high); temp[0] = Math.min(temp1[0],temp2[0]); temp[1] = Math.max(temp1[1],temp2[1]); return temp; } else if (low <= high) { if (a[low] < a[high]) { temp[0] = a[low]; temp[1] = a[high]; } else { temp[0] = a[high]; temp[1] = a[low]; } } return temp; }def find_min_max(arr): return min_max(arr, 0, len(arr)-1, 1e308,-1e308) def min_max(arr, i, j, mn, mx): if not arr or i > j: return mn, mx elif i == j: return min(mn, arr[i]), max(mx,arr[i]) else: mid = ( i + j) / 2 left = min_max(arr, i, mid-1, min(mn, arr[mid]), min(mn, arr[mid])) right = min_max(arr, mid+1, j, min(mn, arr[mid]), max(mx,arr[mid])) return min(left[0], right[0]), max(left[1], right[1])first divide list in two, compare number from each list so we got 1list where the minimum is and second list where maximun is. Search for the min in the first list and the max in the second list. \$list[\$n-1-\$i]){ \$temp = \$list[\$i]; \$list[\$i] = \$list[\$n-1-\$i]; \$list[\$n-1-\$i] = \$temp; } } \$min = \$list[0]; for(\$i=1;\$i\$max) \$max=\$list[\$i]; } \$result = array('min'=>\$min, 'max'=>\$max); return \$result; } ?>

### Software Engineer Intern at eBay was asked...

Jan 19, 2011
 Questions related to data structures like "What data structure would you use for a browser's BACK & FORWARD ability"6 AnswersMay be Stack , any one please correct me if I am wrong.This can be implemented by using two different stacks, one for back and one for forward.Command PatternShow More ResponsesI would use doubly link listDoubly linkedListUse two stacks. Every time you visit a site, push its address in stack1. When you press back, pop from stack1 and also push in stack2. When user presses forward, pop from stack2 and also push in stack1.

### Software Development Engineering Intern at Amazon was asked...

Jun 23, 2012
 You are given an array with n positive integers where all values in the array are repeated except for one. Return the one that is not repeated.7 Answerspublic static int notRepeated(int[] given) { Map m = new HashMap(); for(i=0; i < given.length; i++) { if(m.get(given[i])) { m.put(given[i], 2); } else m.put(given[i], 1); for(x:m) { if(x == 1) return x; } } }If you have an array of positive integers with only ONE non repeated integer, the easiest thing is just xor them all. Whatever you return will be the answer. Perl answer below sub findNotRepeated{ my (\$arr) = @_; if(@\$arr==0) { return - 1; } my \$val = 0; foreach(@\$arr) { \$val ^= \$_; } return(\$val); } sub findMissingElement{ my (\$arr,\$arr2) = @_; if(@\$arr==0 || @\$arr2 == 0 ) { print " arr2=" .@\$arr2 . "X\n";; return - 1; } my \$val = 0; foreach((@\$arr , @\$arr2)) { \$val ^= \$_; } return(\$val); }first sort the array.n then 1)for i=1 to n { if ( element [i] !=element [i+1] ) { cout<

Dec 30, 2011

### Quantitative Researcher Summer Intern at Jane Street was asked...

Apr 17, 2011
 2) A. 10 ropes, each one has one red end and one blue end. Each time, take out a red and a blue end, make them together. Repeat 10 times. The expectation of the number of loops. B. 10 ropes, no color. All the other remains the same.7 Answers1/10 + 1/9 +...+ 1 ? B is similar..1/19+1/17+etc in BE[n] = 1/n + (n-1)/n*E[n-1] = 1/n + E[n-1] For the case of n=10, you would sum up all of the numbers from 1 to 10: 1/10+1/9+ 1/8 + 1/7 ... + 1/2Show More Responsesadd an extra 1 to the previous answerFor part A), the answer is 1+1/2+1/3+...+1/10. For part B), the answer is 1+1/3+1/5+...+1/19. Explanations: For part A), ctofmtcristo has the right approach but with a typo in the equation for E[n]. To obtain the expected number of loops, we note that the first red has a 1/n chance of connecting with its opposite blue end (and forming a loop) and a (n-1)/n chance of connecting with a different rope's blue end (and not yet forming a loop), so E[n] = 1/n*(1+E[n-1]) + (n-1)/n*E[n-1] = 1/n + E[n-1], with base case E[1]=1. Then, by induction, we get E[n] = 1+1/2+1/3+...+1/n. Part B) is similar. We note that the first end now has 2n-1 possible ends to connect to, of which 1 of them is its opposite end and 2n-2 of them belong to a different rope. Then, E[n] = 1/(2n-1)*(1+E[n-1]) + (2n-2)/(2n-1)*E[n-1] = 1/(2n-1) + E[n-1], with base case E(1)=1. By induction, E[n] = 1+1/3+1/5+...+1/(2n-1).Ed's anwser is not right. Just check for the case of 3 pairs. So total cases is 3!=6. 1 case with 3 loops, 2 cases with all wrongly attached, and 3 cases with 1 loop. so expected value is (3/6)*(1) + (1/6)*(3) = 6/6 = 1... and Eds anwser gives 1+1/2 +1/3 = 11/6, which is wrong clearly.Timi, you are missing the fact that if they are "all wrongly attached" then they form a loop. Similarly, the case you are thinking of "with 1 loop" actually has 2 loops. The correct answer is still 11/6.

Mar 8, 2012
 Given a sorted array, write a program to decide if two elements sum up to a third.9 AnswersDid you coded a solution < O(n^2 + logn) ?Assuming each number only appears once: //Java code public static void targetsum(int[] arr, int target) { if(arr == null) return; int start = 0; int end = arr.length -1; while(start target end--; } }typedef vector vint; bool check_element_sum(vint &array) { // n^2 algorithm sort(array.begin(),array.end()); //general case : nlogn copy(array.begin(),array.end(),ostream_iterator(cout," ")); cout=0;--i) //n^2 { start=0; end=i-1; target=array[i]; //note a<=b<=c for the tuples formed here hence check for c=a+b only while(start findSummingTriplets2(int[] array) { final Set> summingTriplets = new HashSet>(); for (int k = 2; k array[k]) { j--; } else if (sum > findSummingTriplets(int[] array) { final Set> summingTriplets = new HashSet>(); for (int i = 0; i end) { return false; } int mid = start + (end - start) / 2; if (array[mid] > value) { return contains(array, start, mid - 1, value); } else if (array[mid] < value) { return contains(array, mid + 1, end, value); } else { return true; } } }bool sumExists(vector nums, int target) { auto front = nums.begin(); auto back = nums.end() - 1; while (front != back) { if (*front + *back == target) return true; else if (*front + *back < target) front++; else back--; } return false; }

### Software Development Engineer Intern at Amazon was asked...

Feb 15, 2012
 To return the 'm' smallest numbers from a file of 'n' numbers8 AnswersI would first create an array holding the first m values of the file, and sort. Then, each value I read from the file, I can compare the the last (largest) value in the array. If its smaller, do a binary search to find the correct spot in the array. Insert the number and shift everything behind it back by 1. Worst case runtime will be O(n lg m)Why cant we simply start with min=INT_MIN. Then, read first number from file, if lower, set min=that number. Seek next number and so on... We dont need to load the whole file. We will go to the disk often though.I will create a min heap with the given numbers and extract 'm' minimums from the heap which will get stored into the resultant arrayShow More ResponsesAnuj, Wont it take time of O((M+N)log N)@spammer, I think it's O(n+m*log n), since you can construct the min heap bottom-up and that only takes O(n)Why don't we just sort the array and return the first m numbers? Takes O(nlogn) for sorting and O(m) to return the first m numbers.Modified quick sort. Pick a pivot and test if one half is smaller than m. If it is, drag the rest from the other half; if it is not, keep partitioningMaintain a heap of m numbers and also track a variable which stores the current highest value. So as u go through the n numbers, if the number is higher than the current highest number, ignore it else insert it into the heap and set the current highest value to the newly inserted value

### Quant Research Intern at Susquehanna International Group was asked...

Mar 17, 2013
 Suppose you have two covariance matrices A and B. Is AB also a covariance matrix? Suppose that, by plain dumb luck, we also have that AB=BA. Is AB a covariance matrix under this additional condition?10 AnswersI suppose it's clear from how I wrote the question that the answer to the first question is no (for you: why?). For the second question, this is a little bit harder if you aren't experienced in linear algebra. I actually have a PhD in algebra, and the interviewer also had a PhD in algebra, so on some level this question might have been specifically targeting my background. There is a standard result that applies here; see if you can figure it out.1. no 2. no, give an example where diagonal positivity is not true.1 is correct, 2 is wrong. Try again. :)Show More Responses2. Just checked Wikipedia, AB is cov matrix because it is symmetric semi positive definite. Is it right?If AB=BA then yes it is symmetric. So the question boils down to: Is it in fact positive semi-definite? Why or why not? Work through that and you have your answer. My hint: Take a look at some results related to diagonalizing matrices that commute with each other.Hi for your telephone interview with doug, what was the focus for technical interview parts, everything from math, finance, programming? or mainly probability type of question? thanksI remember it being mostly probability and finance. Nothing too terrible.Hi Mr.interview candidate, what were the types of finance questions Doug asked? Thanks!Hi, Mr. interview. Do you remember what kind of data analysis example was for on-site interview? If so, can you share a little bit? What was the level of difficulty? Thanks!1, no 2, yes
3140 of 25,487 Interview Questions

More