type your search

Showing posts with label Solutions. Show all posts
Showing posts with label Solutions. Show all posts

Thursday, January 26, 2012

Solutions to Logical Puzzles-3

1)

2)3,
The number obtained by dividing 48 with 4 is 12 which is even while all the others get odd number for the same.

3)4,
The sequence has to be AON,EWR,IEV,MMZ

4)2
The remaining 3 are input devices.

5)2
The remaining 3 represent an image.

6)3
Trousers can only take a plural form while others can also take a singular form.

7)

8)

9)4
All the other three lie inside a cell.

10)

11)4

12)3

13)1

14)2

15)3

16)3

17)1

18)3

19)3

20)4

Wednesday, January 18, 2012

Solutions to C programming questions



1 solution) gives compiler error because of post increment on an expression and it it valid only on variable


2 solution) 9 9 56



3 solution) ans1: x*=y+1;
ans2:x*=++y,y--;



4 solution) emptystring or nthing



5 solution) First call can take an integer as input whether or not you put any spaces/newlines/white space characters before it.
But the second call expects at least one ' ' [ space ] character and then some/none white space characters and then an integer.



6 solution) 16


7 solution) 1111


8 solution) prints the numbers in 2 rows each containing 10 elements with in between spaces


9 solution) it won't because of overflow in the statement *a=*a+*b;


10 solution) 4 8


11 solution) 987641

12 solution) 2 1 2

13 solution) unsigned/**/int/**/p;


14 solution) 3 3 5 5


15 solution) output1:2 3
output2:2 4


16 solution) 111


17 solution) 82


18 solution) segmentation fault


19 solution) 15


20 solution) (nil)


21 solution) It prints the lower case letters present in the input


22 solution) 3 1


23 solution) 12
concatinate(1,2)


24 solution) *1 -> replacing '<' with '+' in the declaration of the loop #include
int main(){
int n = 42;
for(int i = 0; i + n; i-- )
printf("-");
return 0;
}
* 2 -> replacing n with i in the declaration of the loop
#include
int main(){
int n = 42;
for(int i = 0; i <> adding a '-' before i in the comparison in for loop
#include
int main(){
int n = 42;
for(int i = 0; -i <

Solutions to Amazon Intern Interview Questions

1)Place a red ball in a urn and all the further balls in the other urn.The probability for picking out the red ball is now greater than 0.5.

2)If v<=2V then the position is (v*L)/(2*V) from the starting point else it is 2*L -(v*L)/(2*V) from the starting point.

4)If we know the process then we can kill it by killall -9 "process name" else we can kill it using its process id obtained by the command ps -x by kill -9 "processid" .

5)Top command displays all the Linux tasks running at that particular time.It provides their running time and the resources used.

6)The number appearing 2 times is (sum of all the numbers in the array) - (sum of the numbers from 1 to n).
For floating numbers multiply it with 100 and proceed.