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

Jan 29, 2012

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

May 3, 2012
 Write a power function power(a , b) returns a^b7 Answersint power (double a, int b) { for (int i = 1, i <= b, i++) { a *= a; } return a; }There are some conditions you are missing. What if b is <=0 ?The conditions made by the Hulu rep was to assume b > 0. However there is a better way to do this problem.Show More Responseslong power(int a, int n) { if(n%2==0) return power(a,n/2)*power(a,n/2); else if (n%2==1&&n!=1) return power(a,n-1)*a; else //n==1 return a; }double power(int a, int n){ double res=1; while(n!=0){ if((n&1)==1) { if(n>0) res*=a; else res/=a; } a*=a; n /=2; } return res; }def power(a,b): if b is 1: return a return a * (power(a, b--))double pow(int a,int b) { if(b0) { if(b%2==1) res*=a; a*=a; b>>1; } return res }

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

Jan 30, 2012
 Write a program that sees if two binary trees are equal.6 AnswersI utilized a depth-first traversal method, comparing the data within each node and recursively checking the left, then right child.Don't know if this works or not... value = \$value; \$this->left = \$left; \$this->right = \$right; } // O(n) times inorder traversal function testEsqual(\$tree1,\$tree2) { if(\$tree1->value ==null || \$tree2->value==null) return false; if(\$tree1->value ==null && \$tree2->value==null) return true; while(\$tree1->value!=null) { if(\$tree1->value == \$tree2->value) { equal(\$tree1->left,\$tree2->left); equal(\$tree1->right,\$tree2->right); } else { return false; } } } } ?>How if we use in-order traversal? If my understanding is correct, two binary trees are equal if they contain the same elements (although at different positions in the tree)Show More Responsesbool AreEqual(Node* node1, Node* node2) { if( (node1 == NULL && node2 != NULL) || (node2 == NULL && node1 != NULL ) return false; if(node1 == NULL && node2 == NULL) return true; if(node1->data != node2->data) return false; return( AreEqual(node1->left, node2->left) && AreEqual( node1->right, node2->right) }; int main(); { AreEqual(root1, root); };The solution by kvr doesn't cover a case when node1->data and node2->data are equal. An additional if is required.fb, If if(node1->data != node2->data) is not true, what does that tell you *Is* true?

### Software Developer Intern at Halliburton was asked...

Nov 2, 2009
 What is the angle between the two arms of the clock at 2:40?7 Answersint time(int h, int m) { angleH = (h*360)/12; angleM = (m*360)/60; return Math.abs(angleH - angleM); }160 degreesif a circle is bisected, the degree would be 180, as a circle is 360 degrees. How do you come up with 160?Show More Responses160 of coursehttp://en.wikipedia.org/wiki/Clock_angle_problem#Equation_for_the_angle_between_the_handsThis should help http://www.mathcelebrity.com/clockangle.php?num=2%3A40&pl=Calculate360*(40/60)-360*(2/12)-(360/12)*(40/60)=160

### Amazon Software Developer Intern at Amazon was asked...

Apr 1, 2011
 how would you design how a cellphone implements its contact list when you press a certain letter. For example, If you press M it will tell you all the names starting with M. then if you press MI it will tell you all names starting from MI and so forth....6 AnswersUse a tree structure where each level is a consecutive character. So, if M is chosen first, travel down the "M" branch. To show remaining set of possible contacts, traverse the tree and print out all leaf nodes.Use a trie or radix (patricia) treeKeep a sorted contact list in an array. The names will be in char arrays so the access time is constant for a specific index. Do a binary search for the left boundary (the first appearance of a match and the right boundary (the last appearance of a match). Iterate through that index range. When dealing with mobile space might be an issue and making such a tree might cost more overhead then just looking through a sorted array.Show More ResponsesThe tree answer is a probably the right idea, but what about edge cases like if you have a contact Matt and a contact Matthew, in this case Matt will not be a leaf node but be an intermediary node on the way to Matthew. Any clarification would be appreciatedyou'll probably need a suffix tree for this oneWhat about having a hash map where the keys are the various letter of the alphabet, and the associated values are sorted collections of names starting with that same letter as the corresponding key.

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

Apr 17, 2011
 1) Tow coins, P(head)=1/3, P(tail)=2/3, design a way to get the effect of fair coin5 AnswersI guess Play 2 games , TH or HT = outcome 1, TT = outcome 2 . Both of probability 4/9 disregard HHmanipulate payouts. P(Tails) = 2/3, so if it lands on tails I get \$1. P(Heads) = 1/3, so if it lands on heads you get \$2. 2/3 * 1 = 1/3 * 2We need unbiased decision out of a biased coin. Throw the coin twice. Classify it as "heads" if we get HT and "tails" if we get TH. Disregard the other two occurrences i.e. HH and TT.Show More Responsesit's like you need to give heads another 'chance' (to double it's probability to match tails) if you get a tail, stop if you get a head, roll again and take the second resultSwift and anon are both correct, but Swift's solution is twice as efficient because 8/9 of the time, Swift only requires 2 flips, while 4/9 of the time, anon requires only two flips. Indeed, for Swift, we can show that the expected number of flips is 2.25, while for anon, the expected number of flips is double that, 4.5. Let X be the expected number of flips. Then, for Swift, EX = 2 + 1/9*EX ==> EX = 18/8 = 2.25, while for anon, EX = 2 + 5/9*EX ==> EX = 18/4=4.5.

Mar 12, 2012
 If i roll two dice and multiply the two outcomes, what is the probability of a perfect square?6 Answers2/9 I think1/6 - just the probablity that the numbers on the die are the sameTotal Outcomes = 36 Perfect square= 4 or 9 Odds of getting 4 are 3/36 Odds of getting 9 are 4/36 Probability of landing perfect square= 7/36 = 0.19Show More Responses2/9 is correct. 6 combinations that are the same on both plus 1,4 and 4,1 -> 8/36 = 2/9 ic is talking about the sum, which is not what's asked1,4,9,16,25,36 1-1 rolls 1 (1 combo) 1-4 (2 combos) and 2-2 (1 combo) 3-3, 4-4, 5-5, 6-6 roll a combo each So the answer is 8/36 which reduces to 2/92/9

Feb 23, 2012
 Print out a binary tree level by level6 AnswersRun breadth-first search using a queue. Add a null pointer to signify the end of each level.Are questions really this easy?No. That was my question for the first round. Second round questions are harder. At most companies, engineers interview recruits. So the difficulty of the question depends on which engineer is interviewing you.Show More ResponsesBut whether they hire you or not depends on whether you are from an Ivy league university, right? Are you from one?^ Yes you're right. Serious Comment: There is usually a large alumni base from the target schools, some of these target schools are ivies. Troll Comment: Yes. If you don't go to an ivy, you don't get hired. Tough luck.I'm not from an ivy league and I hold hired. But I've also started 2 companies with several clients, etc. You just have to be proactive.