Friday, August 13, 2010

Aptitude Questions Set No 6

[Predict the output or error(s) for the following:]

1. struct point
int x;
int y;
struct point origin,*pp;
printf("origin is(%d,%d)\n",(*pp).x,(*pp).y);
printf("origin is (%d,%d)\n",pp->x,pp->y);
origin is(0,0)
origin is(0,0)
pp is a pointer to structure. we can access the elements of the structure either with arrow
mark or with indirection operator.
Since structure point is globally declared x & y are initialized as zeroes

2. main()
int i=_l_abc(10);
int _l_abc(int i)
return(i++) it will first return i and then increments. i.e. 10 will be returned.

3. main()
char *p;
int *q;
long *r;
++ operator when applied to pointers increments address according to their corresponding data-types.

4. main()
char c=' ',x,convert(z);
if((c>='a') && (c<='z'))
return z-32;
Compiler error
declaration of convert and format of getc() are wrong.

5. main(int argc, char **argv)
printf("enter the character");
int num1,num2;
return num1+num2;
Compiler error.
argv[1] & argv[2] are strings. They are passed to the function sum without converting it to integer values.

6. int one_d[]={1,2,3};
int *ptr;
garbage value
ptr pointer is pointing to out of the array range of one_d.

7. aaa()
printf("how are you?\b");
int (*ptr[3])();
how are you?
ptr is array of pointers to functions of return type int.ptr[0] is assigned to address of the function aaa. Similarly ptr[1] and ptr[2] for bbb and ccc respectively. ptr[2]() is in effect of writing ccc(), since ptr[2] points to ccc.

8. main()
FILE *ptr;
char i;
contents of zzz.c followed by an infinite loop
The condition is checked against EOF, it should be checked against NULL.

9. main()
int i =0,j=0;
if(i && j++)
The value of i is 0. Since this information is enough to determine the truth value of the boolean expression. So the statement following the if statement is not executed. The values of i and j remain unchanged and get printed.

10. main()
int i;
i = abc();
_AX = 1000;
Normally the return value from the function is through the information from the accumulator. Here _AX is the pseudo global variable denoting the accumulator. Hence, the value of the accumulator is set 1000 so the function returns value 1000.

Aptitude Questions Set No 5

[Write the output of the following code snippets if correct or the error it may generate.]

1) #include
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
printf("%d",++*p + ++*str1-32);

p is pointing to character '\n'. str1 is pointing to character 'a' ++*p. "p is pointing to '\n' and that is incremented by one." the ASCII value of '\n' is 10, which is then incremented to 11. The value of ++*p is 11. ++*str1, str1 is pointing to 'a' that is incremented by 1 and it becomes 'b'. ASCII value of 'b' is 98.
Now performing (11 + 98 – 32), we get 77("M");
So we get the output 77 :: "M" (Ascii is 77).

2) #include
int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };
int *p,*q;

p=&a[2][2][2] you declare only two 2D arrays, but you are trying to access the third 2D(which you are not declared) it will print garbage values. *q=***a starting address of a is assigned integer pointer. Now q is pointing to starting address of a. If you print *q, it will print first element of 3D array.

3) #include
struct xx
int x=3;
char name[]="hello";
struct xx *s;
Compiler Error
You should not initialize variables in declaration

4) #include
struct xx
int x;
struct yy
char s;
struct xx *p;
struct yy *q;

Compiler Error
The structure yy is nested within structure xx. Hence, the elements are of yy are to be accessed through the instance of structure xx, which needs an instance of yy to be known. If the instance is created after defining the structure the compiler will not know about the instance relative to xx. Hence for nested structure yy you have to declare member.

5) main()

\n - newline
\b - backspace
\r - linefeed

6) main()
int i=5;

The arguments in a function call are pushed into the stack from left to right. The evaluation is by popping out from the stack and the evaluation is from right to left, hence the result.

7) #define square(x) x*x
int i;
i = 64/square(4);

the macro call square(4) will substituted by 4*4 so the expression becomes i = 64/4*4 .
Since / and * has equal priority the expression will be evaluated as (64/4)*4 i.e. 16*4 = 64

8) main()
char *p="hai friends",*p1;
while(*p!='\0') ++*p++;
printf("%s %s",p,p1);

++*p++ will be parse in the given order
 *p that is value at the location currently pointed by p will be taken
 ++*p the retrieved value will be incremented
 when ; is encountered the location will be incremented that is p++ will be executed. Hence, in the while loop initial value pointed by p is ‘h’, which is changed to ‘i’ by executing ++*p and pointer moves to point, ‘a’ which is similarly changed to ‘b’ and so on. Similarly blank space is converted to ‘!’. Thus, we obtain value in p becomes “ibj!gsjfoet” and since p reaches ‘\0’ and p1 points to p thus p1doesnot print anything.

9) #include
#define a 10
#define a 50

The preprocessor directives can be redefined anywhere in the program. So the most recently assigned value will be taken.

10) #define clrscr() 100

Preprocessor executes as a seperate pass before the execution of the compiler. So textual
replacement of clrscr() to 100 occurs.The input program to compiler looks like this :
100; is an executable statement but with no action. So it doesn't give any problem

Aptitude Questions Set No 4

1. The legendary king Midas possessed a huge amount of gold. He hid this treasure carefully: in a building consisting of a number of rooms. In each room there were a number of boxes; this number was equal to the number of rooms in the building. Each box contained a number of golden coins that equaled the number of boxes per room. When the king died, one box was given to the royal barber. The remainder of the coins had to be divided fairly between his six sons. Is a fair division possible in all situations?
A fair division of Midas' coins is indeed possible. Let the number of rooms be N. This means that per room there are N boxes with N coins each. In total there are NxNxN = N^3 coins. One box with N coins goes to the barber. For the six brothers, N^3 - N coins remain. We can write this as: N(N^2 - l), or: N(N - 1)(N + l). This last expression is divisible by 6 in all cases, since a number is divisible by 6 when it is both divisible by 3 and even. This is indeed the case here: whatever N may be, the expression N(N - 1)(N + l) always contains three successive numbers. One of those is always divisible by 3, and at least one of the others is even. This even holds when N=1; in that case all the brothers get nothing, which is also a fair division!

2. On a sunny morning, a greengrocer places 200 kilograms of cucumbers in cases in front of his shop. At that moment, the cucumbers are 99% water. In the afternoon, it turns out that it is the hottest day of the year, and as a result, the cucumbers dry out a little bit. At the end of the day, the greengrocer has not sold a single cucumber, and the cucumbers are only 98% water. How many kilograms of cucumbers has the greengrocer left at the end of the day?
In the morning, the 200 kilograms of cucumbers are 99% water. So the non-water part of the cucumbers has a mass of 2 kilograms. At the end of the day, the cucumbers are 98% water. The remaining 2% is still the 2 kilograms of non-water material (which does not change when the water evaporates). If 2% equals 2 kilograms, then 100% equals 100 kilograms. So, the greengrocer has 100 kilograms of cucumbers left at the end of the day.

3. A swimmer jumps from a bridge over a canal and swims 1 kilometer stream up. After that first kilometer, he passes a floating cork. He continues swimming for half an hour and then turns around and swims back to the bridge. The swimmer and the cork arrive at the bridge at the same time. The swimmer has been swimming with constant speed. How fast does the water in the canal flow?
If you have written down a full paper of mathematical formulas, you have been thinking too complicated...It is obvious that the cork does not move relatively to the water (i.e. has the same speed as the water). So if the swimmer is swimming away from the cork for half an hour (up stream), it will take him another half hour to swim back to the cork again. Because the swimmer is swimming with constant speed (constant relatively to the speed of the water!) you can look at it as if the water in the river doesn't move, the cork doesn't move, and the swimmer swims a certain time away from the cork and then back. So in that one hour time, the cork has floated from 1 kilometer up stream to the bridge. Conclusion: The water in the canal flows at a speed of 1 km/hr.
4. Consider a road with two cars, at a distance of 100 kilometers, driving towards each other. The left car drives at a speed of forty kilometers per hour and the right car at a speed of sixty kilometers per hour. A bird starts at the same location as the right car and flies at a speed of 80 kilometers per hour. When it reaches the left car it turns its direction, and when it reaches the right car it turns its direction again to the opposite, etcetera. What is the total distance that the bird has traveled at the moment that the two cars have reached each other?
If you have written down a full paper of mathematical formulas, you haven't been thinking in the right direction. It is obvious that the two cars meet each other after one hour. On that moment, the bird has flown for one hour. Conclusion: The bird has flown 80 km/h x 1 h = 80 km.

5. A number is called a palindrome when it is equal to the number you get when all its digits are reversed. Postman Pat delivers the mail in the small village Tenhouses. This village, as you already suspected, has only one street with exactly ten houses, numbered from 1 up to and including 10. In a certain week, Pat did not deliver any mail at two houses in the village; at the other houses he delivered mail three times each. Each working day he delivered mail at exactly four houses. The sums of the house numbers where he delivered mail were: on Monday: 18 on Tuesday: 12 on Wednesday: 23 on Thursday: 19 on Friday: 32 op Saturday: 25 on Sunday: he never works Which two houses didn't get any mail that week?
If postman Pat would have delivered mail three times at each house, then the total sum of the house numbers per day would be (1+2+3+4+5+6+7+8+9+10)×3=165. Now that sum is 18+12+23+19+32+25=129. The difference is 165-129=36; divided by 3 this is 12. The sum of the house numbers where no mail was delivered is therefore 12. The following combinations are possible: 2+10

Each day at four houses the mail was delivered. On Tuesday the sum was 12. 12 can only be made from four house numbers in 2 ways:

The same holds for Friday with the sum of 32


From this we can conclude that the house numbers 1, 2, 9 and 10 for sure have received mail, which means that the combinations 2+10 and 3+9 are not possible. Also the combination 5+7 is not possible, because mail was delivered either at house 5 or at house 7. Thus the only remaining solution is: houses 4 and 8.

N.B.: there are various possibilities for the actual post delivery of the whole week. For example: Monday houses 1, 3, 5 and 9

Tuesday houses 1, 2, 3 and 6

Wednesday houses 1, 5, 7 and 10

Thursday houses 2, 3, 5 and 9

Friday houses 6, 7, 9 and 10

Saturday houses 2, 6, 7 and 10 .

6. You walk upwards on an escalator, with a speed of 1 step per second. After 50 steps you are at the end. You turn around and run downwards with a speed of 5 steps per second. After 125 steps you are back at the beginning of the escalator. How many steps do you need if the escalator stands still?
Let v be the speed of the escalator, in steps per second. Let L be the number of steps that you need to take when the escalator stands still. Upwards (along with the escalator), you walk 1 step per second. You need 50 steps, so that takes 50 seconds. This gives: L - 50 × v = 50. Downwards (against the direction of the escalator), you walk 5 steps per second. You need 125 steps, so that takes 25 seconds. This gives: L + 25 × v = 125. From the two equations follows: L = 100, v = 1. When the escalator stands still, you need 100 steps.
7. A number is called a palindrome when it is equal to the number you get when all its digits are reversed. For example, 2772 is a palindrome. We discovered a curious thing. We took the number 461, reversed the digits, giving the number 164, and calculated the sum of these two numbers: 461 164 + ------- 625 We repeated the process of reversing the digits and calculating the sum two more times: 625 526 + ------- 1151 1511 + ------- 2662 To our surprise, the result 2662 was a palindrome. We decided to see if this was a pure coincidence or not. So we took another 3-digit number, reversed it, which gave a larger number, and added the two. The result was not a palindrome. We repeated the process, which resulted in another 3-digit number which was still not a palindrome. We had to repeat the process twice more to finally arrive at a 4-digit number which was a palindrome. What was the 3-digit number we started with the second time?
Because the reverse of the starting number is greater than the starting number itself, the first digit of the starting number must be less than the last digit. Therefore, the starting number must be at least 102. Secondly, we know that after two summations, the result has still only 3 digits.

cba +
fed +

8. General Gasslefield, accused of high treason, is sentenced to death by the court-martial. He is allowed to make a final statement, after which he will be shot if the statement is false or will be hung if the statement is true. Gasslefield makes his final statement and is released. What could he have said?
General Gasslefield said: "I will be shot." If this statement was true, he would have been hung and thus not be shot. But then his statement would be false, which implies that he should be shot, making the statement true again, etc... In other words: the verdict of the court-martial could not be executed and the general was released.

9. On a nice summer day two tourists visit the Dutch city of Gouda. During their tour through the center they spot a cosy terrace. They decide to have a drink and, as an appetizer, a portion of hot "bitterballs" (bitterballs are a Dutch delicacy, similar to croquettes). The waiter tells them that the bitterballs can be served in portions of 6, 9, or 20. What is the largest number of bitterballs that cannot be ordered in these portions?
Every natural number is member of one of the following six series:
0, 6, 12, 18, ...
1, 7, 13, 19, ...
2, 8, 14, 20, ...
3, 9, 15, 21, ...
4, 10, 16, 22, ...
5, 11, 17, 23, ...

If for a number in one of these series holds that it can be made using the numbers 6, 9, and 20, then this also holds for all subsequent numbers in the series (by adding a multiple of 6). To find out what the largest number is that cannot be made using the numbers 6, 9, and 20, we therefore only need to know, for every series, what the smallest number is that can be made in that way. In the series 0, 6, 12, 18, ... the smallest number that can be made is 0 so there is no number that cannot be made.In the series 1, 7, 13, 19, ... the smallest number that can be made is 49 (20+20+9) so 43 is the largest number that cannot be made.

In the series 2, 8, 14, 20, ... the smallest number that can be made is 20 so 14 is the largest number that cannot be made.In the series 3, 9, 15, 21, ... the smallest number that can be made is 9 so 3 is the largest number that cannot be made.In the series 4, 10, 16, 22, ... the smallest number that can be made is 40 (20+20) so 34 is the largest number that cannot be made.In the series 5, 11, 17, 23, ... the smallest number that can be made is 29 (20+9) so 23 is the largest number that cannot be made.Therefore, 43 is the largest number that cannot be made using the numbers 6, 9, and 20..

10. Two friends, Alex and Bob, go to a bookshop, together with their sons Peter and Tim. All four of them buy some books; each book costs a whole amount in shillings. When they leave the bookshop, they notice that both fathers have spent 21 shillings more than their respective sons. Moreover, each of them paid per book the same amount of shillings as books that he bought. The difference between the number of books of Alex and Peter is five. Who is the father of Tim?
For each father-son couple holds: the father bought x books of x shillings, the son bought y books of y shillings. The difference between their expenses is 21 shillings, thus x2 - y2 = 21. Since x and y are whole numbers (each book costs a whole amount of shillings), there are two possible solutions: (x=5, y=2) or (x=11, y=10). Because the difference between Alex and Peter is 5 books, this means that father Alex bought 5 books and son Peter 10. This means that the other son, Tim, bought 2 books, and that his father is Alex.

11. A man decides to buy a nice horse. He pays $60 for it, and he is very content with the strong animal. After a year, the value of the horse has increased to $70 and he decides to sell the horse. But already a few days later he regrets his decision to sell the beautiful horse, and he buys it again. Unfortunately he has to pay $80 to get it back, so he loses $10. After another year of owning the horse, he finally decides to sell the horse for $90. What is the overall profit the man makes?
Consider the trade-story as if it describes two separate trades, where: In the first trade, the man buys something for $60 and sells it again for $70, so he makes a profit of $10.
In the second trade, the man buys something for $80 and sells it again for $90, so he makes again a profit of $10.
Conclusion: The man makes an overall profit of $10 + $10 = $20.
You can also look at the problem as follows: the total expenses are $60 + $80 = $140 and the total earnings are $70 + $90 = $160. The overall profit is therefore $160 - $140 = $20.

12. Yesterday evening, Helen and her husband invited their neighbors (two couples) for a dinner at home. The six of them sat at a round table. Helen tells you the following: "Victor sat on the left of the woman who sat on the left of the man who sat on the left of Anna. Esther sat on the left of the man who sat on the left of the woman who sat on the left of the man who sat on the left of the woman who sat on the left of my husband. Jim sat on the left of the woman who sat on the left of Roger. I did not sit beside my husband." What is the name of Helen's husband?
From the second statement, we know that the six people sat at the table in the following way (clockwise and starting with Helen's husband):

Helen's husband, woman, man, woman, man, Esther Because Helen did not sit beside her husband, the situation must be as follows: Helen's husband, woman, man, Helen, man, Esther The remaining woman must be Anna, and combining this with the first statement, we arrive at the following situation:Helen's husband, Anna, man, Helen, Victor, Esther Because of the third statement, Jim and Roger can be placed in only one way, and we now know the complete order:Helen's husband Roger, Anna, Jim, Helen, Victor, Esther Conclusion: the name of Helen's husband is Roger.

13. In the middle of a round pool lies a beautiful water-lily. The water-lily doubles in size every day. After exactly 20 days the complete pool will be covered by the lily. After how many days will half of the pool be covered by the water-lily?
Because the water-lily doubles its size every day and the complete pool is covered after 20 days, half of the pool will be covered one day before that, after 19 days. Conclusion: After 19 days half of the pool will be covered by the water-lily

14. Jack and his wife went to a party where four other married couples were present. Every person shook hands with everyone he or she was not acquainted with. When the handshaking was over, Jack asked everyone, including his own wife, how many hands they shook. To his surprise, Jack got nine different answers. How many hands did Jack's wife shake?
Because, obviously, no person shook hands with his or her partner, nobody shook hands with more than eight other people. And since nine people shook hands with different numbers of people, these numbers must be 0, 1, 2, 3, 4, 5, 6, 7, and 8. The person who shook 8 hands only did not shake hands with his or her partner, and must therefore be married to the person who shook 0 hands. The person who shook 7 hands, shook hands with all people who also shook hands with the person who shook 8 hands (so in total at least 2 handshakes per person), except for his or her partner. So this person must be married to the person who shook 1 hand. The person who shook 6 hands, shook hands with all people who also shook hands with the persons who shook 8 and 7 hands (so in total at least 3 handshakes per person), except for his or her partner. So this person must be married to the person who shook 2 hands. The person who shook 5 hands, shook hands with all people who also shook hands with the persons who shook 8, 7, and 6 hands (so in total at least 4 handshakes per person), except for his or her partner. So this person must be married to the person who shook 3 hands. The only person left, is the one who shook 4 hands, and which must be Jack's wife. The answer is: Jack's wife shook 4 hands.
15. Hans is standing behind Gerrie and at the same time Gerrie is standing behind Hans. How is this possible
Hans and Gerrie are standing with their backs towards each other!

16. A cyclist drove one kilometer, with the wind in his back, in three minutes and drove the same way back, against the wind in four minutes. If we assume that the cyclist always puts constant force on the pedals, how much time would it take him to drive one kilometer without wind?
The cyclist drives one kilometer in three minutes with the wind in his back, so in four minutes he drives 1 1/3 kilometer. Against the wind, he drives 1 kilometer in four minutes. If the wind helps the cyclist during four minutes and hinders the cyclist during another four minutes, then - in these eight minutes - the cyclist drives 2 1/3 kilometers. Without wind, he would also drive 2 1/3 kilometers in eight minutes and his average speed would then be 17.5 kilometers per hour. So it will take him 3 3/7 minutes to drive one kilometer.

17. Three salesmen went into a hotel to rent a room. The manager stated that he had only one room left, but all three could use it for $30.00 for the night. The three salesmen gave him $10.00 each and went up to their room. Later, the manager decided that he had charged the salesmen too much so he called the bellhop over, gave him five one-dollar bills, and said: 'Take this $5.00 up to the salesmen and tell them I had charged them too much for the room'. On the way up, the bellhop knew that he could not divide the five one-dollar bills equally so he put two of the one-dollar bills in his pocket and returned one one-dollar bill to each of the salesmen. This means that each salesman paid $9.00 for the room. The bellhop kept $2.00. Three times nine is 27 plus two is 29....... What happened to the extra dollar?
The calculation just makes no sense. The three salesman paid $27, of which the manager got $25 and the bellhop $2. Conclusion: There's no dollar missing at all.

18. Below is an equation that isn't correct yet. By adding a number of plus signs and minus signs between the ciphers on the left side (without changes the order of the ciphers), the equation can be made correct. 123456789 = 100 How many different ways are there to make the equation correct?
There are 11 different ways:
Remark: if it is not only allowed to put plus signs and minus signs between the ciphers, but also in front of the first 1, then there is a twelfth possibility:

19. Tom has three boxes with fruits in his barn: one box with apples, one box with pears, and one box with both apples and pears. The boxes have labels that describe the contents, but none of these labels is on the right box. How can Tom, by taking only one piece of fruit from one box, determine what each of the boxes contains?
Tom takes a piece of fruit from the box with the labels 'Apples and Pears'. If it is an apple, then the label 'Apples' belong to this box. The box that said 'Apples', then of course shouldn't be labeled 'Apples and Pears', because that would mean that the box with 'Pears' would have been labeled correctly, and this is contradictory to the fact that none of the labels was correct. On the box with the label 'Appels' should be the label 'Pears'. If Tom would have taken a pear, the reasoning would have been in a similar way.

20. Richard is a strange liar. He lies on six days of the week, but on the seventh day he always tells the truth. He made the following statements on three successive days: Day 1: "I lie on Monday and Tuesday." Day 2: "Today, it's Thursday, Saturday, or Sunday." Day 3: "I lie on Wednesday and Friday." On which day does Richard tell the truth?
We know that Richard tells the truth on only a single day of the week. If the statement on day 1 is untrue, this means that he tells the truth on Monday or Tuesday. If the statement on day 3 is untrue, this means that he tells the truth on Wednesday or Friday. Since Richard tells the truth on only one day, these statements cannot both be untrue. So, exactly one of these statements must be true, and the statement on day 2 must be untrue. Assume that the statement on day 1 is true. Then the statement on day 3 must be untrue, from which follows that Richard tells the truth on Wednesday or Friday. So, day 1 is a Wednesday or a Friday. Therefore, day 2 is a Thursday or a Saturday. However, this would imply that the statement on day 2 is true, which is impossible. From this we can conclude that the statement on day 1 must be untrue. This means that Richard told the truth on day 3 and that this day is a Monday or a Tuesday. So day 2 is a Sunday or a Monday. Because the statement on day 2 must be untrue, we can conclude that day 2 is a Monday. So day 3 is a Tuesday. Therefore, the day on which Richard tells the truth is Tuesday.

21. Assume that you have a number of long fuses, of which you only know that they burn for exactly one hour after you lighted them at one end. However, you don't know whether they burn with constant speed, so the first half of the fuse can be burnt in only ten minutes while the rest takes the other fifty minutes to burn completely. Also assume that you have a lighter. How can you measure exactly three quarters of an hour with these fuses? Hint: 2fuses are sufficient to measure three quarter of an hour Hint: A fuse can be lighted from both ends at the same time(which reduces its burning time significantly)
With only two fuses that burn exactly one hour, one can measure three quarters of an hour accurately, by lighting the first fuse at both ends and the other fuse at one end simultaneously. When the first fuse is burnt out after exactly half an hour (!) you know that the second fuse still has exactly half an hour to go before it will be burnt completely, but we won't wait for that. We will now also light the other end of the second fuse. This means that the second fuse will now be burnt completely after another quarter of an hour, which adds up to exactly three quarters of an hour since we started lighting the first fuse!

22. A banana plantation is located next to a desert. The plantation owner has 3000 bananas that he wants to transport to the market by camel, across a 1000 kilometre stretch of desert. The owner has only one camel, which carries a maximum of 1000 bananas at any moment in time, and eats one banana every kilometre it travels. What is the largest number of bananas that can be delivered at the market?
The Solution: 533 1/3 bananas.

Explanation: Since there are 3000 bananas and the camel can carry at most 1000 bananas, at least five trips are needed to carry away all bananas from the plantation P (three trips away from the plantation and two return trips):
P (plantation)
Point A in the above picture cannot be the market. This is because the camel can never travel more than 500 kilometres into the desert if it should return to the plantation (the camel eats a banana every kilometre it travels!). So point A lies somewhere in the desert between the plantation and the market. From point A to the next point, less than five trips must be used to transport the bananas to that next point. We arrive at the following global solution to the problem (P denotes the plantation, M denotes the market):

P (plantation)
M (market)

Note that section PA must be in the solution (as explained above), but section AB or section BM might have a length of 0. Let us now look at the costs of each part of the route. One kilometre on section PA costs 5 bananas. One kilometre on section AB costs 3 bananas. One kilometre on section BM costs 1 banana. To save bananas, we should make sure that the length of PA is less than the length of AB and that the length of AB is less than the length of BM. Since PA is greater than 0, we conclude that AB is greater than 0 and that BM is greater than 0.

The camel can carry away at most 2000 bananas from point A. This means the distance between P and A must be chosen such that exactly 2000 bananas arrive in point A. When PA would be chosen smaller, more than 2000 bananas would arrive in A, but the surplus can't be transported further. When PA would be chosen larger, we are losing more bananas to the camel than necessary. Now we can calculate the length of PA: 3000-5*PA=2000, so PA=200 kilometres. Note that this distance is less than 500 kilometres, so the camel can travel back from A to P.

The situation in point B is similar to that in point A. The camel can't transport more than 1000 bananas from point B to the market M. Therefore, the distance between A and B must be chosen such that exactly 1000 bananas arrive in point B. Now we can calculate the length of AB: 2000-3*AB=1000, so AB=333 1/3. Note that this distance is less than 500 kilometres, so the camel can travel back from B to A. It follows that BM=1000-200-333 1/3=466 2/3 kilometres. As a result, the camel arrives at the market with 1000-466 2/3=533 1/3 bananas.

The full scenario looks as follows: first, the camel takes 1000 bananas to point A. There it drops 600 bananas and returns with 200 bananas. Then the camel takes again 1000 bananas to point A. Again, it drops 600 bananas and returns with 200 bananas. After this, the camel takes the last 1000 bananas from the plantation to point A. From point A, it leaves with 1000 bananas to point B. In point B, it drops 333 1/3 bananas and returns with 333 1/3 bananas. Then it takes the second load of 1000 bananas from point A to point B. Finally, it carries the 1000 bananas from point B to the market, where it arrives with 533 1/3 bananas.

23. Barbara has boxes in three sizes: large, standard, and small. She puts 11 large boxes on a table. She leaves some of these boxes empty, and in all the other boxes she puts 8 standard boxes. She leaves some of these standard boxes empty, and in all the other standard boxes she puts 8 (empty) small boxes. Now, 102 of all the boxes on the table are empty. How many boxes has Barbara used in total?
By putting 8 boxes in a box, the total number of empty boxes increases by 8 - 1 = 7. If we call x the number of times that 8 boxes have been put in a box, we know that 11 + 7x = 102. It follows that x=13. In total, 11 + 13 x 8 = 115 boxes have been used.

24. Here is a sequence of numbers: 1 11 21 1211 111221 It seems to be a strange sequence, but yet there is a system behind it... What is the next term in this sequence?
Again, the system behind the sequence is that each number (except the first one of the sequence) "describes" the previous number. Now, however, the number of occurrences of each cipher is counted. So 1231 means one "2" and three times a "1", and 131221 means one "3", one "2", and two times a "1". The number following on 131221 is therefore 132231 (one "3", two times a "2", and three times a "1"). The complete sequence is as follows: 1, 11, 21, 1211, 111221, 312211, 13112221, etc.

25. A light bulb is hanging in a room. Outside of the room there are three switches, of which only one is connected to the lamp. In the starting situation, all switches are 'off' and the bulb is not lit. If it is allowed to check in the room only once to see if the bulb is lit or not (this is not visible from the outside), how can you determine with which of the three switches the light bulb can be switched on?
To find the correct switch (1, 2, or 3), turn switch 1 to 'on' and leave it like that for a few minutes. After that you turn switch 1 back to 'off', and turn switch 2 to 'on'. Now enter the room. If the light bulb is lit, then you know that switch 2 is connected to it. If the bulb is not lit, then it has to be switch 1 or 3. Now touching for short the light bulb, will give you the answer: if the bulb is still hot, then switch 1 was the correct one; if the bulb is cold, then it has to be switch 3.

Aptitude Questions Set No 3

1. If 2x-y=4 then 6x-3y=?


2. If x=y=2z and xyz=256 then what is the value of x?


3. (1/10)18 - (1/10)20 = ?

(a) 99/1020
(b) 99/10
(c) 0.9
(d) none of these

4. Pipe A can fill in 20 minutes and Pipe B in 30 mins and Pipe C can empty the same in 40 mins.If all of them work together, find the time taken to fill the tank

(a) 17 1/7 mins
(b) 20 mins
(c) 8 mins
(d) none of these

5. Thirty men take 20 days to complete a job working 9 hours a day. How many hour a day should 40 men work to complete the job?
(a) 8 hrs
(b) 7 1/2 hrs
(c) 7 hrs
(d) 9 hrs

6. Find the smallest number in a GP whose sum is 38 and product 1728

(a) 12
(b) 20
(c) 8
(d) none of these

7. A boat travels 20 kms upstream in 6 hrs and 18 kms downstream in 4 hrs. Find the speed of the boat in still water and the speed of the water current?

(a) 1/2 kmph
(b) 7/12 kmph
(c) 5 kmph
(d) none of these

8. A goat is tied to one corner of a square plot of side 12m by a rope 7m long. Find the area it can graze?
(a) 38.5 sq.m
(b) 155 sq.m
(c) 144 sq.m
(d) 19.25 sq.m

9. Mr. Shah decided to walk down the escalator of a tube station. He found that if he walks down 26 steps, he requires 30 seconds to reach the bottom. However, if he steps down 34 stairs he would only require 18 seconds to get to the bottom. If the time is measured from the moment the top step begins to descend to the time he steps off the last step at the bottom, find out the height of the stair way in steps?
Ans.46 steps.
10. The average age of 10 members of a committee is the same as it was 4 years ago, because an old member has been replaced by a young member. Find how much younger is the new member ?
Ans.40 years.
11. One of the following is my secret word: AIM DUE MOD OAT TIE. With the list in front of you, if I were to tell you any one of my secret word, then you would be able to tell me the number of vowels in my secret word. Which is my secret word?
12. One of Mr. Horton, his wife, their son, and Mr. Horton's mother is a doctor and another is a lawyer.
a)If the doctor is younger than the lawyer, then the doctor and the lawyer are not blood relatives.
b)If the doctor is a woman, then the doctor and the lawyer are blood relatives.
c)If the lawyer is a man, then the doctor is a man.
Whose occupation you know?
Ans.Mr. Horton:he is the doctor.
13. Mr. and Mrs. Aye and Mr. and Mrs. Bee competed in a chess tournament. Of the three games played:
a)In only the first game were the two players married to each other.
b)The men won two games and the women won one game.
c)The Ayes won more games than the Bees.
d)Anyone who lost game did not play the subsequent game.
Who did not lose a game?
Ans.Mrs.Bee did not lose a game.
14. Three piles of chips--pile I consists one chip, pile II consists of chips, and pile III consists of three chips--are to be used in game played by Anita and Brinda. The game requires:
a)That each player in turn take only one chip or all chips from just one pile.
b)That the player who has to take the last chip loses.
c)That Anita now have her turn.
From which pile should Anita draw in order to win?
Ans.Pile II
15. Of Abdul, Binoy, and Chandini:
a)Each member belongs to the Tee family whose members always tell the truth or to the El family whose members always lie.
b)Abdul says ''Either I belong or Binoy belongs to a different family from the other two."
Whose family do you name of?
Ans.Binoy's family--El.
16. In a class composed of x girls and y boys what part of the class is composed of girls
A.y/(x + y)
C.x/(x + y)

17. What is the maximum number of half-pint bottles of cream that can be filled with a 4-gallon can of cream(2 pt.=1 qt. and 4 qt.=1 gal)


18. If the operation,^ is defined by the equation x ^ y = 2x + y, what is the value of a in 2 ^ a = a ^ 3


19. A coffee shop blends 2 kinds of coffee, putting in 2 parts of a 33p. a gm. grade to 1 part of a 24p. a gm. If the mixture is changed to 1 part of the 33p. a gm. to 2 parts of the less expensive grade, how much will the shop save in blending 100 gms.

20. There are 200 questions on a 3 hr examination.Among these questions are 50 mathematics problems.It is suggested that twice as much time be spent on each maths problem as for each other question.How many minutes should be spent on mathematics problems

21. Have a Question ? post your questions here. It will be answered as soon as possible.

22. ABCE is an isosceles trapezoid and ACDE is a rectangle. AB = 10 and EC = 20. What is the length of AE?
Ans. AE = 10.
23. In the given figure, PA and PB are tangents to the circle at A and B respectively and the chord BC is parallel to tangent PA. If AC = 6 cm, and length of the tangent AP is 9 cm, then what is the length of the chord BC?
Ans. BC = 4 cm.
24. Three cards are drawn at random from an ordinary pack of cards. Find the probability that they will consist of a king, a queen and an ace.
Ans. 64/2210.
25. A number of cats got together and decided to kill between them 999919 mice. Every cat killed an equal number of mice. Each cat killed more mice than there were cats. How many cats do you think there were ?
Ans. 991.
26. If Log2 x - 5 Log x + 6 = 0, then what would the value / values of x be?
Ans. x = e2 or e3.
27. The square of a two digit number is divided by half the number. After 36 is added to the quotient, this sum is then divided by 2. The digits of the resulting number are the same as those in the original number, but they are in reverse order. The ten's place of the original number is equal to twice the difference between its digits. What is the number?
Ans. 46
28. Can you tender a one rupee note in such a manner that there shall be total 50 coins but none of them would be 2 paise coins.?
Ans. 45 one paisa coins, 2 five paise coins, 2 ten paise coins, and 1 twenty-five paise coins.
29. A monkey starts climbing up a tree 20ft. tall. Each hour, it hops 3ft. and slips back 2ft. How much time would it take the monkey to reach the top?
Ans.18 hours.
30. What is the missing number in this series?
8 2 14 6 11 ? 14 6 18 12
Ans. 9
31. A certain type of mixture is prepared by mixing brand A at Rs.9 a kg. with brand B at Rs.4 a kg. If the mixture is worth Rs.7 a kg., how many kgs. of brand A are needed to make 40kgs. of the mixture?
Ans. Brand A needed is 24kgs..

Aptitude Questions Set No 2

1) If the square root of 55625 is 75, then √5625 + √56.25 + √0.5625 is equal to
1) 82.25
2) 83.25
3) 80.25
4) 79.25
Sol: 2) √5625 = 75; √56.25 = 7.5; √. 5625 = .75
-- > 75+7.5+0.75 = 83.25
2) Which of the following integers has most number of divisors?
1) 176
2) 182
3) 99
4) 101
Sol: 2) 176 = 2,4,8,11,16,22,44,88
182 = 2,7,13,14,26,91
99 = 3, 9, 11, 33
101= 101
3) A boy was asked to find the value of 3/8 of a sum of money. Instead of multiplying The sum by
3/8 he divided it by 3/8 and then his answer exceeded by Rs. 55. Find the Correct be x.
Sol: Let amount be x
8/3* - 3/8 * = 55
-- > 64x – 9x/24 = 55 -- > 55x/24 = 55
-- > x = 24*55/55 = 24
: . 3/8 of x = 3/8 * 24 = Rs.9
4) A boy was asked to find the value of 7/12 of a sum of money. Instead of multiplying The sum by
7/12 he divided it by 7/12 and thus his answer exceeded the correct Answer By Rs.95. Find the correct
Sol: Let sum = Rs. K
: . 12/7 k – 7k/12 = 95
-- > 144k – 49k/84 = 95 -- > k = 84
:. 7/12 k -- > 7/12 * 84 = Rs. 49
5) In a boat 25 persons were sitting. Their average weight increased one kilogram when One man
goes and a new man comes in. The weight of the new man is 70kgs. Find the Weight of the man who is
Sol: Weight increased per person is 1 kg.
Total increase in weight = 25 kgs
Weight of new man is 70 kgs,
(Which means his weight is 25 kgs heavier)
The weight of the old man was 70 – 25 = 45 kgs
6) What is the greatest possible length that can be used to measure exactly the following Lengths 7m,
3m 85cm, 12m 95cm?
The length to be measured is
700cm, 385cm, 1295cm.
The required length in cm is the H.C.F of 700, 385, and 1295, which is 35 cm.
7) The product of two-digit number is 2160 and their H.C.F is 12. The numbers are
Let the number are 12a and 12b
Then 12a * 12b = 2160
ab = 15
Value of co-primes a and b are (1, 15) (3,5)
: . The two digit numbers are (3*12, 5*12)
= (36, 60)
8) The least number of 6 digits which it exactly divisible by 12, 15 and 18 is
Least number of 6 digits is 100000
L.C.M of 12, 15, 18, is 180.
On dividing 100000 by 180, the remainder is 100
. Required number = 100000 + (180-100) = 100080
9) Two third of three fifth of one fourth of a number is 24. What is 40% of that number?
1) 96
2) 72
3) 120
4) 156
Sol: 1) let the number be x, then
X of 2/3 of 3/5 of . = 24
X * 2/3 * 3/5 * . = 24, x = 240.
Hence 40% of 240 = 40/100 * 240 = 96
10) It was calculated that 75 men could complete a piece of work in 20 days.
When work was scheduled to commence, it was found necessary to send 25
men to another project. How much longer will it take to complete the work?
30 days.
One day work = 1 / 20
One man’s one day work = 1 / ( 20 * 75)
No. Of workers = 50
One day work = 50 * 1 / ( 20 * 75)
The total no. of days required to complete the work = (75 * 20) / 50 =30
11) A student divided a number by 2/3 when he required to multiply by 3/2. Calculate the percentage of error in his result.
0 %
Since 3x / 2 = x / (2 / 3)
12) A dishonest shopkeeper professes to sell pulses at the cost price, but he uses a false weight of 950gm. for a kg. His gain is …%.
5.3 %
He sells 950 grams of pulses and gains 50 grams.
If he sells 100 grams of pulses then he will gain (50 / 950) *100 =5.26
13) A software engineer has the capability of thinking 100 lines of code in five minutes and can type 100 lines of code in 10 minutes. He takes a break for five minutes after every ten minutes. How many lines of codes will he complete typing after an hour?
250 lines of codes
14) A man was engaged on a job for 30 days on the condition that he would get a wage of Rs. 10 for the day he works, but he have to pay a fine of Rs. 2 for each day of his absence. If he gets Rs. 216 at the end, he was absent for work for ... days.
7 days
The equation portraying the given problem is:
10 * x – 2 * (30 – x) = 216 where x is the number of working days.
Solving this we get x = 23
Number of days he was absent was 7 (30-23) days.
15) A contractor agreeing to finish a work in 150 days, employed 75 men each working 8 hours daily. After 90 days, only 2/7 of the work was completed. Increasing the number of men by ________ each working now for 10 hours daily, the work can be completed in time.
150 men.
One day’s work = 2 / (7 * 90)
One hour’s work = 2 / (7 * 90 * 8)
One man’s work = 2 / (7 * 90 * 8 * 75)
The remaining work (5/7) has to be completed within 60 days, because
the total number of days allotted for the project is 150 days.
So we get the equation
(2 * 10 * x * 60) / (7 * 90 * 8 * 75) = 5/7 where x is the number of
men working after the 90th day.
We get x = 225
Since we have 75 men already, it is enough to add only 150 men.
16) What is a percent of b divided by b percent of a?
(a) a
(b) b
(c) 1
(d) 10
(e) 100
(c) 1
a percent of b : (a/100) * b
b percent of a : (b/100) * a
a percent of b divided by b percent of a : ((a / 100 )*b) / (b/100) * a )) = 1
17) A man bought a horse and a cart. If he sold the horse at 10 % loss and the cart at 20 % gain, he would not lose anything; but if he sold the horse at 5% loss and the cart at 5% gain, he would lose Rs. 10 in the bargain. The amount paid by him was Rs._______ for the horse and Rs.________ for the cart.
Cost price of horse = Rs. 400 & the cost price of cart = 200.
Let x be the cost price of the horse and y be the cost price of the cart.
In the first sale there is no loss or profit. (i.e.) The loss obtained is equal to the
Therefore (10/100) * x = (20/100) * y
X = 2 * y -----------------(1)
In the second sale, he lost Rs. 10. (i.e.) The loss is greater than the profit by
Rs. 10.
Therefore (5 / 100) * x = (5 / 100) * y + 10 -------(2)
Substituting (1) in (2) we get
(10 / 100) * y = (5 / 100) * y + 10
(5 / 100) * y = 10
y = 200
From (1) 2 * 200 = x = 400
18) A tennis marker is trying to put together a team of four players for a tennis tournament out of seven available. males - a, b and c; females – m, n, o and p. All players are of equal ability and there must be at least two males in the 1 team. For a team of four, all players must be able to play with each other
under the following restrictions:
b should not play with m,
c should not play with p, and
a should not play with o.
Which of the following statements must be false?
1. b and p cannot be selected together
2. c and o cannot be selected together
3. c and n cannot be selected together.
Since inclusion of any male player will reject a female from the team.
Since there should be four member in the team and only three males are
available, the girl, n should included in the team always irrespective of others
19) Five farmers have 7, 9, 11, 13 & 14 apple trees, respectively in their orchards. Last year, each of them discovered that every tree in their own orchard bore exactly the same number of apples. Further, if the third farmer gives one apple to the first, and the fifth gives three to each of the second and the fourth, they would all have exactly the same number of apples. What were the yields per tree in the orchards of the third and fourth farmers?
11 & 9 apples per tree.
Let a, b, c, d & e be the total number of apples bored per year in A, B,
C, D & E ‘s orchard. Given that a + 1 = b + 3 = c – 1 = d + 3 = e – 6
But the question is to find the number of apples bored per tree in C and D ‘s
orchard. If is enough to consider c – 1 = d + 3.
Since the number of trees in C’s orchard is 11 and that of D’s orchard
is 13. Let x and y be the number of apples bored per tree in C & d ‘s orchard
Therefore 11 x – 1 = 13 y + 3
By trial and error method, we get the value for x and y as 11 and 9
20) Five boys were climbing a hill. J was following H. R was just ahead of G. K was between G & H. They were climbing up in a column. Who was the second?
The order in which they are climbing is R – G – K – H – J

Aptitude Questions Set No 1

1) A train covers a distance in 50 min, if it runs at a speed of 48kmph on an average. The speed at which the train must run to reduce the time of journey to 40min will be.
1. Solution::
Time=50/60 hr=5/6hr
New speed = 40* 3/2 kmph= 60kmph
2) Vikas can cover a distance in 1hr 24min by covering 2/3 of the distance at 4 kmph and the rest at 5kmph. The total distance is?
2. Solution::
Let total distance be S
total time=1hr24min
A to T :: speed=4kmph
T to S :: speed=5km
21/15 hr=2/3 S/4 + 1/3s /5
= 6km
3) The average ages of three persons is 27 years. Their ages are in the proportion of 1:3:5.What is the age in years of the youngest one among them.
Sol: Let the age of three persons be x, 3x and 5x
-- > 9x/3 = 27 -- > x = 9
4) The average of 11 numbers is 50. If the average of first 6 numbers is 49 and that of last 6 is 52.Find
the 6th number.
Sol: The total sum of 11 results = 11 * 50 = 550
The total sum of first 6 results = 6 * 49 = 294
The total sum of last 6 results = 6 * 52 = 312
Sixth result = 294 + 312 – 550 = 56
5) The smallest number which when divided by 20, 25, 35, 40 leaves the remainder 6 When divided by 14, 19, 23 and 34 respectively is the difference between divisor and The corresponding remainder is 6.
: . Required number = (L.C.M of 20, 25, 35, 40) – 6
= 1400-6 = 1394
6) Sum of three even consecutive numbers is 48, and then least number is
1) 16
2) 18
3) 20
4) 14
Sol: 4) Let the numbers be 2n, 2n+2 and 2n+4
2n + (2n+2) + (2n+4) = 48
6n = 48-6 = 42, n = 7
Hence the numbers are -- > 14, 16 and 18
The least number is 14.
7) It being given that √ 15 = 3.88, the best approximation to √5/3 is
1) 0.43
2) 1.89
3) 1.29
4) 1.63
Sol: 3) x = √5/3 = √5*3/3*3 = √15 /√ 9 = √15/3 = 3.88/3 = 1.29
8) Of the two-digit numbers (those from 11 to 95, both inclusive) how many have a Second digit
greater than the first digit?
1) 37
2) 38
3) 36
4) 35
Sol: 3) 12 to 19 -- > 8
23 to 29 -- > 7
34 to 39 -- > 6
45 to 49 -- > 5
56 to 59 -- > 4
67 to 69 -- > 3
78 to 79 -- > 2
89 -- > 1
9) The Value of √24 + 3√64 + 4√28 is
Sol: 24*1/2 + 43*1/3 + 28*1/4
-- > 4 + 4 + 4 -- > 12
10) 3 . - 4/5 of 5/6 / 4 1/3 / 1/5 – ( 3/10 + 21 1/5 ) is equal to
Sol: 13/4 – 4/5 * 5/6 / 13/3 / 1/5 – ( 3/10 + 106/5 ) (use BODMASRULE)
-- > 13/4 – 4/6 / 13/3 / 1/5 – 215/10 -- > 31/12 / 13/3 * 5 – 215/10
-- > 31/12 / 65/3 – 43/2 -- > 31/12 / 130 – 129/6 -- > 31/12/1/6 = 31/12 * 6/1
-- > 31/2 = 15 1/2
10) 13 sheeps and 9 pigs were bought for Rs. 1291.85.If the average price of a sheep be Rs. 74. What
is the average price of a pig.
Sol: Average price of a sheep = Rs. 74
: . Total price of 13 sheeps
= (74*13) = Rs. 962
But, total price of 13 sheeps and 9 pigs
= Rs. 1291.85
Total price of 9 pigs
= Rs. (1291.85-962) = Rs. 329.85
Hence, average price of a pig
= (329.85/9) = Rs. 36.65
11) A batsman in his 18th innings makes a score of 150 runs and there by increasing his Average by 6.
Find his average after 18th innings.
Sol: Let the average for 17 innings is x runs
Total runs in 17 innings = 17x
Total runs in 18 innings = 17x + 150
Average of 18 innings = 17x + 150/18
: . 17x + 150/18 = x + 6 -- > x = 42
Thus, average after 18 innings = 42
12) The L.C.M of two numbers is 2310 and their H.C.F is 30. If one number is 210 the Other is
The other number
= L.C.M * H.C.F/given number
= 2310*30/210 = 330
13) The average of 50 numbers is 38. If two numbers namely 45 and 55 are discarded, The average of
remaining numbers is?
Total of 50 numbers = 50 * 38 = 1900
Average of 48 numbers = 1900-(45+55) / 48
= 1800 / 48 = 37.5
14) Divide 50 in two parts so that the sum of reciprocals is (1/12), the numbers are
1) 20,30
2) 24,36
3) 28,22
4) 36,14
Sol: 1) Let the numbers be x and y then
X+y = 50. ………(i)
1/x + 1/y = 12
1/x + 1/50-x = 1/12..From (i) y = 50 – x
-- > 50-x+x/x(50-x) = 1/12
-- > x2-50x+600 = 0
-- > (x-30) (x-20) = 0
15) Five years ago the average age of a family of 3 members was 27 years. A child has Been born, due to which the average age of the family is 25 years today. What is the Present age of the child?
Sol: Average age of the family of 3 members
5 years ago = 27 years
Sum of the ages of the 3 members now
= (27 + 5) * 3 = 96 years
Average age of the family of 4 members now
= 25 years
Sum of the ages of the 4 numbers now
= 25*4 = 100 years
Age of child = 100 – 96 = 4 years
16) In a class of 20 students in an examination in Mathematics 2 students scored 100 Marks each, 3 get zero each and the average of the rest was 40. What is the average Of the whole class?
Sol: Total marks obtained by a class of 20 students
= 2 * 100 + 3 * 0 + 15 * 40
= 200 + 600 = 800
: Average marks of whole class = 800/20 = 40
17) The greatest number, which can divide 432, 534 and 398 leaving the same remainder 7 in each, is
Required number is the H.C.F of
(432-7), (534-7) and (398-7)
i.e., H.C.F. of 425, 527, 391
Required number = 17
18) The sum of two numbers is 216 and their H.C.F is 27. The numbers are?
Let the numbers be 27a and 27b
Then 27a + 27b = 216
a+b = 8
Value of co-primes a and b are (1,7) (3,5)
: . Numbers are (27*1, 27*7) = (27,189)
19) The greatest number of 4 digits which is divisible by each one of the number 12,18,21 and 28 is
Greatest number of 4 digits is 9999
L.C.M of 12, 18, 21, 28 = 252
On dividing 9999 by 252, the remainder is 171
: . Required number is (9999-171) = 9828
20) Four prime numbers are arranged in ascending order according to their magnitude. Product of first
three is 385 and the product of last three is 1001. The greatest number is.
1) 11
2) 13
3) 17
4) 19
Sol: 2) 385) 1001(2
231) 385(1
231 (1
77) 154(2
Hence the product of the middle terms = 77
Greatest prime number = 1001 / 77 = 13.

Contact Form


Email *

Message *