Engineer Interview Questions | Glassdoor.co.in

# Engineer Interview Questions

80,612

Engineer interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

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

21 Apr 2012
 Write code to count the number of bytes used for the int data type.4 Answersint CountIntBitsF() { int x = sizeof(int) / 8; return x; }^^ Your answer is incorrect. Look closely at the question.int *p; int count=(char *)(p+1) - (char *)(p);Show more responsesvoid count_bytes_used() { int a = 66000, bytes=0; while (a > 0) { bytes++; a = a >> 8; } printf("BYTES USED: %d\n", bytes); }

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

2 May 2012
 Given the daily stock prices of a share during last 30 days, write a program to find out best buying and selling dates for maximum gain. The program should run with O(n) complexity.4 Answersfind the difference of price change on everyday and store it in an array. i.e., something like: [2,0,-3,6,-1] Now find the sub array which has the more sum. http://en.wikipedia.org/wiki/Maximum_subarray_problem@devsathish, I do not think so! Consider : {1,-4,5,6,-3,9,1,7} Maximum_subarray_problem would select {5,6,-3,9,1,7} where as the logical index for buying should be 1 and 5 respectively.Much much simpler in O(n) Just make a new array which contains the "lookahead" view, where we can see, which potential highest value we can gaini in future. Another array just contains the lowest value so far. When the difference between the two arrays is max, there is the buying point. Selling point is, when the falling edge of the max array is reached. public void highestGain(int[] prices) { int[] maxPrices = new int[prices.length]; int[] minPrices = new int[prices.length]; maxPrices[maxPrices.length-1] = prices[prices.length-1]; minPrices[0] = prices[0]; for(int i = 1; i maxPrices[sellPos]) { sellPos --; break; } } System.out.println("Ideal to buy/sell: " + maxDifferencePos + ":" + sellPos); }Show more responsessdgdfsh

### Engineer Trainee at Magneti Marelli was asked...

26 Dec 2012
 Very technical3 AnswersBetter be good at technicals..Hey can you tell me the 1. tests before GD and 2. whether they are technical or simple aptitude based. plz inform me soon because magneti marelli coming to our campus on jan17th. your reply will really help me to crack..can u guys tell me question's they asked?? i will be helpful for me.

### Associate Software Engineer at UnitedHealth Group was asked...

1 Jan 2013
 Swapping of two strings without using third string ; 3 Answersuse strcat and strtrim to solve itString firstString ="first"; String secondString ="second"; System.out.println("First String="+firstString); System.out.println("Second String="+secondString); int firstLength = firstString.length(); firstString = firstString+secondString; secondString = firstString.substring(0,firstLength); firstString = firstString.substring(firstLength,firstString.length()); System.out.println("After Swap"); System.out.println("First String="+firstString); System.out.println("Second String="+secondString);In how many days did u get the offer letter?

### Test Engineer at Legato Health Technologies was asked...

8 Nov 2018
 Technical questions3 AnswersI have attended interview on 23rd Oct, they have asked me to share the documents. I have shared the same on 2nd Nov, till now I didn't get any response from them.I attended on 23rd Oct. Done with all the rounds of interview. neither they have asked any documents nor they have released the offer letterdo they really have requirements. not sure whey they have conducted the interviews without letting the people know the updates

### Senior Software Engineer at Oracle was asked...

10 Feb 2011
 Find 2 or more missing numbers in a set of 100 natural numbers6 AnswersLook at the numbers and pick the highest one. That will be your salary.Sort numbers lowest number = salary print "your salary is" salaryC = U + Rr / Y Where C = natural number U = the universal constant Rr = local variable Y = years of serviceShow more responsesCreate code that sorts the numbers and then write an algoirthm to check to see if the increments between each number is equal to 1. If not, then add 1 to the previous number to get the missing number. Birdie num num.Since its 100 natural numbers the sorting can be done using an array/counting sort in constant time O(100). Now iterate and find the missing elements.Sort the array..create two subarrays with =50 and check count of each array..the one which is sorted..pass it to method which divides it to 1/2 again..

### Senior Engineer at Lanco Infratech was asked...

9 Jan 2013
 Why do you want to join Lanco Infratech Ltd3 AnswersDiversification of my profileI m looking for Good Environment & Promoting EnvironmentI m looking for Good Environment & Promoting Environment

13 Jul 2009