Software Internship Interview Questions | Glassdoor

# Software Internship Interview Questions

553

Software internship interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

### Software Engineer Internship at Amazon was asked...

Apr 16, 2011
 How would you count the number of words in a string consisting of uneven number of spaces between words( not dictionary words)? With and without library functions.3 AnswersWith -Use Java String Tokenizer or split functionint wc(char *s) { if (!s) return -1; int wc = 0; /* prune initial continuous spaces */ while (*s == ' ') ++s; /* count spaces, i.e words! */ while (*s != '\0') { if (*s == ' ') { ++wc; s++; /* prune continuous spaces */ while (*s == ' ') ++s; } else ++s; } /* sentence can end without space, check last word has been accounted */ if (*(s-1) != ' ') ++wc; return wc; }char str[] = "jdjd jdjd jriri"; count=0; for(i=0; i<=strlen(str); i++) { // str[i] while(str[i]==' ') { i++; } count++; while(str[i]!=' ') { i++; } }

Mar 28, 2012
 You have two decks of cards, one normal 52-card deck and one 104-card deck with double every card. Is one deck better than the other if you wanted to get two black cards in a row?3 AnswersYes, you would want to choose the 104-card deck.With 52-card, probability is 12/204, with 104-card, probability is 25/412. The latter one is bigger104 card deck has higher probability. For 104 cards: (52/104)*(51/103) = 0.24757 For 52 cards: (26/52)*(25/51) = 0.245098

### Software Development Engineer In Test/SD Summer Internship at Microsoft was asked...

May 17, 2012
 Given an array of positive and negative numbers, give an algorithm that would find the sequence of numbers that give the largest sum. The numbers have to be in sequential order. 2 AnswersThe naive algorithm will take O(n^2) time, but it is very easy to code. The divide and conquer algorithm will take O(nlgn) time, but a little challenge to implement.If by "sequential order" you mean that the indices of the numbers in the subsequence must be consecutive, I think this should work in O(n): int main() { int best[N], B, i, a[N]; //input to a; best[0] = a[0]; B = a[0]; for(i = 1; i best[i-1]) best[i] = B + a[i]; else best[i] = best[i-1]; B = max(a[i], B + a[i]); } return best[N-1]; return 0; }

### Software Engineer Internship at Orbitz Worldwide was asked...

Mar 18, 2011
 What is the angle between hour hand and minute hand at 3.15?2 AnswersLets deal with the hour hand first. In 60 minutes (1 hour) the hand travels 5 minutes on the clock face, so in 1 minute it travels 0.0833 minutes on the clock face (5/60). At 3'0clock the hour hand was exactly at 3. After 15 minutes it has moved 0.0833*15 = 1.25 minutes on the clock face. At 3.15 the minute hand is exactly at 3, so the difference between the hour and minute hand is 1.25 minutes. So now we just convert 1.25 minutes into degrees to get the angle between the two hands. We do that with the following logic - in 60 minutes the minute hand turns 360 degrees, so in 1 minute the hand turns 360/60 = 6 degrees, so in 1.25 minutes the hand turns 6*1.25 = 7.5 degrees. This is the angle between the two hands at 3.15http://en.wikipedia.org/wiki/Clock_angle_problem

### Software Engineer Internship at Amazon was asked...

Apr 16, 2011
 Given two arrays one with expected numbers and other with actual numbers determine which number is missing in the actual array2 AnswersXOR all the elements together - the result will be the missing number. This works assuming there's only one missing number, but it's the fastest way. If there are multiple missing elements, use a hashtable.missing = SUM(expected) - SUM(actual) (again works only if 1 no. is missing!)

### Software Developer Internship at Hulu was asked...

Jun 25, 2011
 What would you name this function and how would you optimize it?2 AnswersIt was a basic substring function and to improve it, should remove the recursion.In the first interview, did you also ask to write codes or just to explain codes those were sent just before the interview ?

### Software Engineer Internship at Palantir Technologies was asked...

Oct 18, 2011
 Print the nodes of a complete binary tree in level order.2 AnswersBreadth first searchDetailed analysis and solution are available in the following blog: http://codercareer.blogspot.com/2011/10/no-11-print-binary-trees-from-top-to.html

### Summer Software Engineering Internship at Symantec was asked...

Feb 9, 2012
 What is the difference between a Class in C and an Object in C++?2 AnswersC has no class- C is a functional programming language!!!!!I think you mean difference between class and object in C++, C is a low level language with no Class functionality (it does have struct however). A class is a collection of variables and functions for the purposes of OO programming. An object is an in stance of the class that can call its member functions and variables

### Summer Software Engineering Internship at Symantec was asked...

Feb 9, 2012
 What is the difference between a signed and unsigned integer variable type?2 AnswersSigned can hold positive and negative numbers, unsigned numbers can only hold positive numbers (or 0)signed value ranges from (-Max_Val, Max_Val), while signed goes from (0, 2*Max_Val). Max_Val is the predefined maximum value for the specific data type. They both have the same range of 2*Max_Val