Monday, September 12, 2011

HCL Aptitude Test ---2

HCL Aptitude
1) a) NMI
b) Software interrupts
c) Hardware interrupts
d) Software and hardware interrupt
Ans: b
2) Which of the following is error correction and deduction?
a) Hamming code
b) CRC
c) VRC
d) None
Ans: b
3) When you switch on your computer, which of the following component affect first?
a) Mother board
b) SMPS
c) Peripherals
d) None
Ans : a
4) Which of the following function transports the data?
a) TCP/IP
b) Transport layer
c) TCP
d) None
Ans: c
5) Which of the following does not consists address?
a) IP
b) TCP/IP
c) Network
d) Transport
Ans:a
6) They given like this……. And some conditions?
a) pre order
b) post order
c) In order
d) None
Ans:c
7) Authentication means….
a) Verifying authority
b) Source
c) Destination
d) Request
Ans: a
8) Symorphous is used for
a) Analysis
b) Synchournization
c) Asynchrouns
d) None
Ans: b
9) There are five nodes. With that how many trees we can make?
a) 27
b) 28
c) 30
d) 29
Ans: c (Check the ans not sure)
10) Traverse the given tree using in order, Preorder and Post order traversals.
ABC
DEF
GHI
Given tree:
Ø Inorder : D H B E A F C I G J
Ø Preorder: A B D H E C F G I J
Ø Postorder: H D E B F I J G C A
And some more questions….. I dint remember those questions
Given tree:
Ø Inorder : D H B E A F C I G J
Ø Preorder: A B D H E C F G I J
Ø Postorder: H D E B F I J G C A
And some more questions….. I dint remember those questions
SECTION –II (C language Basics and programming) this section consists of 20 Questions…….. All
are programs only…
1. main()
{
printf("%x",-1<<4);
}
a) fff0
b) fffb
c) ff0
d) none
Ans: a
Explanation:
-1 is internally represented as all 1's. When left shifted four times the least significant 4 bits are filled
with 0's.The %x format
specifier specifies that the integer value be printed as a hexadecimal value.
2. main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
}
a) e
b) H
c) some address
d) ome garbage value
Ans: b
Explanation:
* is a dereference operator & is a reference operator. They can be applied any number of times
provided it is meaningful. Here
p points to the first character in the string "Hello". *p dereferences it and so its value is H. Again &
references it to an address and * dereferences it to the value H.
3. void main()
{
int i=5;
printf("%d",i++ + ++i);
}
a) 11
b) 12
c) 10
d) output cant be predicted
Ans: d
Explanation: Side effects are involved in the evaluation of i
4. main( )
{
int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};
printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1);
}
a) 100, 100, 100, 2
b) 101,101,101,2
c) 114,104,102,3
d) none
Ans: c
Explanation:The given array is a 3-D one. It can also be viewed as a 1-D array.
2 4 7 8 3 4 2 2 2 3 3 4
100 102 104 106 108 110 112 114 116 118 120 122
thus, for the first printf statement a, *a, **a give address of first element . since the indirection ***a
gives the value. Hence, the first line of the output.for the second printf a+1 increases in the third
dimension thus points to value at 114, *a+1 increments in second dimension thus points to 104, **a +1
increments the first dimension thus points to 102 and ***a+1 first gets the value at first location and
then increments it by 1. Hence, the output is C is correct answer…
5. main( )
{
static int a[ ] = {0,1,2,3,4};
int *p[ ] = {a,a+1,a+2,a+3,a+4};
int **ptr = p;
ptr++;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
*ptr++;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
*++ptr;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
++*ptr;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
}
a) 111
222
332
443
b) 111
222
333
344
c) 111
222
333
444
d) None
Ans: b
6. #include
main()
{
const int i=4;
float j;
j = ++i;
printf("%d %f", i,++j);
}
a) 8
b) 5
c) compile error
d) syntax error
Ans: c
7. main()
{
char *p;
int *q;
long *r;
p=q=r=0;
p++;
q++;
r++;
printf("%p...%p...%p",p,q,r);
}
a) 001… 100…0002
b) 0001...0002...0004
c) 001… 002…004
d) none
ans: b
8. main()
{
unsigned int i;
for(i=1;i>-2;i--)
printf("HCL Technologies");
}
a) HCL
b) Technologies
c) HCL Technologies
d) None
Ans: None(Plz Check the answer)
9. main()
{
int a[10];
printf("%d",*a+1-*a+3);
}
a) 4
b) 5
c) 6
d) None
Ans : a
10. main()
{
float f=5,g=10;
enum{i=10,j=20,k=50};
printf("%d\n",++k);
printf("%f\n",f<<2);
printf("%lf\n",f%g);
printf("%lf\n",fmod(f,g));
}
a) Line no 5: Error: Lvalue required
b) Line no 5: Error: Link error
c) Compile error
d) None
Ans: a
11. int swap(int *a,int *b)
{
*a=*a+*b;*b=*a-*b;*a=*a-*b;
}
main()
{
int x=10,y=20;
swap(&x,&y);
printf("x= %d y = %d\n",x,y)
}
a) x=10 y=20
b) x=20 y=10
c) x=30 y=20
d) none
Ans: b
12. main()
{
int i=300;
char *ptr = &i;
*++ptr=2;
printf("%d",i);
}
a) 665
b) 565
c) 556
d) none
Ans: c
13.main()
{
float me=1.1;
double you=1.1;
if(me==you)
printf(”IloveU”);
else
printf(“I Hate U”)
}
a) I love u
b) I hate u
c) floating point error
d) Compile error
Ans: b
14.
enum colors {BLACK,BLUE,GREEN}
main()
{
printf(”%d..%d..%d”,BLACK,BLUE,GREEN);
return(1);
}
a) 1..2..3
b) 0..1..2
c) 2..3..4
d) none
Ans: b
Some more questions given.. I dint remember…. Be prepare all basic concept in C… so that you can
answer very easily…
SECTION –III (Data structures and C++) this section consists of 10 Questions… Each question carry
2 marks… so they deduct ½ mark for wrong answer…..
1) #include
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}
a)97
b) M
c)76
d) none
Ans: b
2) main( )
{
int a[ ] = {10,20,30,40,50},j,*p;
for(j=0; j<5; j++)
{
printf(“%d” ,*a);
a++;
}
p = a;
for(j=0; j<5; j++)
{
printf(“%d ” ,*p);
p++;
}
}
a) address of array
b) Compile error
c) Lvalue required
d) none
Ans: c
3) struct aaa{
struct aaa *prev;
int i;
struct aaa *next;
};
main()
{
struct aaa abc,def,ghi,jkl;
int x=100;
abc.i=0;abc.prev=&jkl;
abc.next=&def;
def.i=1;def.prev=&abc;def.next=&ghi;
ghi.i=2;ghi.prev=&def;
ghi.next=&jkl;
jkl.i=3;jkl.prev=&ghi;jkl.next=&abc;
x=abc.next->next->prev->next->i;
printf("%d",x);
}
a) 3
b) 2
c) 4
d) 5
Ans: b
4) main(int argc, char **argv)
{
printf("enter the character");
getchar();
sum(argv[1],argv[2]);
}
sum(num1,num2)
int num1,num2;
{
return num1+num2;
}
a) compile error
b) L value required
c) Syntax error
d) None
Ans: a
5)
class Sample
{
public:
int *ptr;
Sample(int i)
{
ptr = new int(i);
}
~Sample()
{
delete ptr;
}
void PrintVal()
{
cout << "The value is " << *ptr;
}
};
void SomeFunc(Sample x)
{ cout << "
Say i
am in someFunc "
<< endl;
} int main()
{
Sample s1= 10;
SomeFunc(s1);
s1.PrintVal();
}
a) say I am in someFunc
b) say I am in someFunc and runtime error
c) say I am in someFunc and null value
d) none
ans: b
and some questions given in DATASTURES… those are based on linked lists only also very big
programs… so you have to do it very careful
SECTION-III (General aptitude+1 passage+Logical) this section consists of 20 questions.. Each
question carry 1 mark…
1) Sandhya and Bhagya is having the total amount of 12000. In that amount bhagya has deducted 3600
as less as sandhya. So what is their shared amount?
a) 2800
b) 3600
c) 4800
d) 9600
Ans : c
2) Six persons have to present at certain meeting. The conditions are,
A present P should present
M present T should present
K present P should present
If A and P present I should be there in meeting
If M and T present D should be absent
If K and P present P should present
Based on this they given some questions… Those are easy only.. you can do it easily…
3) Here they given passage following some questions.. Poetry explaining her experience with HINDI
latest songs… and comparing with old songs… also she is a good singer. Like this they given a big
passage… so read it carefully at a time.. so that u can save your time
4) Dhana and Lavanya started running at same point… But dhana started in anti clock wise direction,
Lavanya started in clockwise direction.. Dhana met lavanya at 900 m . where as lavanya met dhana
at 800 m… so how much distance they covered each other?
a) 1700
b) 900
c) 1800
d) data is insufficient
Ans: d
5) This question is base on Arithmetic mean like algebra… a n+2 = (7+an)/5…. Initially a0= 0…… so
what is the value of a2?
a) 5/2
b) 7/2
c) 7/5
d) none
Ans : c
6) Here they given two statements, based on that they gave some questions
Statement I : I is enough to answer
Statement II: I and II is enough to answer
i) Raja can do a piece of work in 9 days… and govardhan can do a piece of work in 8 days. In how
many days they will complete the work alternatively..
Statement I: They both do in 72/17 days
Statement II : A alone can do 1/9 days
a) I b) I and II c) II d) none

No comments:

Post a Comment