Welcome Message

Hi, welcome to my website. This is a place where you can get all the questions, puzzles, algorithms asked in interviews and their solutions. Feel free to contact me if you have any queries / suggestions and please leave your valuable comments.. Thanks for visiting -Pragya.

March 30, 2010

Complied vs Interpreted languages

Programming languages generally fall into one of two categories: Compiled or Interpreted. With a compiled language, code you enter is reduced to a set of machine-specific instructions before being saved as an executable file. With interpreted languages, the code is saved in the same format that you entered. Compiled programs generally run faster than interpreted ones because interpreted programs must be reduced to machine instructions at runtime. However, with an interpreted language you can do things that cannot be done in a compiled language. For example, interpreted programs can modify themselves by adding or changing functions at runtime. It is also usually easier to develop applications in an interpreted environment because you don't have to recompile your application each time you want to test a small section.

March 26, 2010

Puzzle : The Elder Twin

One day Kerry celebrated her birthday. Two days later her older twin brother, Terry, celebrated his birthday. How come?

Sol : At the time she went into labor, the mother of the twins was traveling by boat. The older twin, Terry, was born first early on March 1st. The boat then crossed the international date line (or anytime zone line) and Kerry, the younger twin, was born on February the 28th. In a leap year the younger twin celebrates her birthday two days before her older brother..

http://www.bellaonline.com/articles/art39652.asp

March 24, 2010

Why can’t variable names start with numbers?

Because then a string of digits would be a valid identifier as well as a valid number.

int 17 = 497;
int 42 = 6 * 9;
String 1111 = "Totally text";

int 2d = 42;
double a = 2d;
What is a? 2.0? or 42?

Hint, if you don't get it, d after a number means the number before it is a double literal

http://stackoverflow.com/questions/342152/why-cant-variable-names-start-with-numbers