## Remainder Problem

Find the sum of the remainders obtained when a number n is divided by 9 and 7 successively, if n is the smallest number that leaves respective remainders of 4, 6 and 9 when divided successively by 13, 11 and 15.

Source: www.time4education.com

Find Solution here

## Find the Number

Find the smallest number with the given properties

When I divide it by 2, the remainder is 1.
When I divide it by 3, the remainder is 2.
When I divide it by 4, the remainder is 3.
When I divide it by 5, the remainder is 4.
When I divide it by 6, the remainder is 5.
When I divide it by 7, the remainder is 6.
When I divide it by 8, the remainder is 7.
When I divide it by 9, the remainder is 8.
When I divide it by 10, the remainder is 9.

## Two Cords

You are given two cords that both burn exactly one hour, not necessarily with constant speed.
How should you light the cords in order to determine a time interval of exactly 15 minutes?

Source: Raphael Reischuk

## Buffer Overflow

Rewrite the program shown below so that it is no longer vulnerable to a buffer overflow.

int main (int argc, char *argv[]) {
bool valid = false;
char str1;
char str2;

/* This is some function that assigns some string to str1 */
next_tag(str1);

/* Read a string from standard input device (eg. keyboard) */

gets(str2);
if ( strncmp(str1, str2, 8) == 0 )

valid = true;
printf (“buffer1: str1(%s), str2(%s), valid(%d)n”,
str1, str2, valid);
}
Find Solution here

## Subtle Bug

The variable d is less than the Total elements, but still the if condition did not evaluate to true. Find the Bug.

Code:
#include <stdio.h>
int array_one[]={1,2,3,4,5,6};
#define TOTAL_ELEMENTS (sizeof(array_one)/sizeof(array_one))

int main()
{
int d=-1;
if(d<=TOTAL_ELEMENTS)
printf(“d is less than Total no. of elemnts in the array”); //execution never comes her
else
printf(“d is greater than total elements in the array”); //this will get printed
return 0;
}

## Reverse Words of a String

Write a Program and test cases for reversing the words of a string.
For Ex.

Input: We are aptitude and programming pros
Output: pros programming and aptitude are We

Find Solution here

## Chess Board Puzzle

You’ve got an 8×8 chess Board and a bunch of dominoes that each fit nicely on two squares of the chess Board.  You can easily tile the entire checkerboard with these dominoes. Now say that you remove two squares, one at one corner and the other at the opposite corner. You’re left with 62 squares.
Can you tile this with the dominoes?
If so, show how. If not, prove why not.

Source: www.careercup.com