Amdocs Placement Paper - 2


Logical reasoning:

1. 3 types of chickens : baby chickens cost 5 cents, hen chickens cost 3 dollares, rooster chickens cost 5 dollaRs. Buy 100 chickens for 100 dollaRs.
How many will you have from each?

2. Calculate: (x-a)(x-b)(x-c).(x-z)?

3. What is the day after 4 days after 2 days before the day before tomorrow?

4. 2 trains each of length 1 mile enter into 2 tunnels of lenth 1 mile and
2 miles apart. Speed if trains are 5 and 10 miles/hr. Give the postion as
viewed by a helicopter when the trains meet?

5. A says i'm not guilty
b says c is not guilty
c says a is not guilty
if all above are true.
(i) can we say anyone is guilty/innocent?
(ii)who is most likely to be guilty?

6. 18 story building - accountant's office is 5 times the lawyer's office.
Architects office 2 floors up then he is halfway between dentist's &
accountant's office. Architects office halfway down means between dentist's
and lawyer's office. Give the order?

7. How many tennis matches are to be arranged to conduct a tournament
with 213 players?

8. 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. 1 doesn't eat all 3. Find the no. of children.

C/c++ :

a. Void main()
{
char a[6] = "india";
while(*a)
{
printf("%c",*a);
a++;
}
}

1. India 2. I n d i a 3. No output 4. Error 5.null

b. Protected derivation

c. Int m = 10;
main()
{
int m = 20;
{int m = 30;}
printf("%d %d",m,::m);

1. 10 10 2. 10 20 3. 20 10 4. 20 30 5. 30 20 6. None

d. Inline function is used to
1. Reduce program size
2. Reduce memory size

e. Void func(float newtotal)
{ newtotal = newtotal-2;
}
main()
{
float tot = 100.34;
float sum = tot;
sum++;
func(sum);
cout< }

1. 100.34 2. 99.34 3. 101.34 4. 102.34 5. None

f. Unsigned char snapnib(unsigned char misc)
{
int aloha, hamalo;
hamalo = aloha = misc;
misc = (hamalo << 4)+((aloha & 0x0f)>>4);
return(misc);
}
main()
{
int getinp;
unsig char getmisc;
scanf("%x",&getinp);
getmisc = snapnib(getinp & 0xff);
printf("%x",getmisc);
}

1. Change line 4 to misc = (hamalo >> 4)+((aloha & oxof)<<4);
2. Remove the 5
3. Change line 4 to misc = (hamalo >> 4)+((aloha & oxfo)<<4);
4. Change line 11 to getmisc = snapnib(getinp);
5. Nothing

g. Main()
{
int getinp = 6;
while(--getinp)
{
printf("%d",getinp);
if(getinp++ != 3);
else
break;
if(getinp-- != 5)
continue;
else
getinp = getinp - 2;
}

1. 5421 2. 5420 3. 541 4. 6543 5. 5410

h. Unsigned char inn[2] = "5";
int i,j = 0;
sscanf(inn,"%d",&i);
while(i)
{
i = i - 1;
j++;
printf("%d",++j);
}

1. 14 2. 12 3. 24 4. 35 5. None

i. Char *fn(int num)
{
char a[] = "amen";
return(&a[num]);
}
main()
{
int i;
char *prechar;
scanf("%d",&i);
(input is 12)
prechar = fn(i);
printf("%c",*prechar);
}

1. A bus
2. Give string "amen" as global
3. Use return(a[num]) instead of return(&a[num])
4. Give main before fn

j. Unsigned char you = 32767;
unsigned char y = 32768;
u = you + y;
printf("%d",(signed char)u);

1. 65535 2. -65535 3. -1 4. 1 5. None

k. *name = "anything";
*foo = "alright";
*name1 = "wrong";
strcat(name,name1);
printf("%s %s
",name,foo);
return(0);

1. Anything wrong? Wrong?
2. Anything
3. Anything wrong? Alright
4. Error
5. None

assembly :
i) SWAP two variables without temp variables
(use xor, or, and, not)

Amdocs placement paper

Amdocs
placement paper-1