interview-questions

When should you use the singleton pattern instead of a static class?

Name the design considerations in deciding between use of a singleton versus a static class. In doing this, you're kind of forced to contrast the two, so whatever contrasts you can come up with are also useful in showing your thought process! Also, every interviewer likes to see illustrative examples. :) ...

Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.

Example input and output: >>> reverse_words("this is a string") 'string a is this' It should be O(N) in time and O(1) in space (split() and pushing on/poping of stack are not allowed). The puzzle is taken from here ...

Finding the phone numbers in 50,000 HTML pages

How do you find the phone numbers in 50,000 HTML pages? Jeff Attwood posted 5 Questions for programmers applying for jobs: In an effort to make life simpler for phone screeners, I've put together this list of Five Essential Questions that you need to ask during an SDE screen. They won't guarantee that your candidate w...

String initialization..

What is the difference between Str[32] = "\0"; and Str[32] = ""; ...

Favorite C++ interview question

What is your favorite C++ interview question? It may be any question, for example: algorithms, multithreding, gamedev area, low-level system programming, strings... ...

How to check if the given string is palindrome?

Definition: A palindrome is a word, phrase, number or other sequence of units that has the property of reading the same in either direction How to check if the given string is a palindrome? This was one of the FAIQ [Frequently Asked Interview Question] a while ago but that mostly using C. Looking for solutions in any and all language...

Good 15 minute Java question to ask recent college graduate

When interviewing college coops/interns or recent graduates it helps to have a Java programming question that they can do on a white board in 15 minutes. Does anyone have examples of good questions like this? A C++ question I was once asked in an interview was to write a string to integer function which is along the lines of the level ...

Interesting interview questions

Not so long ago I was in an interview, that required solving two very interesting problems. I'm curious how would you approach the solutions. Problem 1 : Product of everything except current Write a function that takes as input two integer arrays of length len, input and index, and generates a third array, result, such that: result[...

What are your essential phone-screen questions?

I loved the article from Steve Yegge where he explains to get the most out of phone interviews Coding. The candidate has to write some simple code, with correct syntax, in C, C++, or Java. OO design. The candidate has to define basic OO concepts, and come up with classes to model a simple problem. Scripting and regexes. The candidate ...

Travelling salesman problem..

Heres another famous problem we used to solve in college :) Travelling salesman problem - Problem Statement: Given a number of cities and the costs of travelling from any city to any other city, what is the least-cost round-trip route that visits each city exactly once and then returns to the starting city? How would you solve thi...

How to Find that Rock Star Junior Developer?

It's a fairly straight-forward process to interview a veteran programmer with 10+ years of programming experience. On the other hand, sometimes you just need a really talented junior developer. What do you look for--and how do you interview to find that "diamond in the rough," especially when the applicant is fresh out of college with a ...

Algorithm/Data Structure Design Interview Questions

What are some simple algorithm or data structure related "white boarding" problems that you find effective during the candidate screening process? I have some simple ones that I use to validate problem solving skills and that can be simply expressed but have some opportunity for the application of some heuristics. One of the basics tha...

Interview questions: WPF Developer

What should every WPF developer know? Entry Level Strong .NET 2.0 Background & willing to learn! Explain dependency properties? What's a style? What's a template? Binding Differences between base classes: Visual, UIElement, FrameworkElement, Control Visual vs Logical tree? Property Change Notification (INotifyPropertyChange and Observ...

What is wrong with using inline functions?

While it would be very convenient to use inline functions at some situations, Are there any drawbacks with inline functions? Conclusion: Apparently, There is nothing wrong with using inline functions. But it is worth noting the following points! Overuse of inlining can actually make programs slower. Depending on a function's size, ...

Tips for hiring good testers?

Hi all, We're looking to add a few good testers (err "qa engineers") to our team. It's been my experience in the past that the "10-1" rule for developers (good devs are 10 times more productive than mediocre devs) is even more prevalent for testers. Most testers I've worked with found a decent amount of issues, but there's a few stand...

MySQL Interview Questions

Hi, I've been asked to screen some candidates for a MySQL DBA / Developer position for a role that requires an enterprise level skill set. I myself am a SQL Server person so I know what I would be looking for from that point of view with regards to scalability / design etc but is there anything specific I should be asking with regards ...

Senior J2EE interview questions

What are the best questions to ask when running a technical interview for a senior level j2ee developer? ...

List comparison

I use this question in interviews and I wonder what the best solution is. Write a Perl sub that takes n lists, and then returns 2^n-1 lists telling you which items are in which lists; that is, which items are only in the first list, the second, list, both the first and second list, and all other combinations of lists. Assume that n is r...

Using Stack as Queue

Suppose we have two stacks and no other temporary variable . Is to possible to use it as a queue provided we have associated API i.e push,pop for stack and insert and remove for queue operations. ...

Deleting a middle node from a single linked list when pointer to the previous node is not available

Is it possible to delete a middle node in the single linked list when the only information available we have is the pointer to the node to be deleted and not the pointer to the previous node?After deletion the previous node should point to the node next to deleted node. ...