Software Development Engineer 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

Find jobs for Software Development Engineer

Software Development Engineer Interview Questions

104

Software development engineer 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))

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

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

2 Answers

1. How to achieve automatic type conversion from type X to type Y? a. X can define the member function operator Y() b. a) or b) can be used c. Y can define the constructor Y(const X&) d. none of the above 2. class Coordinate{ int x; int y; public: Coordinate(int a=0, int b=0) { x=a; y=b; }; }; What are the values for the following object: Coordinate point(10); a. x=10,y=0 b. x=0,y=10 c. x=10,y=10 d. x=0,y=0 3. What type of argument can the following function take : Void foo(); a. any number or type of arguments b. a character c. an integer d. no an integer argument of any type 4. Consider the following function declarations in a header file: void doit(char *, int); int doit(char *) ; float doit(float, float) ; Which of the following declarations cannot follow in the same header: a. void doit(int, char *); b. int doit(int) ; c. float doit(char *) ; d. int doit(int, int) ;

3 Answers

Write a function that takes a position (x,y) in a go game graph and returns a boolean telling if this position contains a white or black piece and if this piece is trapped or not.

1 Answer

Can't quite remember. Everything was reasonable for the technical level they were hiring for.

1 Answer

Question about designing a class hierarchy given a set of requirements.

1 Answer

Where do you see yourself in 5 years

1 Answer

Write a function to validate a binary search tree. Assume there are supporting classes and functions already. Try to prioritise speed - don't worry too much about memory. - What other test cases would you use? - How to do it without recursion?

5. What is the output of the snippet below? // suitable #includes class A { public: void name() const { std::cout << "A::name" << std::endl;} virtual ~A() {} }; class B : public virtual A { public: void name() const { std::cout << "B::name" << std::endl;} }; int main(int, char *[]) { const A *x = new B; x->name(); return 0; } a. A::name b. B::name c. A::name B::name d. none of the above 6. For some class Data, what does the following code snippet do? Data *p = new Data[10]; delete p; a. destructs all 10 elements in the array pointed at by p, and releases all the memory b. destructs just the element pointed at by p, and releases all the memory c. it compiles, but the run-time behaviour is not well defined d. it fails to compile 7. Which of the following code snippets correctly implements a user-defined assignment operator declared as follows: Data& operator=(const Data &that) a. { if (this != &that) { ... copy data ... } return this; } b. { if (*this != that) { ... copy data ... } return *this; } c. { if (this != that) { ... copy data ... } return this; } d. { if (this != &that) { ... copy data ... } return *this; } 8. What will be the output of the following: unsigned int bmf = 48; cout << (bmf == 38) ?15 : 10); a. 15 b. 10 c. 1 d. 0

1 Answer
110 of 104 Interview Questions