interview-questions

What does it mean when we say Hashtable or Vector is synchronized?

The questions says it all, just wondering, in an interview, what would you say when they ask you, "What does it practically mean by Hashtable or Vectors being synchronized?" ...

How to find a duplicate element in an array of shuffled consecutive integers?

I recently came across a question somewhere: Suppose you have an array of 1001 integers. The integers are in random order, but you know each of the integers is between 1 and 1000 (inclusive). In addition, each number appears only once in the array, except for one number, which occurs twice. Assume that you can access each element of ...

ASP.net Interview Question

Recently i was asked (1) "How will you do performance optimization over your jQuery in ASP.net ?" (2) "How many script manager can we have in ASP.net Application?" why? (Ajax related). I have no ideas on both.Help me to grow. ...

how is push_back implemented in STL vector?

I was asked this question in an interview. The points I answered are like this 1) an index pointing to the current position; 2) resize if neccessary. Can anybody elaborate more? ...

form a number using consecutive numbers

Hi, I was puzzled with one of the question in Microsoft interview which is as given below: A function should accept a range( 3 - 21 ) and it should print all the consecutive numbers combinations to form each number as given below: 3 = 1+2 5 = 2+3 6 = 1+2+3 7 = 3+4 9 = 4+5 10 = 1+2+3+4 11 = 5+6 12 = 3+4+5 13 = 6+7 14 = 2+3+4+5 15...

When should one use nullable types in c#?

I have been repeatedly asked these question in many interviews.... But still can't able to explain them with a simple example... What is nullable types in c#?When should one use nullable types in c#?Any simple ex? Any suggestion.... ...

Classic string manipulation interview questions?

Hi, I am scheduled to have an onsite interview so I am preparing few basic questions. According to the company profile, they are big on string manipulation questions. So far I have manually coded these functions: String length, copy, concat, remove white space Reverse Anagrams Palindrome Please can some can give me a list of more cla...

Accenture interview question - Find the only unpaired element in the array

You have been given an array of size 2n+1 that have n pair of integers(can be +ve, -ve or 0) and one unpaired element. How would you find the unpaired element. Pair means duplicate. So (3,3) is a pair and (3,-3) is not a pair. ...

Interview question: How to detect a loop in a linked list?

Say you have a linked list structure in Java. It's made up of Nodes: class Node { Node next; // some user data } and each Node points to the next node, except for the last Node, which has null for next. Say there is a possibility that the list can contain a loop - i.e. the final Node, instead of having a null, has a referenc...

Looking for a few good C# interview problems.

I do not want to ask candidates questions, but rather give them several problems to resolve. The reason for this is that I've seen people be excellent with theory, but when confronted by a real world c# issue, just couldn't hack it. These c# problems should be simple enough that it won't take more than 1-20 minutes to resolve, yet comp...

Calculate occurrences of specified word in a large text file

This is an interview question, and should concern about efficiency. How to calculate occurrences of specified word in a large text file? I can only think of indexOf() method in most programming languages, but I don't think that the correct answer. ...

How to find the longest palindrome in a given string?

Possible Duplicate: Write a function that returns the longest palindrome in a given string I know how to do this in O(n^2). But it seems like there exist a better solution. I've found this, and there is a link to O(n) answer, but it's written in Haskell and not clear for me. It would be great to get an answer in c# or simila...

Interview Q: given an array of numbers, return array of products of all other numbers (no division)

I was asked this question in a job interview, and I'd like to know how others would solve it. I'm most comfortable with Java, but solutions in other languages are welcome. Given an array of numbers, nums, return an array of numbers products, where products[i] is the product of all nums[j], j != i. Input : [1, 2, 3, 4, 5] Output: [(2...

why null pointer exception is not declared as checked exception?

Hi This was the question asked in interview, null pointer exception is very common why it is not declared as checked exception.I googled but did not get proper answer. Thanks ...

Dynamic Programming Algorithm?

I am confused about how best to design this algorithm. A ship has x pirates, where the age of the jth pirate is aj and the weight of the jth pirate is wj. I am thinking of a dynamic programming algorithm, which will find the oldest pirate whose weight is in between twenty-fifth and seventy-fifth percentile of all pirates. But I am cluele...

What are some good examples where SQL's OUTER JOIN is used?

I often get asked the questions in an interview that "what is an outer join in SQL"? While it can be answered, I wonder what might be some classic and good real life examples where a (LEFT) OUTER JOIN is used? ...

Crash the program with cmd line args

Lets us consider the following program : #include <stdlib.h> int main(int argc, char **argv){ int a,b; if (argc != 3) return -1; a = atoi(argv[1]); b = atoi(argv[2]); a = b ? a/b : 0; return a; } The task is to crash the program by providing arguments in command-line. ...

How do you know it's good code - Interview Question.

During a phone interview someone asked the question, "When looking at code, what's the first thing that stands out to let you know it's from a good/experienced developer?" I believe my answer was sufficient, just thought it was a bit strange so I'm curious how some of you would answer? EDIT: thank you for all the answers. One of the r...

What's up with this reversing bit order function?

I'm rather ashamed to admit that I don't know as much about bits and bit manipulation as I probably should. I tried to fix that this weekend by writing some 'reverse the order of bits' and 'count the ON bits' functions. I took an example from here but when I implemented it as below, I found I had to be looping while < 29. If I loop while...

How to test a struts 2.1.x developer?

We employ a test to filter out candidates who should not be applying for a position. The tests are designed to be very low effort for those who should be applying and too much effort for those who are not experienced. Here is an example of a test we give to a candidate applying for a job of “java web application developer on an Oracle p...