interview-questions

Interview question on C# implicit conversion.

I have been given a sample statement: MyClass myclass = 3; How is it possible to make this a valid statement? What code do I need to include in MyClass to support the implicit conversion from an int? ...

getting rat out of a maze

A rat is placed in a maze at some unknown position in the maze. All we can go is in up, down, right or left directions. And we have two methods: tryMove(<direction>) which returns false if there is a wall and true if we can move. bool hasLadder(): which returns true if there is a ladder to escape. We have to write a function explo...

SQL Server interview questions.

So I have an interview next week for a shop that makes heavy use of SQL Server 2008. I also use it on a daily basis and feel quite comfortable with it however there is always the nagging question: What don't I know? So I humbly ask, what can a C# developer expect an interviewer to ask with regards to an SQL Server 2008 for a mid-level d...

how many instances for a class exists at runtime in java

Today in my interview , i was asked to write a code to determine how many instances for a class exits at runtime in java. I told them , that we can use reflection . kindly let me know if you have efficient way of doing this. ...

Questions to evaluate the technical competency of a business analyst type position

I am looking for a few solid phone screen friendly questions with proven success to evaluate the technical competency of a candidate for a BA type position. I require this candidate, who will function between development team and business side/customer, to understand the technical side of things adequately to push back as appropriate on...

Infix vs Postfix

Had this question in the interview yesterday. Which is better to use? Infix(with parenthesis) or Postfix? State with reason.. I only could tell them that: it is easier for the compilers to process postfix expression for arithmetic evaluations and operator precedence. More memory is used for storing and processing the parenthesis. ...

Enumerating a set of permutations based on a condition

I've been able to solve the following problem using std::next_permutation (c++) etc, but I'm now thinking about it in a more general and would very much like to form an expression as this type of problem seems to lend itself - though I'm not having any luck as of yet. Here is the question: Given a running race with N contestants, wha...

Facebook Interview Question: Formatting a collection of times for a movie show time output (using Linq is preferred)

class TimeObject { DateTime time; bool isMatinee; } Given: {8:00, 9:30, 11:00, 12:10, 2:00, 4:00, 5:20} -- a collection of TimeObjects Output: (8:00AM, 9:30, 11:00, 12:10PM, 2:00), 4:00, 5:20 -- return a string, oh and AM/PM should be picked up from localization strings Caveats: AM/PM only shown for first time, ( ) encloses th...

Easy interview question got harder: given numbers 1..100, find the missing number(s)

I had an interesting job interview experience a while back. The question started really easy: Q1: We have a bag containing numbers 1, 2, 3, …, 100. Each number appears exactly once, so there are 100 numbers. Now one number is randomly picked out of the bag. Find the missing number. I've heard this interview question before, of cour...

Is it possible for a thread to Deadlock itself?

Is it technically possible for a thread in Java to deadlock itself? I was asked this at an interview a while back and responded that it wasn't possible but the interviewer told me that it is. Unfortunately I wasn't able to get his method on how to acheive this deadlock. This got me thinking and the only situation that I can think of is...

Substring search interview question

char* func( char* a, const char* b ) { while( *a ) { char *s = a, *t = b; while( (*s++ == *t++) && *s && *t ); if( *t == 0 ) return a; a++; } return 0; } The above code was written to search for the first instance of string "b" inside of string "a." Is there any probl...

Is it possible to have only one comparison per iteration of a binary search algorithm?

In binary search algorithm we have two comparisons: if (key == a[mid]) then found; else if (key < a[mid]) then binary_search(a[],left,mid-1); else binary_search(a[],mid+1,right); Is there a way by which I can have only one comparison instead of the above two. -- Thanks Alok.Kr. ...

The object oriented relationship...

Hi guys. I was asked to describe the relationship between vehicle, car, toyota in object oriented programming term (let's say in php environment). I was stumped. Can someone help me about it? Thanks... ...

Technical interviews and reinventing the wheel

Hi all. So I just finished an interview with a major software company for an internship (I am an undergrad). I had some weird experiences during the interview, so I thought I had share them here and ask for feedback. I was interviewed on-campus so there was no telephonic round. Before the interview began, we were given a choice of a p...

What are the "best" requirements (or what does one look for) when hiring a software developer?

Hi guys, I'll make this a community wiki seeing that there's no exact correct answer. I've started a project (which I'm proud of) and due to the demand of the requirement, I need to hire developers (mostly java and C++). Now, I know there are some who are java certified and some are qualified computer scientist. In my work experience, ...

What is COM+? What is equivalent for COM+ in .Net?

What is COM+? What is equivalent for COM+ in .Net? ...

Given two strings, find the longest common bag of chars

This question is slightly different from the kind of finding longest sequence or substring from two strings. Given two string of the same size N, find the longest substrings from each string such that the substrings contains the same bag of chars. The two substrings may not necessarily have the same sequence. But they must have the sam...

Good and bad points of PHP?

Was asked in an interview yesterday to name three good and three bad things about PHP. It was a junior position and the interviewer wasn't expecting all questions to be answered/answered correctly. I'm a hobbyist web developer mostly, so what are the good and bad points of PHP? ...

Tokenize valid words from a long string

Suppose you have a dictionary that contains valid words. Given an input string with all spaces removed, determine whether the string is composed of valid words or not. You can assume the dictionary is a hashtable that provides O(1) lookup. Some examples: helloworld-> hello world (valid) isitniceinhere-> is it nice in here (valid) zx...

constructors and destructors - c++

Hi, I need to write a program that prints 100 stars on the screen (at random places), and then the stars disappear slowly - one after another. I'm not allowed to use loops nor recursions. I've tried to play with the constructors and the destructors but I can't get the stars to disappear one after another (and not all together). Any idea...