Skip to main content

Interview question #1

Since I have been asked to interview experienced PHP programmers, I was preparing few interview questions. I came to know, most of the people ask questions found in the Internet; most of them are like "What is the function used to connect MySQL DB in PHP". Personally, I don't like these types of questions; I'd thought the person must apply ideas what he was taught in colleges--finally I came out with one question:

A product vendor has Quantity Vs. Price data like
1 -> Rs. 50
2 -> Rs. 95
3 -> Rs. 140
.... like upto 1 million data. He wants a system, which gives the price when the quantity is provided. For example, if you provide the quantity value as 2, then it should provide Rs. 95. How this system can be designed?

As expected, all the people said about using database tables and quering on quantity. I have asked them to find out a system which doesn't use databases--provided the accuracy of the system may not be 100%--it may give at least 90% accuracy. To my surprise, none of the people I have interviewed yet didn't provide any solutions.

I must find out few other questions especially for a post of "Web Application Developer".

Comments

Anonymous said…
amount = (45 * quantity ) + 5
For comment#1:Good, if the data are just 3. What if you have about 1 million data? What is the procedure?
Anonymous said…
use Chi Square
For comment#3:You've exceeded my expectation:-) I'd rather expect even a simple keyword. May I know your name?
Anonymous said…
Is it possible to use an associative array(performance?)? - like

$product[$price] = $quantity;
Online Pharmacy said…
This comment has been removed by a blog administrator.
Sindhuja said…
$amount = (45 * ($quantity -1)) + 50

Popular posts from this blog

Open source resume templates with JSON-LD (SEO-friendly) support

I don't usually keep track of the projects that I worked on. I have been recently advised to keep resume updated with the projects list. And so I have searched for resume templates and tools. Indian resume Vs International resume During the process, I have found that there are vast differences between the format of Indian resumes and International resumes. Indian resumes are extremely verbose with number of projects, team size, client name, etc. whereas international format is more succinct and short. So I was kind of lost in the process in adopting the template. LinkedIn to the rescue? No. Unfortunately, LinkedIn format is "common" and is not easy to update. Moreover, these days LinkedIn has become signupware [sic] and so accessing resume is a nightmare. Enter JSON Resume JSON Resume is an awesome open source approach for creating resume. I accidentally came across while searching for JSON-LD format for resume. Couple of great features: Resume hosting (op...

How girls ruin...?

மது, à®®ாது, சூது (liquor, girl, crookedness) - Tamil tantras list down one's reason for fall/collapse. In recent times, I'm hearing many relational breakups and personal collapse due to "girl". Some even seem to have damaged career, business, friends, family, etc. I'm thinking, how come such girls are getting cabal and ruin things... Not to blame it on them--but to blame it on guys...

Interview question #2

This is related to PHP's array . An array has number of elements. All elements are integers and unique, which means there is no repetitive integers. (e.g.) $foo = array(7, 5, 9, 13, 2, 8); You have to sort the array, provided: You should scan the elements only once. You're not allowed to compare the elements when sorting. (i.e., you're not supposed to use any comparison operators) Sorted resultant array may not be the source array. How will you do that?