interview-questions

Simple to advanced SQL queries examples to practice MySQL query performance optimization

Hi, Looking for websites/books SQL queries from simple to advance (queries optimization and performanance etc.. ) questions and examples to exam for MySQL Job. Thanks ...

int var = 1; void main() { int i = i; }

This is an interview question that I had: int var = 1; void main() { int i = i; } What is the value of i after assignment? It is really compiler dependent or is it just undefined? My g++ on cygwin seems to give me 0 all the time. Thanks ...

How to write own dynamic_cast

Hi, This have been asked in the interview. How to write own dynamic_cast. I think, on the basis of typeid's name function. Now how to implement own typid? I have no clue on it. ...

new, delete ,malloc & free

This question was asked to me in an interview: In C++, what if we allocate memory using malloc and use delete to free that allocated memory? what if we allocate the memory using new and free it using free? What are the problems that we would face if the above things are used in the code? My answer was there is no...

Interview Question - Flipping Bits

I recently saw an interview question asking the following: Given a 32 bit number, write pseudo code to flip the second last bit What is the best/easiest way to do this? ...

I/O methods in C

Hi, I am looking for various ways of reading/writing data from stdin/stdout. Currently I know about scanf/printf, getchar/putchar and gets/puts. Are there any other ways of doing this? Also I am interesting in knowing that which one is most efficient in terms of Memory and Space. Thanks in Advance ...

SQL interview question

I got following question on an interview: Which SQL mechanisms allow user to browse tables sequentially? ...

With respect to an array containing a lot of duplicate elements, is there any operations to improve the performance of normal binary search?

With respect to an array containing a lot of duplicate elements, is there any operations to improve the performance of normal binary search? ...

Lucene Interview Questions

I am interviewing candidates for a position developing an application which relies heavily on Lucene. In addition to the usual questions I ask, I'd like to be able to ask one or two Lucene-specific questions that will give me a rough idea of how familiar they are with the library. The problem is that I have no experience with Lucene my...

An onsite implementation question from a startup.

The system maintains a table with 150 pages, and each page contains 1.5 million records hashed with users’ birth date. Each record includes information of username, nickname, birth date, hometown and title. We are required to write a C++ program that transforms this table into another one, which has 100 pages and is hashed with username....

Should I put a license on code submitted to a potential employer?

I am currently applying for a position and have been asked to essentially write two small apps. I started wondering if I should put some license on the code before I submit. I honestly do not keep up with all the different licenses, but know there are many to choose from. The question is should I put a license on the code? If so which o...

An interview question - implement Biginteger Multiply

Implement Biginteger Multiply use integer array to store a biginteger like 297897654 will be stored as {2,9,7,8,9,7,6,5,4} implement the multiply function for bigintegers Expamples: {2, 9, 8, 8, 9, 8} * {3,6,3,4,5,8,9,1,2} = {1,0,8,6,3,7,1,4,1,8,7,8,9,7,6} I failed to implement this class and thought it for a few weeks, couldn't get...

how to get page size

I was asked this question in an interview Plz tell me the answer :- You have no documentation of the kernel. You only knows that you kernel supports paging. How will you find that page size ? There is no flag or macro you have that can tell you about page size. I was given the hint as you can use Time to get the answer. I still have no...

What are some good interview questions for Distributed Systems?

For a job that has a bend for distributed systems, what would you ask the candidate? Easy, intermediate and advanced questions are all welcome. I don't have specific requirements for the job. General questions are fine. On top of my head I can think of: Advanced (?) 2-phase commit protocol 3-phase commit protocol ...

Looking for SQL Optimization Interview Questions

I'm on a project where I was asked to take a quick peek at some reporting SQL (in a SQL Server 2K5 environment) and was surprised at what I found: 4 to 5 levels of subquerys, distinct clauses, unions, and NoLock hints (which were needed because the SQL was running so long it was blocking standard processing) - all in the same set!. Beca...

An interview question - Split text into sub-strings according to rules

Split text into sub-strings according to below rules: a) The length of each sub-string should less than or equal to M b) The length of sub-string should less than or equal to N (N < M) if the sub-string contains any numeric char c) The total number of sub-strings should be as small as possible I have no clue how to solve this questi...

What happens if I started creating/closing DB connections in "JSP"?

Hello, I just happened to read this post :- http://stackoverflow.com/questions/2114212/questions-every-good-java-j2ee-developer-should-be-able-to-answer/2117595#2117595 On this link there is one question by Elister :- What happens if I started creating/closing DB connections in "JSP"? I am not able to answer this. What would happen? A...

How to display flat data structure into hierarchical data structure (Java)?

Hi all , I have recently faced this question in a practical test for a job . Suppose you are given a flat data structure like this : **Category** **Name** **Parent** 1 electronics 0 2 Television 1 3 21inch 2 4 23in...

choosing between algorithms

Hi All, I am sure there are lot of Software Testing Engineers, Algorithm Validation Engineers on Stackoverflow.Could someone please tell me how would one proceed in the following scenario. Say we have a Mammogram and 5 different algorithms which take this mammogram as input and identify if there is Cancer in the patient. If 3 out of 5 ...

Is there an easy way to remember the rotation methods for red-black trees?

Is there an easy way to remember the rotation methods for red-black trees? ...