Puzzle 1: There's an old puzzle in which the king blindfolds three ministers, places a white or black hat on each one and removes the blindfolds. "If you can see a black hat, raise your hand", he says. They each raise a hand. "If you can tell what color your hat is, raise your hand." All the hands drop. Then suddenly, one minister raises his hand. What color was his hat?

Puzzle 2: Another king has four ministers. He shows them a table with two white hats and two black ones. He blindfolds them, and places a hat on each. Then, he puts one on one side of a wall, and the other three in a line on the other side, facing the wall, like so:

A | B C D

A and B can see nothing but the wall. C can see B's hat. D can see B's hat and C's hat. Assuming the ministers are good thinkers, will someone be able to determine their hat color?

Puzzle 3: On a certain island with 500 married couples. In exactly 50 of those couples, the husband is committing adultery. The way gossip works on this island, everyone is very polite, so no one will tell a wife that her husband is committing adultery, but they will certainly tell her about all the other husbands. So let us suppose that every wife of a cheating husband knows about the other cheating husbands, but not her own.

One day, the executioner appears in the town square and says, "Any wife who suspects her husband of cheating shall bring him to me today!" But no one brings a husband forth. The next day, the executioner shows up again, but no husband is brought forth. The executioner is stubborn, and so he comes every day. Is justice ever done?

Puzzle 4: We return to the first problem, but now the rules have changed. The king tells his three ministers, "In five minutes, I am going to come back into this room, blindfold you, place a white or black hat randomly on each of you, then unblindfold you. When I count to three, say the color of your hat, or stay silent. If you all stay silent, I will hang you all. If anyone guesses the color of their hat incorrectly, I will hang you all. But if no one guesses incorrectly, and at least one of you guesses correctly, you all live." Assuming the ministers would like to live, what is a sensible strategy?

Puzzle 5: The king has N ministers, whom he places in a line of chairs facing forward, so that person N can see all the other ministers, and person 1 sees nobody. There are N-1 black hats, and 1 white hat. These are placed on the minister's heads in the dark. When the lights come on, the king begins with minister N, and proceeds down to minister 1, and asks each "Do you know the color of your hat?". Suppose one of the ministers can't make it to the test, and you have to go instead. If you get your choice of seats, where should you sit?
Java Multi Threading

1) What are the two types of multitasking?

2) What are the two ways to create the thread?

3) What is the signature of the constructor of a thread class?

4) What are all the methods available in the Runnable Interface?

5) What is the data type for the method isAlive() and this method is available in which class?

6) What are all the methods available in the Thread class?

7) What are all the methods used for Inter Thread communication and what is the class in which these methods are defined?

8) What is the mechanisam defind by java for the Resources to be used by only one Thread at a time?

9) What is the procedure to own the moniter by many threads?

10) What is the unit for 1000 in the below statement?

ob.sleep(1000)

11) What is the data type for the parameter of the sleep() method?

12) What are all the values for the following level?

max-priority

min-priority

normal-priority

13) What is the method available for setting the priority?

14) What is the default thread at the time of starting the program?

15) The word synchronized can be used with only a method.

16) Which priority Thread can prompt the lower primary Thread?

17) How many threads at a time can access a monitor?

18) What are all the four states associated in the thread?

19) The suspend()method is used to teriminate a thread?

20) The run() method should necessary exists in clases created as subclass of thread?

21) When two threads are waiting on each other and can't proceed the programe is said to be in a deadlock?

22) Which method waits for the thread to die ?

23) Which of the following is true?

1) wait(),notify(),notifyall() are defined as final & can be called only from with in a synchronized method

2) Among wait(),notify(),notifyall() the wait() method only throws IOException

3) wait(),notify(),notifyall() & sleep() are methods of object class

1. 1
2. 2
3. 3
4. 1 & 2
5. 1,2 & 3

24) Garbage collector thread belongs to which priority?

25) What is meant by timeslicing or time sharing?

26) What is meant by daemon thread? In java runtime, what is it's role?














1. Write a program to display digits 1-9, alphabets A-Z using threads.
2. Consider a matrix of order 3x3. Using threads, display the values of row sum, column sum and diagnoal sum."
Exercise 1
Solve the following and check with the answers given at the end.

1. 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?

2. A student divided a number by 2/3 when he required to multiply by 3/2. Calculate the percentage of error in his result.

3. 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 …%.

4. 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?

5. 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.

6. 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.

7. what is a percent of b divided by b percent of a?
(a) a (b) b (c) 1 (d) 10 (d) 100

8. 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.

9. 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 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.

10-12. The following figure depicts three views of a cube. Based on this, answer questions 10-12.

6 5 4

1 22 3 6



10. The number on the face opposite to the face carrying 1 is ¬¬¬¬_______ .

11. The number on the faces adjacent to the face marked 5 are ¬¬_______ .

12. Which of the following pairs does not correctly give the numbers on the opposite faces.
(1) 6,5 (2) 4,1 (3) 1,3 (4) 4,2

13. 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?

14. 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?

15-18 John is undecided which of the four novels to buy. He is considering a spy
thriller, a Murder mystery, a Gothic romance and a science fiction novel. The books are written by Rothko, Gorky, Burchfield and Hopper, not necessary in that order, and published by Heron, Piegon, Blueja and sparrow, not necessary in that order.
(1) The book by Rothko is published by Sparrow.
(2) The Spy thriller is published by Heron.
(3) The science fiction novel is by Burchfield and is not published by Blueja.
(4)The Gothic romance is by Hopper.

15. Pigeon publishes ____________.

16. The novel by Gorky ________________.

17. John ¬purchases books by the authors whose names come first and third in alphabetical order. He does not buy the books ¬¬______.

18. On the basis of the first paragraph and statement (2), (3) and (4) only, it is possible to deduce that
1. Rothko wrote the murder mystery or the spy thriller
2. Sparrow published the murder mystery or the spy thriller
3. The book by Burchfield is published by Sparrow.

19. If a light flashes every 6 seconds, how many times will it flash in ¾ of an hour?

20. If point P is on line segment AB, then which of the following is always true?
(1) AP = PB (2) AP > PB (3) PB > AP (4) AB > AP (5) AB > AP + PB

21. All men are vertebrates. Some mammals are vertebrates. Which of the following conclusions drawn from the above statement is correct.
All men are mammals
All mammals are men
Some vertebrates are mammals.
None

22. Which of the following statements drawn from the given statements are correct?
Given:
All watches sold in that shop are of high standard. Some of the HMT watches are sold in that shop.
a) All watches of high standard were manufactured by HMT.
b) Some of the HMT watches are of high standard.
c) None of the HMT watches is of high standard.
d) Some of the HMT watches of high standard are sold in that shop.

23-27.
1. Ashland is north of East Liverpool and west of Coshocton.
2. Bowling green is north of Ashland and west of Fredericktown.
3. Dover is south and east of Ashland.
4. East Liverpool is north of Fredericktown and east of Dover.
5. Fredericktown is north of Dover and west of Ashland.
6. Coshocton is south of Fredericktown and west of Dover.

23. Which of the towns mentioned is furthest of the north – west
(a) Ashland (b) Bowling green (c) Coshocton
(d) East Liverpool (e) Fredericktown

24. Which of the following must be both north and east of Fredericktown?
(a) Ashland (b) Coshocton (c) East Liverpool
I a only II b only III c only IV a & b V a & c

25. Which of the following towns must be situated both south and west of at least one other town?
A. Ashland only
B. Ashland and Fredericktown
C. Dover and Fredericktown
D. Dover, Coshocton and Fredericktown
E. Coshocton, Dover and East Liverpool.

26. Which of the following statements, if true, would make the information in the numbered statements more specific?
(a) Coshocton is north of Dover.
(b) East Liverpool is north of Dover
(c) Ashland is east of Bowling green.
(d) Coshocton is east of Fredericktown
(e) Bowling green is north of Fredericktown

27. Which of the numbered statements gives information that can be deduced from one or more of the other statements?
(A) 1 (B) 2 (C) 3 (D) 4 (E) 6

28. Eight friends Harsha, Fakis, Balaji, Eswar, Dhinesh, Chandra, Geetha, and Ahmed are sitting in a circle facing the center. Balaji is sitting between Geetha and Dhinesh. Harsha is third to the left of Balaji and second to the right of Ahmed. Chandra is sitting between Ahmed and Geetha and Balaji and Eshwar are not sitting opposite to each other. Who is third to the left of Dhinesh?

29. If every alternative letter starting from B of the English alphabet is written in small letter, rest all are written in capital letters, how the month “ September” be written.
(1) SeptEMbEr (2) SEpTeMBEr (3) SeptembeR
(4) SepteMber (5) None of the above.

30. The length of the side of a square is represented by x+2. The length of the side of an equilateral triangle is 2x. If the square and the equilateral triangle have equal perimeter, then the value of x is _______.

31. It takes Mr. Karthik y hours to complete typing a manuscript. After 2 hours, he was called away. What fractional part of the assignment was left incomplete?

32. Which of the following is larger than 3/5?
(1) ½ (2) 39/50 (3) 7/25 (4) 3/10 (5) 59/100

33. The number that does not have a reciprocal is ¬¬¬____________.

34. There are 3 persons Sudhir, Arvind, and Gauri. Sudhir lent cars to Arvind and Gauri as many as they had already. After some time Arvind gave as many cars to Sudhir and Gauri as many as they have. After sometime Gauri did the same thing. At the end of this transaction each one of them had 24. Find the cars each originally had.

35. 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.

Answers:

1. Answer:
30 days.
Explanation:
Before:
One day work = 1 / 20
One man’s one day work = 1 / ( 20 * 75)
Now:
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

2. Answer:
0 %
Explanation:
Since 3x / 2 = x / (2 / 3)

3. Answer:
5.3 %
Explanation:
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

4. Answer:
250 lines of codes

5. Answer:
7 days
Explanation:
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.

6. Answer:
150 men.
Explanation:
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.

7. Answer:
(c) 1
Explanation:
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

8. Answer:
Cost price of horse = Rs. 400 & the cost price of cart = 200.
Explanation:-
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 gain.

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

9. Answer:
3.
Explanation:
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 selection.

10. Answer:
5

11. Answer:
1,2,3 & 4

12. Answer:
B

13. Answer:
11 & 9 apples per tree.
Explanation:
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 respectively.
Therefore 11 x – 1 = 13 y + 3
By trial and error method, we get the value for x and y as 11 and 9

14. Answer:
G.
Explanation:
The order in which they are climbing is R – G – K – H – J

15 – 18
Answer:
Novel Name Author Publisher
Spy thriller Rathko Heron
Murder mystery Gorky Piegon
Gothic romance Burchfield Blueja
Science fiction Hopper Sparrow

Explanation:
Given
Novel Name Author Publisher
Spy thriller Rathko Heron
Murder mystery Gorky Piegon
Gothic romance Burchfield Blueja
Science fiction Hopper Sparrow

Since Blueja doesn’t publish the novel by Burchfield and Heron publishes the novel spy thriller, Piegon publishes the novel by Burchfield.
Since Hopper writes Gothic romance and Heron publishes the novel spy thriller, Blueja publishes the novel by Hopper.
Since Heron publishes the novel spy thriller and Heron publishes the novel by Gorky, Gorky writes Spy thriller and Rathko writes Murder mystery.

19. Answer:
451 times.
Explanation:
There are 60 minutes in an hour.
In ¾ of an hour there are (60 * ¾) minutes = 45 minutes.
In ¾ of an hour there are (60 * 45) seconds = 2700 seconds.
Light flashed for every 6 seconds.
In 2700 seconds 2700/6 = 450 times.
The count start after the first flash, the light will flashes 451 times in ¾ of an hour.

20. Answer:
(4)
Explanation:
P
A B
Since p is a point on the line segment AB, AB > AP

21. Answer: (c)

22. Answer: (b) & (d).
Ahmed
23 - 27.Answer:
Fakis Chandra
28. Answer: Fakis
Explanation: Harsha Geetha

Eswar Balaji


Dhinesh

29. Answer:
(5).
Explanation:
Since every alternative letter starting from B of the English alphabet is written in small letter, the letters written in small letter are b, d, f...
In the first two answers the letter E is written in both small & capital letters, so they are not the correct answers. But in third and fourth answers the letter is written in small letter instead capital letter, so they are not the answers.

30. Answer:
x = 4
Explanation:
Since the side of the square is x + 2, its perimeter = 4 (x + 2) = 4x + 8
Since the side of the equilateral triangle is 2x, its perimeter = 3 * 2x = 6x
Also, the perimeters of both are equal.
(i.e.) 4x + 8 = 6x
(i.e.) 2x = 8  x = 4.

31. Answer:
(y – 2) / y.
Explanation:
To type a manuscript karthik took y hours.
Therefore his speed in typing = 1/y.
He was called away after 2 hours of typing.
Therefore the work completed = 1/y * 2.
Therefore the remaining work to be completed = 1 – 2/y.
(i.e.) work to be completed = (y-2)/y

32. Answer:
(2)

33. Answer:
1
Explanation:
One is the only number exists without reciprocal because the reciprocal of one is one itself.

34. Answer:
Sudhir had 39 cars, Arvind had 21 cars and Gauri had 12 cars.
Explanation:
Sudhir Arvind Gauri

Finally 24 24 24
Before Gauri’s transaction 12 12 48
Before Arvind’s transaction 6 42 24
Before Sudhir’ s transaction 39 21 12

35. Answer:
Cost price of horse: Rs. 400 &
Cost price of cart: Rs. 200
Explanation:
Let x be the cost of horse & y be the cost of the cart.
10 % of loss in selling horse = 20 % of gain in selling the cart
Therefore (10 / 100) * x = (20 * 100) * y
 x = 2y -----------(1)
5 % of loss in selling the horse is 10 more than the 5 % gain in selling the cart.
Therefore (5 / 100) * x - 10 = (5 / 100) * y
 5x - 1000 = 5y
Substituting (1)
10y - 1000 = 5y
5y = 1000
y = 200
x = 400 from (1)

Exercise 2.1
For the following, find the next term in the series

1. 6, 24, 60,120, 210

a) 336 b) 366 c) 330 d) 660

Answer : a) 336
Explanation : The series is 1.2.3, 2.3.4, 3.4.5, 4.5.6, 5.6.7, ..... ( '.' means product)

2. 1, 5, 13, 25

Answer : 41
Explanation : The series is of the form 0^2+1^2, 1^2+2^2,...

3. 0, 5, 8, 17

Answer : 24
Explanation : 1^2-1, 2^2+1, 3^2-1, 4^2+1, 5^2-1

4. 1, 8, 9, 64, 25 (Hint : Every successive terms are related)

Answer : 216
Explanation : 1^2, 2^3, 3^2, 4^3, 5^2, 6^3

5. 8,24,12,36,18,54

Answer : 27

6. 71,76,69,74,67,72
Answer : 67

7. 5,9,16,29,54
Answer : 103
Explanation : 5*2-1=9; 9*2-2=16; 16*2-3=29; 29*2-4=54; 54*2-5=103

8. 1,2,4,10,16,40,64 (Successive terms are related)
Answer : 200
Explanation : The series is powers of 2 (2^0,2^1,..).
All digits are less than 8. Every second number is in octal number system.
128 should follow 64. 128 base 10 = 200 base 8.

Exercise 2.2

Find the odd man out.

1. 3,5,7,12,13,17,19
Answer : 12
Explanation : All but 12 are odd numbers

2. 2,5,10,17,26,37,50,64
Answer : 64
Explanation : 2+3=5; 5+5=10; 10+7=17; 17+9=26; 26+11=37; 37+13=50; 50+15=65;

3. 105,85,60,30,0,-45,-90
Answer : 0
Explanation : 105-20=85; 85-25=60; 60-30=30; 30-35=-5; -5-40=-45; -45-45=-90;


Exercise 3
Solve the following.

1. What is the number of zeros at the end of the product of the numbers from 1 to 100?
Answer : 127
2. A fast typist can type some matter in 2 hours and a slow typist can type the same in 3 hours. If both type combinely, in how much time will they finish?
Answer : 1 hr 12 min
Explanation : The fast typist's work done in 1 hr = 1/2
The slow typist's work done in 1 hr = 1/3
If they work combinely, work done in 1 hr = 1/2+1/3 = 5/6
So, the work will be completed in 6/5 hours. i.e., 1+1/5 hours = 1hr 12 min

3. Gavaskar's average in his first 50 innings was 50. After the 51st innings, his average was 51. How many runs did he score in his 51st innings. (supposing that he lost his wicket in his 51st innings)
Answer : 101
Explanation : Total score after 50 innings = 50*50 = 2500
Total score after 51 innings = 51*51 = 2601
So, runs made in the 51st innings = 2601-2500 = 101
If he had not lost his wicket in his 51st innings, he would have scored an unbeaten 50 in his 51st innings.

4. Out of 80 coins, one is counterfeit. What is the minimum number of weighings needed to find out the counterfeit coin?
Answer : 4

5. What can you conclude from the statement : All green are blue, all blue are red. ?
(i) some blue are green
(ii) some red are green
(iii) some green are not red
(iv) all red are blue
(a) i or ii but not both
(b) i & ii only
(c) iii or iv but not both
(d) iii & iv

Answer : (b)

6. A rectangular plate with length 8 inches, breadth 11 inches and thickness 2 inches is available. What is the length of the circular rod with diameter 8 inches and equal to the volume of the rectangular plate?
Answer : 3.5 inches
Explanation : Volume of the circular rod (cylinder) = Volume of the rectangular plate
(22/7)*4*4*h = 8*11*2
h = 7/2 = 3.5

7. What is the sum of all numbers between 100 and 1000 which are divisible by 14 ?
Answer : 35392
Explanation : The number closest to 100 which is greater than 100 and divisible by 14 is 112, which is the first term of the series which has to be summed.
The number closest to 1000 which is less than 1000 and divisible by 14 is 994, which is the last term of the series.
112 + 126 + .... + 994 = 14(8+9+ ... + 71) = 35392

8. If s(a) denotes square root of a, find the value of s(12+s(12+s(12+ ...... upto infinity.
Answer : 4
Explanation : Let x = s(12+s(12+s(12+.....
We can write x = s(12+x). i.e., x^2 = 12 + x. Solving this quadratic equation, we get x = -3 or x=4. Sum cannot be -ve and hence sum = 4.

9. A cylindrical container has a radius of eight inches with a height of three inches. Compute how many inches should be added to either the radius or height to give the same increase in volume?
Answer : 16/3 inches
Explanation : Let x be the amount of increase. The volume will increase by the same amount if the radius increased or the height is increased.
So, the effect on increasing height is equal to the effect on increasing the radius.
i.e., (22/7)*8*8*(3+x) = (22/7)*(8+x)*(8+x)*3
Solving the quadratic equation we get the x = 0 or 16/3. The possible increase would be by 16/3 inches.

10. With just six weights and a balance scale, you can weigh any unit number of kgs from 1 to 364. What could be the six weights?
Answer : 1, 3, 9, 27, 81, 243 (All powers of 3)

11. Diophantus passed one sixth of his life in childhood, one twelfth in youth, and one seventh more as a bachelor; five years after his marriage a son was born who died four years before his father at half his final age. How old is Diophantus?
Answer : 84 years
Explanation : x/6 + x/12 + x/7 + 5 + x/2 + 4 = x

12 . If time at this moment is 9 P.M., what will be the time 23999999992 hours later?
Answer : 1 P.M.
Explanation : 24 billion hours later, it would be 9 P.M. and 8 hours before that it would be 1 P.M.

13. How big will an angle of one and a half degree look through a glass that magnifies things three times?
Answer : 1 1/2 degrees
Explanation : The magnifying glass cannot increase the magnitude of an angle.

14. Divide 45 into four parts such that when 2 is added to the first part, 2 is subtracted from the second part, 2 is multiplied by the third part and the fourth part is divided by two, all result in the same number.
Answer: 8, 12, 5, 20
Explanation: a + b + c + d =45; a+2 = b-2 = 2c = d/2; a=b-4; c = (b-2)/2; d = 2(b-2); b-4 + b + (b-2)/2 + 2(b-2) = 45;

15. I drove 60 km at 30 kmph and then an additional 60 km at 50 kmph. Compute my average speed over my 120 km.
Answer : 37 1/2
Explanation : Time reqd for the first 60 km = 120 min.; Time reqd for the second 60 km = 72 min.; Total time reqd = 192 min
Avg speed = (60*120)/192 = 37 1/2


Questions 16 and 17 are based on the following :
Five executives of European Corporation hold a Conference in Rome
Mr. A converses in Spanish & Italian
Mr. B, a spaniard, knows English also
Mr. C knows English and belongs to Italy
Mr. D converses in French and Spanish
Mr. E , a native of Italy knows French

16. Which of the following can act as interpreter if Mr. C & Mr. D wish to converse
a) only Mr. A b) Only Mr. B c) Mr. A & Mr. B d) Any of the other three

Answer : d) Any of the other three.
Explanation : From the data given, we can infer the following.
A knows Spanish, Italian
B knows Spanish, English
C knows Italian, English
D knows Spanish, French
E knows Italian, French
To act as an interpreter between C and D, a person has to know one of the combinations Italian&Spanish, Italian&French, English&Spanish, English&French
A, B, and E know atleast one of the combinations.

17. If a 6th executive is brought in, to be understood by maximum number of original five he should be fluent in
a) English & French b) Italian & Spanish c) English & French d) French & Italian
Answer : b) Italian & Spanish
Explanation : No of executives who know
i) English is 2
ii) Spanish is 3
iii) Italian is 3
iv) French is 2
Italian & Spanish are spoken by the maximum no of executives. So, if the 6th executive is fluent in Italian & Spanish, he can communicate with all the original five because everybody knows either Spanish or Italian.

18. What is the sum of the first 25 natural odd numbers?
Answer : 625
Explanation : The sum of the first n natural odd nos is square(n).
1+3 = 4 = square(2) 1+3+5 = 9 = square(3)

19. The sum of any seven consecutive numbers is divisible by
a) 2 b) 7 c) 3 d) 11

Exercise 3
Try the following.

1. There are seventy clerks working in a company, of which 30 are females. Also, 30 clerks are married; 24 clerks are above 25 years of age; 19 married clerks are above 25 years, of which 7 are males; 12 males are above 25 years of age; and 15 males are married. How many bachelor girls are there and how many of these are above 25?

2. A man sailed off from the North Pole. After covering 2,000 miles in one direction he turned West, sailed 2,000 miles, turned North and sailed ahead another 2,000 miles till he met his friend. How far was he from the North Pole and in what direction?

3. Here is a series of comments on the ages of three persons J, R, S by themselves.
S : The difference between R's age and mine is three years.
J : R is the youngest.
R : Either I am 24 years old or J 25 or S 26.
J : All are above 24 years of age.
S : I am the eldest if and only if R is not the youngest.
R : S is elder to me.
J : I am the eldest.
R : S is not 27 years old.
S : The sum of my age and J's is two more than twice R's age.
One of the three had been telling a lie throughout whereas others had spoken the truth. Determine the ages of S,J,R.

4. In a group of five people, what is the probability of finding two persons with the same month of birth?

5. A father and his son go out for a 'walk-and-run' every morning around a track formed by an equilateral triangle. The father's walking speed is 2 mph and his running speed is 5 mph. The son's walking and running speeds are twice that of his father. Both start together from one apex of the triangle, the son going clockwise and the father anti-clockwise. Initially the father runs and the son walks for a certain period of time. Thereafter, as soon as the father starts walking, the son starts running. Both complete the course in 45 minutes. For how long does the father run? Where do the two cross each other?

6. The Director of Medical Services was on his annual visit to the ENT Hospital. While going through the out patients' records he came across the following data for a particular day : " Ear consultations 45; Nose 50; Throat 70; Ear and Nose 30; Nose and Throat 20; Ear and Throat 30; Ear, Nose and Throat 10; Total patients 100." Then he came to the conclusion that the records were bogus. Was he right?

7. Amongst Ram, Sham and Gobind are a doctor, a lawyer and a police officer. They are married to Radha, Gita and Sita (not in order). Each of the wives have a profession. Gobind's wife is an artist. Ram is not married to Gita. The lawyer's wife is a teacher. Radha is married to the police officer. Sita is an expert cook. Who's who?

8. What should come next?
1, 2, 4, 10, 16, 40, 64,

Questions 9-12 are based on the following :
Three adults – Roberto, Sarah and Vicky – will be traveling in a van with five children – Freddy, Hillary, Jonathan, Lupe, and Marta. The van has a driver’s seat and one passenger seat in the front, and two benches behind the front seats, one beach behind the other. Each bench has room for exactly three people. Everyone must sit in a seat or on a bench, and seating is subject to the following restrictions: An adult must sit on each bench.
Either Roberto or Sarah must sit in the driver’s seat.
Jonathan must sit immediately beside Marta.

9. Of the following, who can sit in the front passenger seat ?
(a) Jonathan (b) Lupe (c) Roberto (d) Sarah (e) Vicky

10. Which of the following groups of three can sit together on a bench?
(a) Freddy, Jonathan and Marta (b) Freddy, Jonathan and Vicky
(c) Freddy, Sarah and Vicky (d) Hillary, Lupe and Sarah
(e) Lupe, Marta and Roberto

11. If Freddy sits immediately beside Vicky, which of the following cannot be true ?
a. Jonathan sits immediately beside Sarah
b. Lupe sits immediately beside Vicky
c. Hillary sits in the front passenger seat
d. Freddy sits on the same bench as Hillary
e. Hillary sits on the same bench as Roberto

12. If Sarah sits on a bench that is behind where Jonathan is sitting, which of the following must be true ?
a. Hillary sits in a seat or on a bench that is in front of where Marta is sitting
b. Lupe sits in a seat or on a bench that is in front of where Freddy is sitting
c. Freddy sits on the same bench as Hillary
d. Lupe sits on the same bench as Sarah
e. Marta sits on the same bench as Vicky

13. Make six squares of the same size using twelve match-sticks. (Hint : You will need an adhesive to arrange the required figure)

14. A farmer has two rectangular fields. The larger field has twice the length and 4 times the width of the smaller field. If the smaller field has area K, then the are of the larger field is greater than the area of the smaller field by what amount?
(a) 6K (b) 8K (c) 12K (d) 7K

15. Nine equal circles are enclosed in a square whose area is 36sq units. Find the area of each circle.

16. There are 9 cards. Arrange them in a 3*3 matrix. Cards are of 4 colors. They are red, yellow, blue, green. Conditions for arrangement: one red card must be in first row or second row. 2 green cards should be in 3rd column. Yellow cards must be in the 3 corners only. Two blue cards must be in the 2nd row. At least one green card in each row.

17. Is z less than w? z and w are real numbers.
(I) z2 = 25
(II) w = 9
To answer the question,
a) Either I or II is sufficient
b) Both I and II are sufficient but neither of them is alone sufficient
c) I & II are sufficient
d) Both are not sufficient

18. A speaks truth 70% of the time; B speaks truth 80% of the time. What is the probability that both are contradicting each other?

19. In a family 7 children don't eat spinach, 6 don't eat carrot, 5 don't eat beans, 4 don't eat spinach & carrots, 3 don't eat carrot & beans, 2 don't eat beans & spinach. One doesn't eat all 3. Find the no. of children.

20. Anna, Bena, Catherina and Diana are at their monthly business meeting. Their occupations are author, biologist, chemist and doctor, but not necessarily in that order. Diana just told the neighbour, who is a biologist that Catherina was on her way with doughnuts. Anna is sitting across from the doctor and next to the chemist. The doctor was thinking that Bena was a good name for parent's to choose, but didn't say anything. What is each person's occupation?
4 series .
>(1) 2,11,22,121 ,? ans 242 (2)102,211,1020,1210,?7
another type
>string S=abc now substrings P=ab Q=ad such that
>if p->q, then S=adc (according to the
firstoccurance)based on these type
>(a) S=abcabc ;P->Q Q->R R->P what would be
theresulting S ,given P=ab, Q=ba R=bc
>(b) S=aaabbb; P->Q Q->P R->P (according to the
firstoccurrence)P=….Q=……R=……
>two questions on some figures given (see
compitionmaster )
------------------------------------------------

Questions 17-20:
------------------------
In this section, four series of numbers are provided.
You have to choose
the next term of each given series from the supplied
alternatives.

17. There is a series of numbers as 102,210,1020,1121,... .
The next term is
(A) ............ (B) ............ (C) ............
(D) none of A,B,C
18. There is a series of numbers as 110,122,1021,1110,... .
The next term is
(A) ............ (B) ............ (C) ............
(D) none of A,B,C
19. There is a series of numbers as 2,11,22,121,... . The
next term is
(A) ............ (B) ............ (C) ............
(D) none of A,B,C
20. There is a series of numbers as . The
next term is
(A) ............ (B) ............ (C) ............
(D) none of A,B,C
--------------------------------------
old papers:
I
1. 2D, 3C, 4B, 5A. Ans: 6Z
2. C5, B0, A5, 90. Ans:
3. 25, 19, 31, 1f, 28. Ans:
4. 34, 52, 2b, 43, 3c. Ans:
II.
1. 102, 111, 120, 122. Ans:
2. 110, 212, 1021, 1200. Ans:
3. 102, 211, 1020, 1122. Ans:
4. 2, 11, 22, 121. Ans:
------------------------------------------


Series Transformation
1) If 102101->210212 then 112112->?
a)
b)
c)
d)

2) if 102101-> 200111 then 112112->?
Again there r 4 choices.

3) If 102101->101201 then 112112->?
Again there r 4 choices.

Tips:The 1st one all change 0->1, 1->2, 2->1
The 2nd on alternate do not change
The 3rd it is just reverse of the original string
_
-------------------------------------

Section 2 : Word series
Q's : 9 - 16

This is one of the easiest section. Try to do it at first.
if S is a string then p,q,r form the substrings of S.
for eg, if S=aaababc & p=aa q=ab r=bc
then on applying p->q on S is that ababaabc
only the first occurance of S has to be substituted.
if there is no substring of p,q,r on s then it should not be
substituted.

If S=aabbcc, R=ab, Q=bc. Now we define an operator R Q when
operated on S, R is replaced by Q, provided Q is a subset of S,
otherwise R will be unchanged. Given a set S= ………., when R Q, P==
672; R, Q
 P operated successively on S, what will be new S? There will be 4 =

: if s=aaababc & p= aa q=ab r=bc then applying p->q, q->r & r->p will
give,
(a): aaababc (b): abaabbc (c): abcbaac (d): none of the
a,b,c
10: if s=aaababc & p= aa q=ab r=bc then applying q->r & r->p will
give,
11: if s=abababc & p= aa q=ab r=bc then applying p->q, q->r & r->p will
give,
12: if s=abababc & p= aa q=ab r=bc then applying q->r & r->p will
give,
13: if s=aabc & p=aa q=ab r=ac then applying p->q(2) q->r(2) r->p
will
give,
(2) means applying the same thing twice.
14: similiar type of prob.
15: if s=abbabc p=ab q=bb r=bc then to get s=abbabc which one should be
applied.
(a): p->q,q->r,r->p
16: if s=abbabc p=ab q=bb r=bc then to get s=bbbcbabc which one should
be
applied.
Let us consider a set of strings such as S=aabcab. We
now consider two
more sets P and Q which also contain strings. An operation
P->Q is defined in
such a manner that if P is a subset of S, then P is to be
replaced by Q. In
the following questions, you are given various sets of
strings on which you
have to perform certain operations as defined above. Choose
the correct
alternative as your answer.

(the below are some ques from old ques papers)

21. Let S=abcabc, P=bc, Q=bb and R=ba. Then P->Q, Q->R, R-
>P changes S to
(A) ............ (B) abcabc (C) ............
(D) none of A,B,C
22. Let S=aabbcc, P=ab, Q=bc and R=cc. Then P->Q, Q->R, R-
>P changes S to
(A) ababab (B) ............ (C) ............
(D) none of A,B,C
23. Let S=bcacbc, P=ac, Q=ca and R=ba. Then P->Q, Q->R, P-
>R changes S to
(A) ............ (B) ............ (C) bcbabc
(D) none of A,B,C
24. Let S=caabcb, P=aa, Q=ca and R=bcb. Then P->Q, P->R, R-
>Q changes S to
(A) ............ (B) ............ (C) ............
(D) none of A,B,C
---------------------------------------------------------------

Section 3 : numerical series
Q's : 17 - 24

This is little bit tough. proper guesses should be made.
find these probs in r.s.aggarval's verbal & non verbal reasoning.

17: 2,20,80,100, ??
(a): 121, (b): 116 (c): (d):none
18: 10,16,2146,2218, ??

like these other series were given.

section 3 : series (from other booklet)
transformations

17: 1 1 0 2 2 1 1 ---> 0 0 1 0 0 2 2
1 0 1 1 0 0 1 ---> 2 1 2 2 1 1 2
then
2 2 1 1 0 1 1 ---> ????
ans may be 0 0 2 2 1 2 2

18: 1 1 0 0 2 2 ---> 2 2 0 0 1 1
1 0 1 1 2 1 ---> 1 2 1 1 0 1
-----------------------------------------------
Series.

1. Interchange of letters in a word and the adjacent letters are also to
be changed. given letters series like [also few condotions]
AAABBB=
ABABAB=
LET QUESTION IS ABBAAB
If we apply 25 on this it means we have to interchange the letters
at positions 2 and 5, and we have to change the adjacent letters 2 and 5
from A to B and B to A.
That is q's A B B A A B
after Step 1 i.e interchange 2 and 5.

now change adjacent elements of 2 and 5...finally answer becomes
Ans: B A A B B A

//Hint: As per question papers 5 questions above like but numbers
change.

REMAINING 3 QUESTIONS:
6. To get AAABBD from BBBAAA what ot apply:-
a) 25 b) 34 c)25 & 34 d) none
------------------
http://einstein.et.tudelft.nl/~arlet/puzzles/logic.html


1)Three people check into a hotel. They pay $30 to the manager and go to their room. The manager finds out that the room rate is $25 and gives $5 to the bellboy to return. On the way to the room the bellboy reasons that $5 would be difficult to share among three people so he pockets $2 and gives $1 to each person. Now each person paid $10 and got back $1. So they paid $9 each, totalling $27. The bellboy has $2, totalling $29. Where is the remaining dollar?

ans)
*****
Each person paid $9, totalling $27. The manager has $25 and the bellboy $2. The bellboy's $2 should be added to the manager's $25 or subtracted from the tenants' $27, not added to the tenants' $27.


ages
Ten years from now Tim will be twice as old as Jane was when Mary was nine times as old as Tim.
Eight years ago, Mary was half as old as Jane will be when Jane is one year older than Tim will be at the time when Mary will be five times as old as Tim will be two years from now.
When Tim was one year old, Mary was three years older than Tim will be when Jane is three times as old as Mary was six years before the time when Jane was half as old as Tim will be when Mary will be ten years older than Mary was when Jane was one-third as old as Tim will be when Mary will be three times as old as she was when Jane was born.
How old are they now?

The solution:
Tim is 3, Jane is 8, and Mary is 15. A little grumbling is in order here, as clue number 1 leads to the situation a year and a half ago, when Tim was 1 1/2, Jane was 6 1/2, and Mary was 13 1/2.
This sort of problem is easy if you write down a set of equations. Let t be the year that Tim was born, j be the year that Jane was born, m be the year that Mary was born, and y be the current year. As indefinite years come up, let y1, y2, ... be the indefinite years. Then the equations are

y + 10 - t = 2 (y1 - j) y1 - m = 9 (y1 - t)

y - 8 - m = 1/2 (y2 - j) y2 - j = 1 + y3 - t y3 - m = 5 (y + 2 - t)

t + 1 - m = 3 + y4 - t y4 - j = 3 (y5 - 6 - m) y5 - j = 1/2 (y6 - t) y6 - m = 10 + y7 - m y7 - j = 1/3 (y8 - t) y8 - m = 3 (j - m)

t = y - 3 j = y - 8 m = y - 15



attribute
All the items in the first list share a particular attribute. The second list is of some items lacking the attribute.
with: battery, key, yeast, bookmark w/out: stapler, match, Rubik's cube, pill bottle
with: Rubik's cube, chess set, electrical wiring, compass needle w/out: clock, rope, tic-tac-toe, pencil sharpener
with: koosh, small intestine, Yorkshire Terrier, Christmas Tree w/out: toothbrush, oak chair, soccer ball, icicle
Points to realize: 1. There may be exceptions to any item on the list, for instance a particular clock may share the properties of the 'with' list of problem two, BUT MOST ORDINARY clocks do not. All the properties apply the vast majority of the the items mentioned. Extraordinary exceptions should be ignored. 2. Pay the most attention to the 'with' list. The 'without' list is only present to eliminate various 'stupid' answers.

The attribute puzzle format is a traditional format in math education. It occurs in logic materials developed in the sixties by EDC in Boston, with visual objects. Example:
these are gloops: A B C D E
these are not gloops: F G J L N
which of these are gloops? O P Q R S
with: battery, key, yeast, bookmark w/out: stapler, match, Rubik's cube, pill bottle
Needs to be placed inside something else when used for its usual purpose.

with: Rubik's cube, chess set, electrical wiring, compass needle w/out: clock, rope, tic-tac-toe, pencil sharpener
Uses color to distinguish between otherwise identical parts.

with: koosh, small intestine, Yorkshire Terrier, Christmas Tree w/out: toothbrush, oak chair, soccer ball, icicle
Villiform.



******************************************************
bookworm
A bookworm eats from the first page of an encyclopedia to the last page. The bookworm eats in a straight line. The encyclopedia consists of ten 1000-page volumes and is sitting on a bookshelf in the usual order. Not counting covers, title pages, etc., how many pages does the bookworm eat through?

On a book shelf the first page of the first volume is on the "inside"
__ __
B| | | |F
A|1 |...........................|10|R
C| | | |O
K| | | |N
| | | |T
----------------------------------

so the bookworm eats only through the cover of the first volume, then 8 times 1000 pages of Volumes 2 - 9, then through the cover to the 1st page of Vol 10. He eats 8,000 pages.
If the bookworm ate the first page and the last page, it ate 8,004 pages.


-*******************************************
boxes
Which Box Contains the Gold? Two boxes are labeled "A" and "B". A sign on box A says "The sign on box B is true and the gold is in box A". A sign on box B says "The sign on box A is false and the gold is in box A". Assuming there is gold in one of the boxes, which box contains the gold?

--------------------------------------------------------------------------------
The problem cannot be solved with the information given.
The sign on box A says "The sign on box B is true and the gold is in box A". The sign on box B says "The sign on box A is false and the gold is in box A". The following argument can be made: If the statement on box A is true, then the statement on box B is true, since that is what the statement on box A says. But the statement on box B states that the statement on box A is false, which contradicts the original assumption. Therefore, the statement on box A must be false. This implies that either the statement on box B is false or that the gold is in box B. If the statement on box B is false, then either the statement on box A is true (which it cannot be) or the gold is in box B. Either way, the gold is in box B.

However, there is a hidden assumption in this argument: namely, that each statement must be either true or false. This assumption leads to paradoxes, for example, consider the statement: "This statement is false." If it is true, it is false; if it is false, it is true. The only way out of the paradox is to deny that the statement is either true or false and label it meaningless instead. Both of the statements on the boxes are therefore meaningless and nothing can be concluded from them.

In general, statements about the truth of other statements lead to contradictions. Tarski invented metalanguages to avoid this problem. To avoid paradox, a statement about the truth of a statement in a language must be made in the metalanguage of the language.

Common sense dictates that this problem cannot be solved with the information given. After all, how can we deduce which box contains the gold simply by reading statements written on the outside of the box? Suppose we deduce that the gold is in box B by whatever line of reasoning we choose. What is to stop us from simply putting the gold in box A, regardless of what we deduced? (cf. Smullyan, "What Is the Name of This Book?", Prentice-Hall, 1978, #70)




================
camel
An Arab sheikh tells his two sons to race their camels to a distant city to see who will inherit his fortune. The one whose camel is slower will win. The brothers, after wandering aimlessly for days, ask a wise man for advise. After hearing the advice they jump on the camels and race as fast as they can to the city. What does the wise man say? Solution


The wiseman tells them to switch camels.

***********************************************
centrifuge
You are a biochemist, working with a 12-slot centrifuge. This is a gadget that has 12 equally spaced slots around a central axis, in which you can place chemical samples you want centrifuged. When the machine is turned on, the samples whirl around the central axis and do their thing. To ensure that the samples are evenly mixed, they must be distributed in the 12 slots such that the centrifuge is balanced evenly. For example, if you wanted to mix 4 samples, you could place them in slots 12, 3, 6 and 9 (assuming the slots are numbered from 1 to 12 like a clock). Problem: Can you use the centrifuge to mix 5 samples?
Solution

The superposition of any two solutions is yet another solution, so given that the factors > 1 of 12 (2, 3, 4, 6, 12) are all solutions, the only thing to check about, for example, the proposed solution 2+3 is that not all ways of combining 2 & 3 would have centrifuge tubes from one subsolution occupying the slot for one of the tubes in another solution. For the case 2+3, there is no problem: Place 3 tubes, one in every 4th position, then place the 4th and 5th diametrically opposed (each will end up in a slot adjacent to one of the first 3 tubes). The obvious generalization is, what are the numbers of tubes that cannot be balanced? Observing that there are solutions for 2,3,4,5,6 tubes and that if X has a solution, 12-X has also one (obtained by swapping tubes and holes), it is obvious that 1 and 11 are the only cases without solutions.
Here is how this problem is often solved in practice: A dummy tube is added to produce a total number of tubes that is easy to balance. For example, if you had to centrifuge just one sample, you'd add a second tube opposite it for balance.


************************************************
chain
What is the least number of links you can cut in a chain of 21 links to be able to give someone all possible number of links up to 21?
Solution
Two.
OOO C OOOOO C OOOOOOOOOOO

(where Os are chained unbroken links, and the Cs are the unchained broken links)
And equivalently:

OOO C OOOOOO C OOOOOOOOOO

*********************************************
children
A man walks into a bar, orders a drink, and starts chatting with the bartender. After a while, he learns that the bartender has three children. "How old are your children?" he asks. "Well," replies the bartender, "the product of their ages is 72." The man thinks for a moment and then says, "that's not enough information." "All right," continues the bartender, "if you go outside and look at the building number posted over the door to the bar, you'll see the sum of the ages." The man steps outside, and after a few moments he reenters and declares, "Still not enough!" The bartender smiles and says, "My youngest just loves strawberry ice cream." How old are the children? A variant of the problem is for the sum of the ages to be 13 and the product of the ages to be the number posted over the door. In this case, it is the oldest that loves ice cream. Then how old are they?
Solution

First, determine all the ways that three ages can multiply together to get 72: (quite a feat for the bartender)
72 1 1
36 2 1
24 3 1
18 4 1
18 2 2
12 6 1
12 3 2
9 4 2
9 8 1
8 3 3
6 6 2
6 4 3
As the man says, that's not enough information; there are many possibilities. So the bartender tells him where to find the sum of the ages--the man now knows the sum even though we don't. Yet he still insists that there isn't enough info. This must mean that there are two permutations with the same sum; otherwise the man could have easily deduced the ages.
The only pair of permutations with the same sum are 8 3 3 and 6 6 2, which both add up to 14 (the bar's address). Now the bartender mentions his "youngest"--telling us that there is one child who is younger than the other two. This is impossible with 8 3 3--there are two 3 year olds. Therefore the ages of the children are 6, 6, and 2.

Pedants have objected that the problem is insoluble because there could be a youngest between two three year olds (even twins are not born exactly at the same time). However, the word "age" is frequently used to denote the number of years since birth. For example, I am the same age as my wife, even though technically she is a few months older than I am. And using the word "youngest" to mean "of lesser age" is also in keeping with common parlance. So I think the solution is fine as stated.

In the sum-13 variant, the possibilities are:

11 1 1
10 2 1
9 3 1
9 2 2
8 4 1
8 3 2
7 5 1
7 4 2
7 3 3
6 6 1
6 5 2
6 4 3
The two that remain are 9 2 2 and 6 6 1 (both products equal 36). The final bit of info (oldest child) indicates that there is only one child with the highest age. This cancels out the 6 6 1 combination, leaving the childern with ages of 9, 2, and 2.

**********************************************
condoms
How can a man have mutually safe sex with three women with only two condoms? How can three men have mutually safe sex with one woman with two condoms?
Solution
Use both condoms on the first woman. Take off the outer condom (turning it inside-out in the process) and set it aside. Use the inner condom alone on the second woman. Put the outer condom back on. Use it on the third woman.
First man uses both condoms. Take off the outer condom (do NOT reverse it) and have second man use it. First man takes off the inner condom (turning it inside-out). Third man puts on this condom, followed by second man's condom.


*******************************************

dell
How can I solve logic puzzles (e.g., as published by Dell) automatically?
Solution

#include

#define EITHER if (S[1] = S[0], ! setjmp((S++)->jb)) {
#define OR } else EITHER
#define REJECT longjmp((--S)->jb, 1)
#define END_EITHER } else REJECT;

/* values in tmat: */
#define T_UNK 0
#define T_YES 1
#define T_NO 2

#define Val(t1,t2) (S->tmat[t1][t2])
#define CLASS(x) \
(((x) / NUM_ITEM) * NUM_ITEM)
#define EVERY_TOKEN(x) \
(x = 0; x < TOT_TOKEN; x++)
#define EVERY_ITEM(x, class) \
(x = CLASS(class); x < CLASS(class) + NUM_ITEM; x++)

#define BEGIN \
struct state { \
char tmat[TOT_TOKEN][TOT_TOKEN]; \
jmp_buf jb; \
} States[100], *S = States; \
\
main() \
{ \
int token; \
\
for EVERY_TOKEN(token) \
yes(token, token); \
EITHER

/* Here is the problem-specific data */
#define NUM_ITEM 5
#define NUM_CLASS 6
#define TOT_TOKEN (NUM_ITEM * NUM_CLASS)

#define HOUSE_0 0
#define HOUSE_1 1
#define HOUSE_2 2
#define HOUSE_3 3
#define HOUSE_4 4

#define ENGLISH 5
#define SPANISH 6
#define NORWEG 7
#define UKRAIN 8
#define JAPAN 9

#define GREEN 10
#define RED 11
#define IVORY 12
#define YELLOW 13
#define BLUE 14

#define COFFEE 15
#define TEA 16
#define MILK 17
#define OJUICE 18
#define WATER 19

#define DOG 20
#define SNAIL 21
#define FOX 22
#define HORSE 23
#define ZEBRA 24

#define OGOLD 25
#define PLAYER 26
#define CHESTER 27
#define LSTRIKE 28
#define PARLIA 29

char *names[] = {
"HOUSE_0", "HOUSE_1", "HOUSE_2", "HOUSE_3", "HOUSE_4",
"ENGLISH", "SPANISH", "NORWEG", "UKRAIN", "JAPAN",
"GREEN", "RED", "IVORY", "YELLOW", "BLUE",
"COFFEE", "TEA", "MILK", "OJUICE", "WATER",
"DOG", "SNAIL", "FOX", "HORSE", "ZEBRA",
"OGOLD", "PLAYER", "CHESTER", "LSTRIKE", "PARLIA",
};

BEGIN

yes(ENGLISH, RED); /* Clue 1 */
yes(SPANISH, DOG); /* Clue 2 */
yes(COFFEE, GREEN); /* Clue 3 */
yes(UKRAIN, TEA); /* Clue 4 */

EITHER /* Clue 5 */
yes(IVORY, HOUSE_0);
yes(GREEN, HOUSE_1);
OR
yes(IVORY, HOUSE_1);
yes(GREEN, HOUSE_2);
OR
yes(IVORY, HOUSE_2);
yes(GREEN, HOUSE_3);
OR
yes(IVORY, HOUSE_3);
yes(GREEN, HOUSE_4);
END_EITHER

yes(OGOLD, SNAIL); /* Clue 6 */
yes(PLAYER, YELLOW); /* Clue 7 */
yes(MILK, HOUSE_2); /* Clue 8 */
yes(NORWEG, HOUSE_0); /* Clue 9 */

EITHER /* Clue 10 */
yes(CHESTER, HOUSE_0);
yes(FOX, HOUSE_1);
OR
yes(CHESTER, HOUSE_4);
yes(FOX, HOUSE_3);
OR
yes(CHESTER, HOUSE_1);
EITHER yes(FOX, HOUSE_0);
OR yes(FOX, HOUSE_2);
END_EITHER
OR
yes(CHESTER, HOUSE_2);
EITHER yes(FOX, HOUSE_1);
OR yes(FOX, HOUSE_3);
END_EITHER
OR
yes(CHESTER, HOUSE_3);
EITHER yes(FOX, HOUSE_2);
OR yes(FOX, HOUSE_4);
END_EITHER
END_EITHER

EITHER /* Clue 11 */
yes(PLAYER, HOUSE_0);
yes(HORSE, HOUSE_1);
OR
yes(PLAYER, HOUSE_4);
yes(HORSE, HOUSE_3);
OR
yes(PLAYER, HOUSE_1);
EITHER yes(HORSE, HOUSE_0);
OR yes(HORSE, HOUSE_2);
END_EITHER
OR
yes(PLAYER, HOUSE_2);
EITHER yes(HORSE, HOUSE_1);
OR yes(HORSE, HOUSE_3);
END_EITHER
OR
yes(PLAYER, HOUSE_3);
EITHER yes(HORSE, HOUSE_2);
OR yes(HORSE, HOUSE_4);
END_EITHER
END_EITHER

yes(LSTRIKE, OJUICE); /* Clue 12 */
yes(JAPAN, PARLIA); /* Clue 13 */

EITHER /* Clue 14 */
yes(NORWEG, HOUSE_0);
yes(BLUE, HOUSE_1);
OR
yes(NORWEG, HOUSE_4);
yes(BLUE, HOUSE_3);
OR
yes(NORWEG, HOUSE_1);
EITHER yes(BLUE, HOUSE_0);
OR yes(BLUE, HOUSE_2);
END_EITHER
OR
yes(NORWEG, HOUSE_2);
EITHER yes(BLUE, HOUSE_1);
OR yes(BLUE, HOUSE_3);
END_EITHER
OR
yes(NORWEG, HOUSE_3);
EITHER yes(BLUE, HOUSE_2);
OR yes(BLUE, HOUSE_4);
END_EITHER
END_EITHER

/* End of problem-specific data */

solveit();
OR
printf("All solutions found\n");
exit(0);
END_EITHER
}

no(a1, a2)
{
int non1, non2, token;

if (Val(a1, a2) == T_YES)
REJECT;
else if (Val(a1, a2) == T_UNK) {
Val(a1, a2) = T_NO;
no(a2, a1);
non1 = non2 = -1;

for EVERY_ITEM(token, a1)
if (Val(token, a2) != T_NO)
if (non1 == -1)
non1 = token;
else
break;
if (non1 == -1)
REJECT;
else if (token == CLASS(a1) + NUM_ITEM)
yes(non1, a2);

for EVERY_TOKEN(token)
if (Val(token, a1) == T_YES)
no(a2, token);
}
}

yes(a1, a2)
{
int token;

if (Val(a1, a2) == T_NO)
REJECT;
else if (Val(a1, a2) == T_UNK) {
Val(a1, a2) = T_YES;
yes(a2, a1);
for EVERY_ITEM(token, a1)
if (token != a1)
no(token, a2);
for EVERY_TOKEN(token)
if (Val(token, a1) == T_YES)
yes(a2, token);
else if (Val(token, a1) == T_NO)
no(a2, token);
}
}

solveit()
{
int token, tok2;

for EVERY_TOKEN(token)
for (tok2 = token; tok2 < TOT_TOKEN; tok2++)
if (Val(token, tok2) == T_UNK) {
EITHER
yes(token, tok2);
OR
no(token, tok2);
END_EITHER;
return solveit();
}
printf("Solution:\n");
for EVERY_ITEM(token, 0) {
for (tok2 = NUM_ITEM; tok2 < TOT_TOKEN; tok2++)
if (Val(token, tok2) == T_YES)
printf("\t%s %s\n",names[token],names[tok2]);
printf("\n");
}
REJECT;
}



***********************************************
elimination
97 baseball teams participate in an annual state tournament. The way the champion is chosen for this tournament is by the same old elimination schedule. That is, the 97 teams are to be divided into pairs, and the two teams of each pair play against each other. After a team is eliminated from each pair, the winners would be again divided into pairs, etc. How many games must be played to determine a champion?

Solution
In order to determine a winner all but one team must lose. Therefore there must be at least 96 games.

*****************************************
flip
How can a toss be called over the phone (without requiring trust)?
Solution
A flips a coin. If the result is heads, A multiplies 2 prime numbers containing about 90 digits; if the result is tails, A multiplies 3 prime numbers containing about 60 digits. A tells B the result of the multiplication. B now calls either heads or tails and tells A. A then supplies B with the original numbers to verify the flip.
Consider what is involved in multiplying 90 digit numbers. Using the method of long multiplication that we all learned in grade school, you have maybe 90 or so strings of 90 characters (or "digits") each. That's no problem for a computer to deal with. The magnitude of the number represented isn't much of a factor; we're only manipulating the string of digits.

Consider what is involved in factoring 90 digit numbers. There are of course, little tricks for determining factorability by small integers which we all learned in grade school. (Is the last digit even? Is the sum of all the digits divisible by 9? And so on.) But these are of little use in factoring large numbers with large factors. In fact, there is no essentially better method than checking every number smaller that the number to be factored and seeing if it one divides the other evenly. We means we could be checking some 100,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 nummbers. This is very hard to do, even for a supercomputer. Here, the number of digits this number has is of little consequence. It is the magnitude of the number that we have to worry about, and there just isn't enough time in the world to do this properly.

Where does A find a list of 60- and 90- digit prime numbers? Well, that's not to hard to come by. The simplest method to find a few prime numbers is simply to choose a 90-digit number (or 60-digit number, as the case warrants) randomly, and check to see if it is prime. You won't have to wait too long before you stumble across a prime number.

"But wait!" you cry. "I thought you just said it was incredibly difficult to factor large numbers. If that's the case, then how are you going to know if the number you randomly choose is prime?" A good question. Here we enter into the strange an wacky world of number theory. It turns out (and I won't explain how unless someone asks) there are "probabalistic" algorithms, which depend on us choosing numbers at random. There are probablistic algorithms that when given a prime number, will quickly tell us that it is a prime number, and when given a composite number, will either tell us that it is a composite number (with very, very high probability) or will tell us that it is a prime number (with very, very low probability.) What's the use of an algorithm that only returns the right answer "with very, very high probability?" Well, we can make this probability as high as we want, just by running the algorithm longer. In fact, it is within our technological abilities to quickly run this algorithm for 90-digit numbers so that the probability of it giving a wrong answer is less than the probability of a cosmic ray striking a vital part of the computer at some vital time and causing the computer to spit out the wrong answer anyway. That's what I mean by "very, very high."



********************************
flowers
How many flowers do I have if all of them are roses except two, all of them are tulips except two, and all of them are daisies except two? Solution
friends
Any group of 6 or more contains either 3 mutual friends or 3 mutual strangers. Prove it. Solution
hofstadter
In first-order logic, find a predicate P(x) which means "x is a power of 10." Solution
hundred
A sheet of paper has statements numbered from 1 to 100. Statement n says "exactly n of the statements on this sheet are false." Which statements are true and which are false? What if we replace "exactly" by "at least"? Solution
inverter
Can a digital logic circuit with two inverters invert N independent inputs? The circuit may contain any number of AND or OR gates. Solution
josephine
The recent expedition to the lost city of Atlantis discovered scrolls attributted to the great poet, scholar, philosopher Josephine. They number eight in all, and here is the first.
The kingdom of Mamajorca, was ruled by queen Henrietta I. In Mamajorca women have to pass an extensive logic exam before they are allowed to get married. Queens do not have to take this exam. All the women in Mamajorca are loyal to their queen and do whatever she tells them to. The queens of Mamajorca are truthful. All shots fired in Mamajorca can be heard in every house. All above facts are known to be common knowledge. Henrietta was worried about the infidelity of the married men in Mamajorca. She summoned all the wives to the town square, and made the following announcement. "There is at least one unfaithful husband in Mamajorca. All wives know which husbands are unfaithful, but have no knowledge about the fidelity of their own husband. You are forbidden to discuss your husband's faithfulness with any other woman. If you discover that your husband is unfaithful, you must shoot him at precisely midnight of the day you find that out." Thirty-nine silent nights followed the queen's announcement. On the fortieth night, shots were heard. Queen Henrietta I is revered in Mamajorcan history.
As with all philosophers Josephine doesn't provide the question, but leaves it implicit in his document. So figure out the questions - there are two - and answer them. Here is Josephine's second scroll.
Queen Henrietta I was succeeded by daughter queen Henrietta II. After a while Henrietta like her famous mother became worried about the infidelity problem. She decided to act, and sent a letter to her subjects (wives) that contained the exact words of Henrietta I's famous speech. She added that the letters were guarenteed to reach all wives eventually. Queen Henrietta II is remembered as a foolish and unjust queen.
What is the question and answer implied by this scroll? Solution
locks.and.boxes
You want to send a valuable object to a friend. You have a box which is more than large enough to contain the object. You have several locks with keys. The box has a locking ring which is more than large enough to have a lock attached. But your friend does not have the key to any lock that you have. How do you do it? Note that you cannot send a key in an unlocked box, since it might be copied. Solution
min.max
In a rectangular array of people, which will be taller, the tallest of the shortest people in each column, or the shortest of the tallest people in each row? Solution
mixing
Start with a half cup of tea and a half cup of coffee. Take one tablespoon of the tea and mix it in with the coffee. Take one tablespoon of this mixture and mix it back in with the tea. Which of the two cups contains more of its original contents? Solution
monty.52
Monty and Waldo play a game with N closed boxes. Monty hides a dollar in one box; the others are empty. Monty opens the empty boxes one by one. When there are only two boxes left Waldo opens either box; he wins if it contains the dollar. Prior to each of the N-2 box openings Waldo chooses one box and locks it, preventing Monty from opening it next. That box is then unlocked and cannot be so locked twice in a row. What are the optimal strategies for Monty and Waldo and what is the fair price for Waldo to pay to play the game? Solution
number
Mr. S. and Mr. P. are both perfect logicians, being able to correctly deduce any truth from any set of axioms. Two integers (not necessarily unique) are somehow chosen such that each is within some specified range. Mr. S. is given the sum of these two integers; Mr. P. is given the product of these two integers. After receiving these numbers, the two logicians do not have any communication at all except the following dialogue:
Mr. P.: I do not know the two numbers.
Mr. S.: I knew that you didn't know the two numbers.
Mr. P.: Now I know the two numbers.
Mr. S.: Now I know the two numbers.
Given that the above statements are absolutely truthful, what are the two numbers? Solution
river.crossing
Three humans, one big monkey and two small monkeys are to cross a river: a) Only humans and the big monkey can row the boat. b) At all times, the number of human on either side of the river must be GREATER OR EQUAL to the number of monkeys on THAT side. ( Or else the humans will be eaten by the monkeys!) c) The boat only has room for 2 (monkeys or humans) Solution
ropes
Two fifty foot ropes are suspended from a forty foot ceiling, about twenty feet apart. Armed with only a knife, how much of the rope can you steal? Solution
same.street
Sally and Sue have a strong desire to date Sam. They all live on the same street yet neither Sally or Sue know where Sam lives. The houses on this street are numbered 1 to 99. Sally asks Sam "Is your house number a perfect square?". He answers. Then Sally asks "Is is greater than 50?". He answers again. Sally thinks she now knows the address of Sam's house and decides to visit. When she gets there, she finds out she is wrong. This is not surprising, considering Sam answered only the second question truthfully. Sue, unaware of Sally's conversation, asks Sam two questions. Sue asks "Is your house number a perfect cube?". He answers. She then asks "Is it greater than 25?". He answers again. Sue thinks she knows where Sam lives and decides to pay him a visit. She too is mistaken as Sam once again answered only the second question truthfully. If I tell you that Sam's number is less than Sue's or Sally's, and that the sum of their numbers is a perfect square multiplied by two, you should be able to figure out where all three of them live. Solution
self.ref
Find a number ABCDEFGHIJ such that A is the count of how many 0's are in the number, B is the number of 1's, and so on. Solution
smullyan/black.hat
Three logicians, A, B, and C, are wearing hats, which they know are either black or white but not all white. A can see the hats of B and C; B can see the hats of A and C; C is blind. Each is asked in turn if they know the color of their own hat. The answers are: A: "No." B: "No." C: "Yes." What color is C's hat and how does she know? Solution
smullyan/fork.three.men
Three men stand at a fork in the road. One fork leads to Someplaceorother; the other fork leads to Nowheresville. One of these people always answers the truth to any yes/no question which is asked of him. The other always lies when asked any yes/no question. The third person randomly lies and tells the truth. Each man is known to the others, but not to you. What is the least number of yes/no questions you can ask of these men and pick the road to Someplaceorother? Does the answer change if the third man randomly answers? Solution
smullyan/fork.two.men
Two men stand at a fork in the road. One fork leads to Someplaceorother; the other fork leads to Nowheresville. One of these people always answers the truth to any yes/no question which is asked of him. The other always lies when asked any yes/no question. By asking one yes/no question, can you determine the road to Someplaceorother? Solution
smullyan/integers
Two logicians place cards on their foreheads so that what is written on the card is visible only to the other logician. Consecutive positive integers have been written on the cards. The following conversation ensues: A: "I don't know my number." B: "I don't know my number." A: "I don't know my number." B: "I don't know my number." ... n statements of ignorance later ... A or B: "I know my number." What is on the card and how does the logician know it? Solution
smullyan/painted.heads
While three logicians were sleeping under a tree, a malicious child painted their heads red. Upon waking, each logician spies the child's handiwork as it applied to the heads of the other two. Naturally they start laughing. Suddenly one falls silent. Why? Solution
smullyan/priest
In a small town there are N married couples in which one of the pair has committed adultery. Each adulterer has succeeded in keeping their dalliance a secret from their spouse. Since it is a small town, everyone knows about everyone else's infidelity. In other words, each spouse of an adulterer thinks there are N - 1 adulterers, but everyone else thinks there are N adulterers. People of this town have a tradition of denouncing their spouse in church if they are guilty of adultery. So far, of course, no one has been denounced. In addition, people of this town are all amateur logicians of sorts, and can be expected to figure out the implications of anything they know. A priest has heard the confession of all the people in the town, and is troubled by the state of moral turpitude. He cannot break the confessional, but knowing of his flock's logical turn of mind, he hits upon a plan to do God's work. He announces in Mass one Sunday that there is adultery in the town. Is the priest correct? Will this result in every adulterer being denounced? Solution
smullyan/stamps
The moderator takes a set of 8 stamps, 4 red and 4 green, known to the logicians, and loosely affixes two to the forehead of each logician so that each logician can see all the other stamps except those 2 in the moderator's pocket and the two on her own head. He asks them in turn if they know the colors of their own stamps: A: "No" B: "No" C: "No" A: "No B: "Yes" What are the colors of her stamps, and what is the situation? Solution
supertasks
You have an empty urn, and an infinite number of labeled balls. Each has a number written on it corresponding to when it will go in. At a minute to the hour, you take the first ten balls and put them in the urn, and remove the last ball. At the next half interval, you put in the next ten balls, and remove ball number 20. At the next half interval, you put in ten more balls and remove ball 30. This continues for the whole minute.... how many balls are in the urn at this point? (infinite) You have the same urn, and the same set of balls. This time, you put in 10 balls and remove ball number 1. Then you put in another ten balls and remove ball number 2. Then you put in another ten balls and remove ball number 3. After the minute is over, how many balls are left in the urn now? (zero) Are the above answers correct, and why or why not? Solution
timezone
Two people are talking long distance on the phone; one is in an East- Coast state of the US, the other is in a West-Coast state of the US. The first asks the other "What time is it?", hears the answer, and says, "That's funny. It's the same time here!" Solution
unexpected
Swedish civil defense authorities announced that a civil defense drill would be held one day the following week, but the actual day would be a surprise. However, we can prove by induction that the drill cannot be held. Clearly, they cannot wait until Friday, since everyone will know it will be held that day. But if it cannot be held on Friday, then by induction it cannot be held on Thursday, Wednesday, or indeed on any day. What is wrong with this proof? Solution
verger
A very bright and sunny Day
The Priest did to the Verger say:
"Last Monday met I strangers three
None of which were known to Thee.
I ask'd Them of Their Age combin'd
which amounted twice to Thine!
A Riddle now will I give Thee:
Tell Me what Their Ages be!"

So the Verger ask'd the Priest:
"Give to Me a Clue at least!"
"Keep Thy Mind and Ears awake,
And see what Thou of this can make.
Their Ages multiplied make plenty,
Fifty and Ten Dozens Twenty."

The Verger had a sleepless Night
To try to get Their Ages right.
"I almost found the Answer right.
Please shed on it a little Light."
"A little Clue I give to Thee,
I'm older than all Strangers three."
After but a little While
The Verger answered with a Smile:
"Inside my Head has rung a Bell.
Now I know the answer well!"

Now, the question is:
How old is the PRIEST?? Solution

weighing/balance
You are given 12 identical-looking coins, one of which is counterfeit and weighs slightly more or less (you don't know which) than the others. You are given a balance scale which lets you put the same number of coins on each side and observe which side (if either) is heavier. How can you identify the counterfeit and tell whether it is heavy or light, in 3 weighings?
More generally, you are given N coins, one of which is heavy or light. Solution

weighing/box
You have ten boxes; each contains nine balls. The balls in one box weigh 0.9 kg; the rest weigh 1.0 kg. You have one weighing on an accurate scale to find the box containing the light balls. How do you do it? Solution
weighing/find.median
What is the least number of pairwise comparisons needed to find the median of 2n+1 distinct real numbers? Solution
weighing/gummy.bears
Real gummy drop bears have a mass of 10 grams, while imitation gummy drop bears have a mass of 9 grams. Spike has 7 cartons of gummy drop bears, 4 of which contain real gummy drop bears, the others imitation. Using a scale only once and the minimum number of gummy drop bears, how can Spike determine which cartons contain real gummy drop bears? Solution
weighing/optimal.weights
What is the smallest set of weights that allow you to weigh on a balance scale every integer number of kilograms up to some number N? Solution
weighing/weighings
Some of the supervisors of Scandalvania's n mints are producing bogus coins. It would be easy to determine which mints are producing bogus coins but, alas, the only scale in the known world is located in Nastyville, which isn't on very friendly terms with Scandalville. In fact, Nastyville's king will only let you use the scale twice. Your job? You must determine which of the n mints are producing the bogus coins using only two weighings and the minimum number of coins (your king is rather parsimonious, to put it nicely). This is a true scale, i.e. it will tell you the weight of whatever you put on it. Good coins are known to have a weight of 1 ounce and it is also known that all the bogus mints (if any) produce coins that are light or heavy by the same amount.
Some examples: if n=1 then we only need 1 coin, if n=2 then clearly 2 coins suffice, one from each mint.

What are the solutions for n=3,4,5? What can be said for general n? Solution

zoo
I took some nephews and nieces to the Zoo, and we halted at a cage marked

Tovus Slithius, male and female.
Beregovus Mimsius, male and female.
Rathus Momus, male and female.
Jabberwockius Vulgaris, male and female.
The eight animals were asleep in a row, and the children began to guess which was which. "That one at the end is Mr Tove." "No, no! It's Mrs Jabberwock," and so on. I suggested that they should each write down the names in order from left to right, and offered a prize to the one who got most names right.
As the four species were easily distinguished, no mistake would arise in pairing the animals; naturally a child who identified one animal as Mr Tove identified the other animal of the same species as Mrs Tove.

The keeper, who consented to judge the lists, scrutinised them carefully. "Here's a queer thing. I take two of the lists, say, John's and Mary's. The animal which John supposes to be the animal which Mary supposes to be Mr Tove is the animal which Mary supposes to be the animal which John supposes to be Mrs Tove. It is just the same for every pair of lists, and for all four species.

"Curiouser and curiouser! Each boy supposes Mr Tove to be the animal which he supposes to be Mr Tove; but each girl supposes Mr Tove to be the animal which she supposes to be Mrs Tove. And similarly for the other animals. I mean, for instance, that the animal Mary calls Mr Tove is really Mrs Rathe, but the animal she calls Mrs Rathe is really Mrs Tove."

"It seems a little involved," I said, "but I suppose it is a remarkable coincidence."

"Very remarkable," replied Mr Dodgson (whom I had supposed to be the keeper) "and it could not have happened if you had brought any more children."

How many nephews and nieces were there? Was the winner a boy or a girl? And how many names did the winner get right? [by Sir Arthur Eddington]
Apptitude

> > > ---------

> > > 1)2 pencils costs 8 cents,then 5 pencils cost how much

> > > a)20c

> > > 2)a work is done by the people in 24 min.one of them can do this

work

> > > a lonely in 40 min.how much time required to do the same work for

the

> > > second person

> > > a)60min

> > > 3)a car is filled with four and half gallons of oil for full

round

> > > trip.fuel is taken 1/4 gallons more in going than coming.what is

the

fuel

> > > consumed in coming up.

> > > a)2 gallons

> > > 4)low temperature at the night in a city is 1/3 more than 1/2

hinge as

> > > higher temperature in a day.sum of the low temp and high temp is

100 c.

> > > then what is the low temp.

> > > a)40 centigrade

> > > 5)a person who decided to go weekend trip should not exceed 8

hours

> > > driving in a day average spped of forward journey is 40 mph.due

to

> > > traffic insundays the return journey average speed is 30 mph.how

far he

> > > can select a picnic spot.

> > > a)120 miles

> > > 6)a sales person multiplied a number and get the answer is 3

> > > instead of that number divided by 3.what is the answer he

actually

> > > has to get.

> > > a)1/3

> > > 7)a ship started from a port and moving with I mph and another

ship

> > > started from L and moving with H mph.at which place these two

ships

> > > meet.

> > > a)between I and J and close to J

> > > 8)a building with height D ft shadow upto G.A neighbour building

> > > with what height shadow C ft is

> > > a)B ft

> > > 9)a person was fined for exceeding the speed limit by

10mph.another

> > > person was also fined for exceeding the same speed limit by twice

the

same

> > > if the second person was travellling at a speed of 35 mph.find

the

> > > speed limit

> > > a)15mph

> > > 10)a bus started from bustand at 8.00am and after 30min staying

at

> > > destination it returned back to the bustand.the destination is 27

> > > miles from the bustand the speed of the bus 50percent fast speed

at

what

> > > time it returns to the bustand.

> > > a)11.00am

> > > 11)in a mixture,R is 2 parts,s is 1 part in order to make s to

25% of

the

> > > mixture,howmuch r is to be added

> > > a)one part

> > > 12)wind flows 160 miles in 330min.for 80 miles how much time

required

> > > a)---

> > > 13)with 4/5 full tand vehicle travels 12 miles, with 1/3 full

tand how

> > > much distance travels

> > > a)5 miles

> > > 14)2 trees are there.one grows at 3/5 of the other.In 4 years

> > > total growth of the trees is 8 ft.what growth will smaller tree

will

have

> > > in 2 years.

> > > a)2 ft

> > > 15)a storm will move with a velocity of --- towards the center in

---

> > > at the same rate how much far will it move in hrs

> > > a)8/3 or 2 2/3

> > > 15 not clear

> > >
DE SHAW
-------

(1)A man bought two horses for Rs.924 each and sold one horse for 15% profit and the other for 15% loss.What is the net gain?
(2) Two pumps fill atank in 20 hrs. One pump fills the same tank 10hrs. faster than the other pump. In what time the other pump fills
the tank?
(3) X men in Xhrs/day finish a work in x days. Y men in y hours per day finish the work in
(a) X**2/Y**2 (b)X**3/Y**2 (c) Y**2/X**2 (d) Y**3/X**2
(4) 8 men + 2 boys finish a work in 16 days. 2 men + 5 boys finish a work in 20 days. 8 men and 8 boys finish the same work in how
many days?
(5)A & B are two trains, travell from X & Y stations to Y & X stations after crossing each other A takes 4 hrs.48 mins. To reach Y
station. B takes 3hrs.20 mins. to reach X station. The speed A is 45kmph. Speed of B is ?
(6) 5 questions on series
(a) ab--bbc---ac----accc
(b) &(c) like this 5.
(7)5 questions on alfabets.
( 10 questions on English Grammer.
(9) 20 questions on reasoning.


DE SHAW Latest fresher Engineer Placement Paper 2006


PROGRAMMING


Section 1.

1. To display the contents of a executable file the following command can be used
(a) cat (b) od (c) vi (d) ed ans : b
2. Assume the current directory contains 10 files and does'nt contain 'temp'. What will be the output of the follwing commands?
$ls > temp, $wc -l temp
(a) 9 (b) 10 (c) 11 (d) undefined. ans : b
3. If one wants the output of one command( command1) to be printed inthe printer as well as to be added to another file (outfile)
which one of the following is a currect command he can give?
(a) $command1 >>outfile|tee lpr
(b) $tee -a command1 | lpr
(c) $ command1 | tee outfile | lpr
(d) $ command | tee -a outfile |lpr ans : d
(4) In the shell program set -x will cause
A. Execution of the commands in the background
B. Execution of the commands in verbose mode
C. Exit from the shell program.
D. Exit from the shell program after executing the next command
(5) ACL in UNIX refers to
A. Acces Control List
B. Action Control List
C. Application Command Language
D. Advanced C lanuage
(6) The command echo*
A. will print * on the screen
B. will print contents of all the files in the current directory
C. will list the files in the current directory
D. will print the contents of all shell variables
(7) ls || date will
A. print the name of the files in the current directory
B. print today's date and time
C. (A) followed by (B)
D. none of the above
( The built-in shell variable $$ refers to
A. printing numbers in dollar format
B. proces id_ of last command
C. proces id_ of last background command issued
D. proces-id of current shell
(9) dd is mainly used for
A. dealing with raw, unformated data, whatever the source
B. dealing with data dictionary
C. deleting a directory
D. none of the above
(10) vis in UNIX is
A. a command that takes only one input
B. a command for deleting strange or unwanted characters that may have crept into files.
C. Points non-printable characters in understandable format
D. All of the above
(11) Which of the following is true regarding the UNIX
(i) Multiuser Operating System
(ii)Multitasking Operating System
(iii) Real timing Operating System
A. i only B. i and ii only C. i and ii and iii only D. i and ii
(12) ln command is used to
A. link object codes into a executable code
B. give two names to the same file
C. set line numbers for the file
D. none of the above
(13) nohup command is used for
A. Protecting the execution of programmes from aborting when
hangup signal is received
B. Changing the execution priority of the programs
C. Not hanging up of the modem
D. Disconnecting a node from the system
(14) SCCS is a
A. Tool for maintaining large programmes in a production environment
B. Communication Protocol
C. Shell Programming Language
D. String processing utility
(15) Which one of the following is true as long as UNIX is concerned
A. One can do programming in C only
B. It can support terminals capable of printing only uppercase characters
C. The text files are sorted as it is in MS-DOS
D. None of the above
(16) Inside vi editor to replace the string /10/$/94 with
10/$$/92 globally the following command can be used
A. :1,$ s/\/10\/\$\/94/10\/\$\$\/92/g
B. :1,$ s/\/10\/\$\/94/10\/\$\/$92/
C. :s/10/$/94/10/$$/92/g
D. :1,$ s/\/10\/$\/94/10\/$$\/92/g
(17) The ed command without any argument
A. will print the current working directory
B. will make the home directory as current directory
C. will ask for the directory to be used as the current
directory
D. will go to the previous directory
(1"0" nice command is used
A. to increase/decrease execution priority of a command
B. to compress a file
C. to run a programme at latter time
D. to set the key board responce slower
(19) What will be the output of the following command sequence
$ x='I am x'
$sh
$echo $x
A. I am x B. Blank line C. x D. None of the above
(20) The command tr a-z 0-9 <>(y)?(x)y)
main()
{
intx=5,y=5;
printf("maximum is %d",MAX(++x,++y));
}
the outpput of the programis
a)maximum is 7 (b)maximum is 5 (c)maximum is 6
d)none of the above
2)given the following definitions
int *p,*q,r;
int values[30];
p=&values[0];
q=values+29;
r=++q-p;
what will be the value of r ?
a)address of q minus p
b)number of elements in the array
c)(value pointed by q)+1-(value pointed by p)
d)none of the above
3)what will the output of the program?
#include
//print the sum of the series 1/5+1/4+....
static int =5;
main()
{
int sum=0;
do
{
sum+=(1/i);
}while(0
main()
{
intoldvar=80;newvar=-80;
int swap(int,int);
swap(oldvar,newvar);
printf("numbers are %d\t%d",newvar ,oldvar);
}
int swap(intolval,int neval)
{
int temval=olval;
olval=neval;
neval=temval;
}
the output of the program is
a)numbers are 80-80
b)numbers are 80 80
c)numbers are -80 80
d)numbers are -80 -80

5 STUDY THE PROGRAM BELOW, WHICH OF THE FOLLOWING STATEMENT WILL MAKE
PROGRAM WORK :-
main ()
{
int *! = 10 , *j=20;
i=i*j;
}

A) Replace i = i*j; as i = (int) ((int) i * (int)j);
B) No error
C) Replacei= i*j;as i = (int*) ((int)i*(int)j);
D) Replace i+i*j ; as i = (int) i* (int)j;

6 Study the following program
#include
enum mode = {green,red,orange,blue ,white};
main ()
{
green = green +!;
printf("%d,%d",green,red );

}

The output of the program will be :-

A) 1,1 B) 0,1 C) No output, error in compilation
d) None of the above


7 Study th following statements.

#define DELAYTIME 1000
volatile extern int k;
intj;

for (i=0;i
main()
{
char buff[] = "this is a test";
int i, *ptr;
ptr = (int*)buff;
for (i=0;*ptr; i++);
printf("%c",*ptr++);
}

The following will be the output

A) This is a test B) It'll print junk C) Compilation error
D) None of the above

9 Select the explanation for the following declaration
itn (*(*ptr)(int)) (void)
A) ptr is apointer pointing to a integer function that takes an
intvalues returns an integer which will points to a function with
no argument.
B) ptr is pointer to function that takes an int value returns a pointer
to a function with ano argument which returns a integer
c) This is not a valid C statement.
D) None of the above.

10 Study the following program

# include
char *c[] ={
"FILE",
"EDIT",
"SEARCH",
"COMPILE",
};

HAR **cp[] = {c+3,c+2,c+1,c};
char ***cpp = cp;
main()
{
printf("%s", **cpp);
printf("%s"< *--*++cpp+3); printf("%s", *cpp[-2]+3); printf("%s\n",cpp[-1][-1]+1); } The output of this program is A) SEARCHFILEEDITCOMPILE B) SEARCHCOMPILEEDIT C) SEARCHEPILEDIT D) None of the above 11 What is the size of ptr1 and ptr2. struct x { int j; char k[100]; unsigned i; }; int *ptr1: struct X *ptr2; A) Same depending on the model used B) 2,104 C) 2, Undefined for memory is not allocated D) 2,4 12 If i = i * 16; Which of the following is a better approach to do the operation A) Multiply i by 16 and keep it B) Shift left by 4 bits C) Add i 16 times D) None of the above 13 What is the output of the following program #include
main()
{
int i = 0;
switc(i) {
case 0 : i++;
case 1 : i++2;
case2 : ++i;
}
printf("%d",i++);
}

output of the program :-
A) 1 B) 3 C) 4 D) 5

14 In the following , where means

lseek(fd,0L,SEEK_END);
where = tell(fd);
A) End of file. B) Head of file C) Cannot be defined
D) In between head and end of file.

15 Assuming that you are using IBM PC ,you have to a file of 128 intergers into a character array of 256 characters . Which statement you use ?

char buf[256];
int word[128]'
int i;
i varies from 0 to 255 in steps of 2

a) word=buf[i+1]*0x100 + buf;
b) word=buf*0x100 +buf[i+1];
c) word[i/2] = buf *0x100 + buf[i+1];
d) word[i/2]=buf[i+1]*0x100 +buf;

16 If i=5, what is the output for printf( " %d %d %d", ++i,i,i++);

a) 5,6,7 b) 6,6,7 c) 7,6,5 d) 6,5,6

17 For the following code how many times the printf function is executed

int i,j ;

for(i=0;i<=10;i++); for(j=0;j<=10;j++); printf("i=%d,j=%d\n",i,j); a)121 b) 11 c) 10 d) None of the above 18 What is the output generated for the following code #define square (a) (a*a) printf("%d",square(4+5)); a) 81 b) 4 C) 29 D) None of the above 19 For the following statement find the values generated for p and q? int p = 0, q =1; p = q++; p = ++q; p = q--; p = --q; The value of p and q are:- a) 1,1 b) 0,0 c) 3,2 D) 1,2 20 What is the output generated by the following program ? #include
main()
{
int a , count;
int func(int);
for (count = 1 ;count <=5;++count) { a = func(count); printf("%d", a); } } int func(int x) { int y; y=x*x; return(y); A) 1234567 b) 2516941 C) 9162514 D) 1491625 1. Helmet:Head: ans: Breakplate:chest 2. Writer:Pen: ans:Carpenter:Saw 3. cargo:lorry: 4. In one shocking instance of ________________ research, one of the nations influential researchers in the field of genetics reported on experiments that were never carried out and published deliberately_________ scinetific papers on existed work. ans: Fradulent- deceptive 5. We need more men of culture eligitent we have too many ____ among us ans: philistines 6. Hide-bound choose nearest antonym ans: Open minded 7. She has been in her Bonnet She cantell _____ ans:Anto 8.If x-2y=2;2x+y=4 which of the following is right ans:d 9. If 2men and 7boys can do a work in 16days.3men and 8boys can do in12 days 8menand 8boys ? ans;6 10. Aperson wants 30% discount. But shopper gave 20% and 12%succesively discount then the person gets ans:29.6 11. The distance between A and B stations is 110 km. apart on a st.line. One train starts at A at 7am. and travels towards B at 20kmph. Another starts at B at 8am.and travels towards A at a speed of 25kmph. AT what time they will meet? ans:10am. 12. 2,2,6,52.5,157.5,630 find the wrong number ans: replace 52.5 by 45 13. 02,12,28,722,152,312,632 find the wrong number ans. replace 28 by 32 14. Air resistance is proportional to square of the velocity at a speed of 3kmph. the resistance is 0.000045 gm/cm. An aeroplance is travelling at a speed of 250 kmph. What is the air resistance offered in kg/mit ans:0.03125 15. A person gives 10% discount and he revenues 10% in bargaining. The printed price is 330. What is actual price? ans:270 16. For what period of time for 1800 at 5% interest will give interest of 390% ans:13/3 17. 10 years back thef father age is 7 times of his son. After 2 years twice the age of the father is equal to 5 times of the son. What are their ages? ans;f->38,S->14
18. Train travels 100km. in first 2hrs. and 200 km. in 3hrs. and 150 km. in 2.5hrs. What is the avg. speed? ans;60kmph
19. A number when divided by 342 gives remainder 47 When the same number is divided by 19,what would be the remainder ? ans:9
20. A and B can do work in 6 days. B alone can do in 16 days. After 3 days of combined work B left. In how many days further A completes remaining work? ans:24/5 days
21. In a parking place there are 36 vehicles. After first one scooter is there. AFter 2nd car two scooters, after 34d car and so on.How many scooters are there in second half of the row? ans; (YOU PLEASE DO THIS PROBLEM)
22. How many times do the hands of clock coincide in a day? ans;22
23. Fraction and simplification one problem is there. The exact answer is 7/13.(this damn correct)
24. The least/greatest 4 digit numbers which when divided by 15,27,35,
42 leaves in each case a remainder 7 is ans: 1897,9457
THERE IS SEPERATE SECTION FOR CRITICAL REASONING(GMAT TYPE) 6 QUESTIONS LIKE THE FOLLOWING.
25. All fans are vans. No vans are fans
26.All young scientists are optimistic. All optimists are open minded.
27. Assertion: Comets belong to the solar family. REason: Comets burst into pieces and revolve around the sun ans; Both A&R are true but R is not

Correct the sentence questions 4.
8 figures are there. Among these for 4 problems you have to find the next figure. for remaing you have find odd figure.(ALL ARE EASY )
ONE ANALYTICAL QUESTION AS FOLLOWS (THIS ALSO VERY EASY)

five people in a family named A,B,C,D,E.probable answers confirm by reading the question carefully.
ans: A,B -sons
doctor C -daughter
officer D - daughter in law ie. wife of B
using this you have to solve five questions. that is very easy
if you confirm the above.
------------------------------------------------------------------------------------------------
DE SHAW
---------
Section-A

Write the programs for the following problems in C.

1. Swap two variables x,y without using a temporary variable.


2. Write algorithm for finding the GCD of a number.


3.Write a program for reversing the given string.


4. The integers from 1 to n are stored in an array in a random
fashion. but one integer is missing. Write a program to find the
missing integer.

Ans): Hint : The sum of n natural numbers is = n(n+1)/2.
if we subtract the above sum from the sum of all the
numbers in the array , the result is nothing but the
missing number.


5. Some bit type of questions has been given on pointers asking to
to find whether it is correct from syntax point of view. and if
it is correct explain what it will do. (around 15 bits).

DE SHAW Latest Freseher Engineer Placement Papers 2006


Section-B


6. For the following C program

#define AND &&
#define ARRANGE (a>25 AND a<50) a =" 30;" r1="6.25,r2="2.5,a;" a="AREA(r1);" a="AREA(r2);">=5
group by deptno;
identify the line no which contains the error
a. 1
b. 2
c. 3
d. 1,3
6. choose the group function that can be used with any data type
a. sum()
b. min()
c. avg()
d. all
7. which of the following sequence is true
a. WHERE,HAVING,GROUPBY,ORDERBY
b. GROUPBY, WHERE, HAVING, ORDERBY
c. ORDERBY,GROUPBY,WHERE,HAVING
d. NONE OF THE ABOVE
8. which of the proper keyword to deallocate memory
a. free
b. delete
c. clear
d. remove
9. what is the index no of the last element of an array with 29
elements
a. 29
b. 28
c. 0
d. programmer defined

10. what is the final value of x when the code for(int
x=0;x<10;x++)>
void main()
{
char buffer[10]={"Genesis"};
printf("%d",&buffer[4]-(buffer));
}
a. 3
b. 4
c. 0
d. illegal pointer subtraction
14. what is the output for
#include
main()
{
static int a[]={5,10,15,20};
int * ptr=a;
int ** ptr_ptr=&ptr;
printf("\n %d",**ptr_ptr++);
}
a. 5
b. 10
c. 15
d. 6
15. what is the value of expr..
1+2/3*4+1
a. 2
b. 3
c. 4
d. 4.666666
e. 5
16. identify the relationship between the many employees
working
in a dept..
a. one to one
b. one to many
c. many to one
d. many to many
17.there was a table given and it was asked which normal form does
it
follows..
18. the process of including some controlled redundancy for
the
sake of performance
is known as
a. normalization
b. Cartesian product
c. Denormalization
d. None
19. in a doubley linked list
a. the last node contains the address of the first node
b. each node contains the address of previous and next node
c. each node contains the address of previous node
d. none
20. in a queue each node contains
a. the address of previous node
b. address of next node
c. address of both the previous and next node
d. none of the above


************************: oracle paper


the test was of 1 hour 30 ques. g apti and 30 of
technical.......some
ques. of g apti were very lengthy so don't end up in solving
them.....time was less......some 15 ques. from arithmetic......and
rest
15
logical,statement interpretation,arrangement,tense
correction......and
like
that......
i am enclosing here the 2 C questions :
1. given a square matrix which consists only of 1 and 0......find
which
rows,which cols and which diagonals consist entirely of 1's.
2. given an array of integers find all possible combinations of
the
numbers whose sum equal to 90.....
ans : knapsack problem (in data structures - aho ullman)
Note : for them solution was not the criteria.......but the
approach
was important......the solution should be generalised and
optimized........optimization was given the top priority........
here is the techincal paper :
plz try to solve them urself by trying on comp.
1. const int MAX=10;
main()
{enum a {a,b,MAX};
print MAX;
}
2. enum object is a const which can only be assigned a value at
initialization or a variable which can be assigned any value in
the
middle of
the program?
3. void *p;
what operation cannot be performed on p?
ans : arithmetic operation unless it is properly typecasted
4. char **p="Hello";
print p,*p,**p
5. main()
{char str[]="Geneius";
print (str);
}
print(char *s)
{if(*s)
print(++s);
printf("%c",*s);
}
6. what does the function fcloseall() does ?
7. main()
{printf("Genius %d",fun(123));
}
fun(int n)
{return (printf("%d",n));
}
8. difference between definition and declaration.
9. find the error?
fun()
{int i=10;
if(i<10) a="9,b="5,c="3,d;" d="(b-c)<(c-a)" 1="?" i="4;" i="i/4);" cols="?" oracle ="="="="="="" max="10;" p="Hello" i="10;" a="9,b="5,c="3,d;" d="(b-c)<(c-a)" 1="?" i="4;" i="i/4);" cols="?" x="2;" x="%d" x="2;" x="4;" x="2;" a="Hello Orcale Test">0


X<=2 ; X >=3

2)if 5x*x+14*x+k=0 having two reciprocal roots find the value of k.


3&4)two sentence are given ,in between four sentence are given in

change order . (like between 1 & 6 ,abcd four sentence are given 1 a b c

d 6)

find the correct order?

5)if first term of AP is 5 .16th term is 45.find the sum of first 16

terms.

6)x,y and z are odd no. not necessarly in sequence.then y=?

(1)mean of x and z is 114.

(2)mean of y and z is 113.

115


7)ram is 27 year old then mohan.after 7 year ram age is thrice as mohan

age .find ram age?

67/2

8)if three tapes are filling a tank of capacity of 500lit with speed of

30lit/sec,48lit/sec and 36lit/sec. Find after how long time tank will

fill?

500/114

9)find the root of given eq x-2/(x-1)=1-2/(x-2) if possible.

x = 0

10)find the point of intersection of \

15x+9y=15

5x+3y=21


NO

11)suppose in a pot 20 cards are there label 1-20 on that. find the

probability of getting two prime.

8/20 = 2 / 5

12)in an island three persons are there Jam ,Dam and Sam .sam having

pencil,dam having cap and Jam having book .we have find who is author

among them if.

(1)Sam says ,Jam is author but author wearing cap.

(2)Dam says ,I am author ,but author not having cap.

(3)Sam says, I am author ,but author having note book.

Find who is author?

jam

13)Jo ,Do and So are three person.

(1) So says Jo is football player, I also football player.

(2) Do says Jo is football player, I also football player.

(3) Jo says Do is football player, I also football player.

Find the football player player among them.

jo

14-16)quest based analogy . like LION:CUB find the pair in given

choice.

17)in a basket 3 mangos,4 apples and 4 bananas are there. Find no of

ways we select randomly 3 fruit from basket?

1Cool if a^x=b^y=c^z and b^2=ac then

find x+z/xz=?

2/y

19)(loga)^2-(logb)^2 = ? ans :- logab-loga/b

20)in a 60 liters of mixture of spirit and water is 7 %.

in order to make water 19%,how much water should be added.(some

thing like this)

21-25)A one and half page length passage will be given and 4 to 5

questions will be asked based on this passage.

26)


technical part:-
==================

pattern: 1) pl/sql--->7 quest

2) java--->5 quest

3) c & pointers--->9 quest

4) dbms and dfd's--->5 quest

5) ds--->4 quest

some quest are here:-

1.what is not a c- storage class (ans.stack)

2.if dba creates one user what are the privilages the user will

get?

3. which keyword is used to const in java (ans.final)

4.char *array[4]={"some string"}

printf("%d",&array[4]-(array)); (ans.4)

5.remote object will be in the package (ans.java.net (verity it))


6.#define sq(a) (a*a)

printf ("%d",sq (3+2)); (ans.11)

7.#define max 20

printf ("%d", ++max); (ans.lvalue required --- error)

.printf ("%d",sizeof (2>3?4?:4:3?4:2));(some thing like this

(ans.syntax error))

9. what is important of free().

10.property of constructor in java program.

11.impotance of macro.

12.underfolw condition of stack.

(1)empty,2)push,3)pop,4)none)


====================

1)Which of the following is not a storage class in C?

Static
Register

Extern

Stack

2)Which of the following 'return' statement is correct?

return, return;

return(1, 2, 3);

return(return 4);

(return 5, return 6);

3)The second argument to fopen() function is?

char

const char *
int *
FILE *

4)What is the output of the program?

#include

void main()

{

char buffer[10] = {"Genesis"};

printf(" %d ", &buffer[4]- (buffer));

}

3
4
0
Illegal pointer subtraction
4

5)If "arr" is an array of 5 x 5 dimension, arr[2][4] is same as

**(a+3+4)

*(a+3)+*(a+4)

**(a+3)+4

*(*(a+2)+4)

APTITUDE 30 questions

Log37

1: ------- = ? ( Log67 )

1 + Log32

2> log(a-b) = log a - log b; then a = ?


(b/(b2+1));

3: 3 black 7 white balls ......... prob of drawing 2 white

balls ? (7/15)

4 > In a lock of 4 rings there r five characters how

many unsuccessful

attempts can be made ? (624)...

5> sqrt(6+sqrt(6+sqrt (6 + .................))))) = ? 3

6: a solution is prepared by mixing two solution

with sprit 20% & 60%...In

what ration they should be mixed to get the 50% sprit

in resultant solution .

(1:3)



7: X2 - (A-3)X +(A+3) = 0

for what value of A the sum of square of roots will be

least ? (A=2);

8: 'a' number of persons work daily 'b' hours to

produce 'c' items. If 'd'

persons walks away from the group what will be the

number of hours to

produce 'c' items. ? (ab/(a-d))

9: - 13 Passage

14 - 18 venn diagram.

19-22 picking based (VERBAL);

23-25 picking odd once out (words )

26: m = ax , n = ay mxny = a2(x+y) find 1/x +

1/y? (1)

27 xy - 2y - 6 =0;

x <> 2 x >2 ...

y is always postive.

28

the diameter of circle can be determined from

1. area.

2. circumference.

Ans either of them..

29:

sum of 2 no. is 7 & product s 10 fnd larger number.

30:

TECHNCAL

It be really tough

They will manly concentrate on

PL/SQL

Java.

C.


1. Output of the following program is


main()


{


int i=0;


for(i=0;i<20;i++)


{


switch(i){


case 0:


i+=5;


case 1:



i+=2;

case 5:


i+=5;


default:





i+=4;


break;

}


}


}


(A) 5,9,13,17 (B)


12,17,22 (C)


16,21 (D) syntax error.



2. What will be the result of the following program?

char*g()

{

static char


x[1024];

return x;

}

main()

{
char*g1="First
String";

strcpy(g(),g1);

g1=g();

strcpy(g1,"Second


String");


printf("Answer

is:%s", g());

}

(A) Answer is: First String


(B) Answer is:


Second String


(C) Run time Error/Core Dump


(D) None of these


3: which will not complete the transaction ....


(UPDATE).



4: PL / SQL loop can be replaced by which loop to get

least number of steps.


5:regarding USER_NDEX.


6: which language is used by end user to manipulate

dbms.

DML


7: what can not be used in object names.


8: what is used to collect information from more than

one table ( JOIN).


9: program on java.swng.


10: problem on JNI


11: something on extendability or searializability


12 some more c codes.


13 on queue defintion.


14 what s orthogonal matrix.


15 Peep stack.



16 reg . class.


17 compiler intilized storage clases.


18. whch storage class allows class to be initialized

in a class.


19 on set font


20 on redundancy ...

Three beauty pageant finalists-Cindy, Amy and Linda-The winner was musician. The one who was not last or first was a math major. The one who came in third had black hair. Linda had red hair. Amy had no musical abilities. Who was first?
(A) Cindy
(B) Amy
(C) Linda
(D) None of these

2. Two twins have certain peculiar characteristics. One of them always lies on Monday, Wednesday, Friday. The other always lies on Tuesdays, Thursday and Saturdays. On the other days they tell the truth. You are given a conversation.
Person A- today is Sunday, my name is Anil
Person B-today is Tuesday, my name is Bill
What day is today?
(A) Sunday
(B) Tuesday
(C) Monday
(D) Thursday

3. The difference of a number and its reciprocal is 1/2.The sum of their squares is
(A) 9/4
(B) 4/5
(C) 5/3
(D) 7/4

4. The difference of a number and its square is 870.What is the number?
(A) 42
(B) 29
(C) 30
(D) 32

5. A trader has 100 Kg of wheat, part of which he sells at 5% profit and the rest at 20% profit. He gains 15% on the whole. Find how much is sold at 5% profit?
(A) 60
(B) 50
(C) 66.66
(D) 33.3

6. Which of the following points are collinear?
(A) (3,5) (4,6) (2,7)
(B) (3,5) (4,7) (2,3)
(C) (4,5) (4,6) (2,7)
(D) (6,7) (7,Cool (2,7)

7. A man leaves office daily at 7pm.a driver with car comes from his home to pick him from office and bring back home. One day he gets free at 5.30 and instead of waiting for driver he starts walking towards home. In the way he meets the car and returns home on car. He reaches home 20 minutes earlier than usual. In how much time does the man reach home usually?
(A) 1 hr 20 min
(B) 1 hr
(C) 1 hr 10 min
(D) 55 min

8. If m:n = 2:3,the value of 3m+5n/6m-n is
(A) 7/3
(B) 3/7
(C) 5/3
(D) 3/5

9. A dog taken four leaps for every five leaps of hare but three leaps of the dog is equal to four leaps of the hare. Compare speed?
(A) 12:16
(B) 19:20
(C) 16:15
(D) 10:12

10. A watch ticks 90 times in 95 seconds. And another watch ticks 315 times in 323 secs. If they start together, how many times will they tick together in first hour?
(A) 100 times
(B) 101 times
(C) 99 times
(D) 102 times

11. The purpose of defining an index is
(A) Enhance Sorting Performance
(B) Enhance Searching Performance
(C) Achieve Normalization
(D) All of the above

12. A transaction does not necessarily need to be
(A) Consistent
(B) Repeatable
(C) Atomic
(D) Isolated

13. To group users based on common access permission one should use
(A) User Groups
(B) Roles
(C) Grants
(D) None of the above

14. PL/SQL uses which of the following
(A) No Binding
(B) Early Binding
(C) Late Binding
(D) Deferred Binding

15. Which of the constraint can be defined at the table level as well as at the column level
(A) Unique (B) Not Null (C) Check (D) All the above

16. To change the default date format in a SQLPLUS Session you have to
(A) Set the new format in the DATE_FORMAT key in the windows Registry.
(B) Alter session to set NLS_DATE-FORMAT.
(C) Change the Config.ora File for the date base.
(D) Change the User Profile USER-DATE-FORMAT.

17. Which of the following is not necessarily an advantages of using a package rather than independent stored procedure in data base.
(A) Better performance.
(B) Optimized memory usage.
(C) Simplified Security implementation.
(D) Encapsulation.

18. Integrity constrains are not checked at the time of
(A) DCL Statements.
(B) DML Statements.
(C) DDL Statements.
(D) It is checked all the above cases.

19. Roll Back segment is not used in case of a
(A) DCL Statements.
(B) DML Statements.
(C) DDL Statements.
(D) all of the above.

20. An Arc relationship is applicable when
(A) One child table has multiple parent relation, but for anyone instance of a child record only one of the relations is applicable.
(B) One column of a table is related to another column of the same table.
(C) A child table is dependent on columns other than the primary key columns of the parent table.
(D) None of the above.

21. What is true about the following C functions?
(A) Need not return any value.
(B) Should always return an integer.
(C) Should always return a float.
(D) Should always return more than one value.

22. enum number { a=-1, b=4, c,d,e,} what is the value of e?
(A) 7
(B) 4
(C) 5
(D) 3

23. Which of the following about automatic variables within a function is correct?
(A) Its type must be declared before using the variable.
(B) They are local.
(C) They are not initialized to zero.
(D) They are global.

24. Consider the following program segment
int n, sum=5;
switch(n)
{
case 2:sum=sum-2;
case 3:sum*=5;
break;
default:sum=0;
}
if n=2, what is the value of the sum?
(A) 0
(B) 15
(C) 3
(D) None of these.


25. Which of the following is not an infinite loop?
(A) x=0;
(B) # define TRUE 0....
do{ While(TRUE){....}
/*x unaltered within the loop*/
(C) for(;Wink {....}
....}
While(x==0);
(D) While(1) {....}

26. Output of the following program is
main()
{
int i=0;
for(i=0;i<20;i++)
{
switch(i){
case 0:
i+=5;
case 1:
i+=2;
case 5:
i+=5;
default:
i+=4;
break;
}
}
}
(A) 5,9,13,17
(B) 12,17,22
(C) 16,21
(D) syntax error.

27. What does the following function print?
func(int i)
{
if(i%2) return 0;
else return 1;
}
main()
{
int i=3;
i=func(i);
i=func(i);
printf("%d",i);
}
(A) 3
(B) 1
(C) 0
(D) 2

28. What will be the result of the following program?
char*g()
{
static char x[1024];
return x;
}
main()
{
char*g1="First String";
strcpy(g(),g1);
g1=g();
strcpy(g1,"Second String");
printf("Answer is:%s", g());
}
(A) Answer is: First String
(B) Answer is: Second String
(C) Run time Error/Core Dump
(D) None of these

29. Consider the following program
main()
{
int a[5]={1,3,6,7,0};
int *b;
b=&a[2];
}
The value of b[-1] is
(A) 1
(B) 3
(C) -6
(D) none

30. Given a piece of code
int x[10];
int *ab;
ab=x;
To access the 6th element of the array which of the following is incorrect?
(A) *(x+5)
(B) x[5]
(C) ab[5]
(D) *(*ab+5} .

· some questions are Code Snippet based.
* Some questions are compiler based i.e. given code snippet will compile or not, if not the reason.
* some question are from the prfix/postfix inc/dec operation based code snippets.
* More than 3 question are based on the sorting algorithms.
* some questions are from the pointers based.
* Code snippets involving memory allocation function.
* All the questions are from c
Some of the question ,i remember, are the following
1.
#include
#define sqr(x) (x*x)
int main()
{
int x=2;
printf("value of x=%d",sqr(x+1));
}

What is the value of x?
a)4 b)5 c)None d)can not compile
Ans: 5
2. what is the wrong in the following program?
#define LBRACKET {
#define RBRACKET }
#define MAIN main
int MAIN()
LBRACKET
int x=2;
printf("%d",x);
RBRACKET
a) This program will compile
b) compilation error
3.
#include
int main()
{
int x=4;
{
{
{
int x=2;
printf("%d",x);
}
}
}
}
a) 4 b)2 c)Nesting not allowed d)dependent on the compiler
4. Go through the following code sinippet
char a[20];
a="Hello Orcale Test";
will this compile?
a) Compilation Error b) Strings are allowed in c but cannot be assigned directly.
c) dependent on compiler
d) will work fine.
5. the expression a+b*c should be conveted to +a*bc. Using tree structure,
Which traversal is the correct one?
a) Postfix traversal b) prefix traversal c) infix traversal d)None
6. what about brk, sbrk
a) system calls b) function calls c) user defined functions
7. Why the use of alloca() is discouraged?
8. Macros support multiple arguments ?
9. the header file
a) contains only compiler directives and extern variables
b) contail only structures and unitions
c) a & b
10. what about "char *(*(*a[])())();"
-----------------------------------------------------------------------------------------------------------------