Software Developer Interview Questions | Glassdoor.co.uk

Software Developer Interview Questions

1,696

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";

12 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

Would Java Bytecode generated by Java 7 work on a JVM made to function on Java 1.0?

2 Answers

Most efficient way to find the most frequent number (0-255) in a string of numbers

4 Answers

Classic one from them: You have an array and you want to find the first non-repeating element.

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
110 of 1,696 Interview Questions