How I Spent the Christmas of 2016
About a month ago, in November, just before the end-term exams, our batch was told that this winter, extra classes will be scheduled for us and the winter break (earlier scheduled from December 25th...
Programming problems • Geek life • Logical puzzles • & more
About a month ago, in November, just before the end-term exams, our batch was told that this winter, extra classes will be scheduled for us and the winter break (earlier scheduled from December 25th...
There is a very interesting web design contest going on online, called 10k Apart. It puts emphasis on creating a website, "optimizing every little byte like your life depends on it and ensuring your...
There are three persons - Jack, Anne and George. Jack is looking at Anne, but Anne is looking at George. Jack is married, but George is not. Is a married person looking at an unmarried...
Rectify the following equation: 101 - 102 = 1. You are allowed to move just one digit. Answer: Show answer Move the numeral 2 half a line up to achieve: 101 - 102 = 1....
What 5-digit number has the following property: If we put numeral 1 before this number, we get a number three times smaller than the number we get if we put numeral 1 after this number....
What mathematical symbol can be placed between 5 and 9, to get a number greater than 5 and smaller than 9? Answer: Show answer Place a decimal point between them to get 5.9 Show('answerlink'); Hide('answer');...
The day before yesterday I was 25 and the next year I will be 28. This is true for only one day in a year. What day is my birthday? Answer: Show answer He was...
Problem statement: Given an integer, write a program to extract the nth byte from it. Example: Let's take an integer in hexadecimal format, say 0x5510EF3A (a 32-bit integer). It has four bytes, given in hexadecimal...
Problem statement: Given two integers, you need to check if they are equal or not, without using any comparison operators. Solution: An optimized solution can be given using bitwise XOR operator. The bitwise XOR of...
Problem statement: You are given two numbers A and B. Write a program to count the number of bits needed to be flipped to convert A to B. Example: Let A = 5 and B...
Consider the following code snippet: char *p = NULL; printf ("%s", p); What should be the output of the above code? The printf() function with "%s" format specifier expects a '\0'-terminated array of characters (or...
One of the most seen snippets of code is the one that swaps the values of two variables. This little job is crucial to many algorithms, and there are multiple ways of doing it. Generally,...
There are 100 statements. 1st one says: At least one statement is wrong. 2nd one says: At least two statements are wrong. 3rd one says: At least three statements are wrong. 4th one says: At...
You are standing before two closed doors. One of the doors leads to heaven and the other one leads to hell. There are two guards, one by each door. You know that one of them...
Command line arguments, as discussed here, can be used to make a program run differently on different executions. The user is able to pass additional parameters while running a program, so that it can behave...
© Anirudh Khanna 2016 - 2025
Powered by Blogger