interview-questions

Implement a very large queue using java.

I have a question. I was once asked this in the interview -- Suppose you have a queue.A very large queue containing objects. And you cannot fit this queue in the memory. So how do you go about implementing it so that you can add from the end of the queue.And remove from the start of the queue.How is this solution implemented in Java? An...

algorithm to find complementary solution to this problem

I had this coding question in an interview.I couldnt find an optimum solution to this. what I did was, for(i=0;i<n;i++) for(j=i;j<n;j++) if(a[i]+a[j]==k) print a[i], a[j] But that would give rise to a O(n2) complexity. Is there a better way to solve this?? Array A contains n integers. A pair (i,j) of indexes of the array A is called ...

Interview question to ask on knowledge of multi-threading

Someone said 90% of programmers cannot solve a binary search. So for a guy who claimed he has in depth understanding on multi-threading technology, what is the basic but ideal question to ask? It can be either C++ or Java. ...

How to sort millions of rows of data in a file with less/meagre memory

(From here) I attended an interview last week and this question was asked: How do you sort a billion rows of data in a file with only 640KB of memory in a 8080 processor based machine? No virtual memory, no external disk. I explicitly asked the interviewer if I could use a hard drive, so I can serialize trees as I sort them and then c...

GWT Interview Questions

Can anyone suggest me some nice questions which could be asked for a GWT Developer? I am looking for a GWT developer and I am not sure what questions can be asked. I am planning to ask questions on GWT-RPC, GWT Widgets, etc., but I am not sure what exactlty I need to ask. ...

Interview question: dealing with M occurrences among N

Question I've been given at the job interview. I was close to the solution but did not solve it unfortunately. Assume we have a sequence that contains N numbers of type long. And we know for sure that among this sequence each number does occur exactly n times except for the one number that occurs exactly m times (0 < m < n). How do we f...

Interview question: the duck and the fox

Brainteaser i have been given while competing for C++ programmer vacancy. Assume there is the pond of perfect circle shape. Right in the center of this pond the duck sits on a water. And right at the coast the fox stays. Of course she cannot swim. The fox is constantly trying to chase and catch the duck so her primary objective is to st...

in c++ main function is the entry point to program how i can change it to an other funtion?

i have been asked in a interview question to change the entry point of a c or c++ program from main() to any other function how is it possible? thanx in advance. ...

Criteria to judge code quality in interviews

Hello, During Technical interviews involving coding question what criteria do people use to evaluate code. Assuming there are multiple ways to code the same problem, what metrics can be used to evaluate and compare the answers objectively. The Interview is typically 1 hour long Some of the things I use are Correctness Brevity and...

Convert integer to string without access to libraries [c]

I recently read a sample job interview question: Write a function to convert an integer to a string. Assume you do not have access to library functions i.e., itoa(), etc... How would you go about this? ...

Interview question: How do you explain a printer to your grandmother

I was recently asked this question at Miscrosoft. I had no clue. Any ideas? How do you explain a printer to your grandmother ...

Interview question: three arrays and O(N*N)

Assume we have three arrays of length N which contain arbitrary numbers of type long. Then we are given a number M (of the same type) and our mission is to pick three numbers A, B and C one from each array (in other words A should be picked from first array, B from second one and C from third) so the sum A + B + C = M. Question: could w...

Executing both 'If' as well as 'else' block.

Possible Duplicates: Stupid Question Regarding If-Else's Simultaneous Execution in C++ or C Is it possble to execute both if and else part of an if else control statement ? Hello everyone.. I had a question in an interview like this which i couldn't answer. Consider Following code block. Assume necessary header files. if(...

ETL interview questions?

In 5 days I'm going to ETL interview. It's my first interview on this subject. What question would I be asked? Most likely they will be about MS SQL Server Integration Service. If possible, provide the answers. =) ...

Can you call C# function from javascript?

Possible Duplicate: Call ASP.NET Function From Javascript? this question is asked by interviewer. can anybody tell me that is it possible? if yes then how. ...

How I can use the value of a textbox which is in a gridView in the code behind without using the FindControl() method

How can do I that? Does anyone have a solution. It is also looking tricky but I don't have an answer. ...

How to determine if a number is positive or negative in Java?

I was asked this question in Amazon Chennai(India) interview , to determine whether an number is positive or negative. The rules are that , we should not use conditional operators such as <, and >, built in java functions (like substring, indexOf, charAt, and startsWith), no regex, or API's. I did some homework on this and the code is gi...

Least amount of voters, given two halves.

One of my former students sent me a message about this interview question he got while applying for a job as a Junior Developer. There are two candidates running for president in a mock classroom election. Given the two percentages of voters, find out the least amount of possible voters in the classroom. Examples: Input: 50...

how to overload == operator to allow it to be used in multiple comparisons ?

Hi, I am trying to overload == operator to compare objects like below. class A { int a; public: A(int x) { a = x; } bool operator==(const A& obRight) { if(a == obRight.a) { return true; } return false; } }; int main() { A ob(10), ob2(10), ob3(10); if(ob == ob2) // ...

How to split a string into as few palindromes as possible ?

This is an interview question: "You're given a string, and you want to split it into as few strings as possible such that each string is a palindrome". (I guess a one char string is considered a palindrome, i.e. "abc" is split into "a", "b", "c".) How would you answer it? ...