Software Developer Interview Questions | Glassdoor.co.uk

Glassdoor uses cookies to improve your site experience. By continuing, you agree to our use of cookies. OK | Learn More

Software Developer Interview Questions

1,097

Software developer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

The questions were not very difficult but you really need to have all the concepts crystal-clear and be ready to apply them successfully. One of the questions was "how to count the letters in this string:" "The quick brown fox jumps over the lazy dog";

11 Answers

public static int countWords(String str){ if(str == null || str.isEmpty()) return 0; int count = 0; for(int e = 0; e < str.length(); e++){ if(str.charAt(e) != ' '){ count++; while(str.charAt(e) != ' ' && e < str.length()-1){ e++; } }else{ e++; } } return count; }

Sorry, the above version has an error!!!!!!!!!!!!!!!!!!!!!!!! concider this one: public static int countWords(String str){ if(str == null || str.isEmpty()) return 0; int count = 0; for(int e = 0; e < str.length(); e++){ if(str.charAt(e) != ' '){ count++; while(str.charAt(e) != ' ' && e < str.length()-1){ e++; } } } return count; }

# That's why i love Python: len(re.findall('[a-zA-Z]', s))

write a function that returns the first unique element in an array

5 Answers

int i=14; if (i=15) i++; How much is i?

4 Answers

2 pieces of string of different length and non-uniform width, each take one hour to burn. the remaining length of a burning string doesn't tell you how much longer it burns for. with a lighter measure 45 mins.

3 Answers

A rabbit wants to climb some stairs and it can do steps of 1 or 2. How many possible paths are there to follow ( e.g 1-1-1... or 2-2-2 ... or 2-1-2-1... etc)

6 Answers

Russian roulette brain teaser: Interviewer takes an imaginary revolver gun with 6 empty chambers, and loads 2 adjacent chambers with bullets. Interviewer has the first turn: rolls the cylinder, puts it to his head, and pulls the trigger... no shot. The lucky interviewer passes the gun to you and gives you two options before you put the gun to your head and pull the trigger: (a) to roll the cylinder again or (b) not to roll the cylinder Which option would you choose?

5 Answers

You have a large data file, consisting of ten-digit numbers separated by new-line characters. Write a program in C to sort it, using at most 20MB of memory. Make it efficient.

4 Answers

Are you married? Do you have any kids? Where do you live?

2 Answers

Asked question: Using an already implemented method Rand5() that generates a random integer between the ranges 1-5 uniformly. Using this method, implement a a new method that returns a random integer in the range 1-7 uniformly, i.e. Rand7(). Basically this is Rejection Sampling Algorithm. See http://leetcode.com/2010/11/rejection-sampling.html

2 Answers

how can I count the bit set to 1 in an integer? What if I want to optimize the process to work with several integers?

2 Answers
110 of 1,097 Interview Questions