You are on page 1of 19

ECTest ID: 00

www.gateforum.com

( )=
( )
( )

&

!"#

!$#

! # $

!%# $

' (

)
*

!"#
,
&

0)

!"# 1

!%#
$

! # &&

!$# &

' /
/
! #

&

! #

!"#

&

!$#

!%# &

&

)
!$# 1

!%#

= { 4 &4 ,4 .424 3} 4

%"/

&

.
3
,

56
!"#

&,.23

!$#

,&.23

! #

,&.32

!%# , & .

32

)
!"# 7

))

! # 8

8/
8("

!$# "
!%#

9)
)

8/
8("

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 1 of 19

ECTest ID: 00

www.gateforum.com

:
!"#

!$#

! #

!%# ;
<

=
03.

9,0 0<

30

!"# :

!$# <

! # 1

!%# +

4 4 4

)=

4 &4 . )

4,4 .4 34 14

!"#

!$#

! #

!%#

.0

&<

>
9

&+0
"/4 ';5

!"# 14 34 2

3.

6 %

!$# :4 :4 3

?) ?
? 2 & 9
9
?) ?
?
)

! # :4 24 <
4

&<

!%# 14 24 3

? )

&23

!"# &23 7 9 4 1

!$# &23 7 9 4 &<

! # 2 & 7 9 4 &+

!%# 3. / 9 4 &<

&

9
)

!$# &

! # &

!%# &

9
!$# 2

! # .

!%# ,

0
!"# 7

!"#

!"# &

!$# $

! #

) -9
!%# (

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 2 of 19

ECTest ID: 00

www.gateforum.com

int j, n;
j = 1;
while (j <=n)
j = j*2;
)
!"#

&

/ )
))

!$#

! #

! #/

! #

! #8

)
!%#

&

/
)&

! #/
(

&

)&

!&#

9 @+

!,#

!"#

0 ,

0 &

!$#

0 &

0 ,

! #

0 &

0 ,

!%#

0 ,

0 &

?
8"'(
!"#

!$#

! #

0)
!%# $

9
?

<

)0
!"#

)
!$# 6)

! # " ' !?# )


1

))

!%# " '"' !?# )


7

!"# =

!$#

! # (

!%# 5

&+

%
!"# =

!$#

)
! # %5(

)
!%# (7

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 3 of 19

ECTest ID: 00

&

!"# &
&&

www.gateforum.com

"

!$# ,

'

! # .

!%# 2

) '

)
%6 ( 56

(
(

!"#
! #

( )
( )

&,

( ))

!$#

( ))

!%#

(
(

( ))

( )
( )

( ))

)
!"# " 9 0
!$# "

! #

1+

&2

!%# 5
&.

( ))

9
4 &4, 4B 4&+
9

)
!"#

&2

!$#

&
..

' "

..

! = { 4 "4 4

! =

"

}4 = {
&

"4

!"#

4.

!%#
.)

"4

} 4

{ 4 "4 4 }

! = { 4 & 4 , 4 . }

))

!%# 5

! # &

} 4 = {

&

1A
&+A

024 0&4

!$# 0:

&3

&+A
9
)

!"# 02

)
)

! #

4 &4 ,4 .

'

( ! 4 )
!$#

&
,
.

&

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 4 of 19

ECTest ID: 00

www.gateforum.com

! #

!%#

&

&

,
.
.

&:
%=

!"#
!$#

&,

{
{

&

#
,

4 4+

4 4 +4

4 4+

4 4 +4

= +4

}
}

&4

$
,

)
9

}
C

C
! # C

&,

!%# 5

&<

!"#
&1

"
'=

!"#

!$#

&

1
4
<

=+2

! #

&

!%#

{+4

9,

!$#

' = +&

,+

! #

{+4

24

!%# 1
4 &}

!"#
!$#

8'

! #
!%#

8'

8'

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 5 of 19

ECTest ID: 00
,

{
# {

,&

,,

&

}+

56

! #

! #

! #

!(#

!"#

%
'

{+4

'

)=

4 4 4

{
!%# {

( +4 .424 :4 <4 14

&

! #

% = (D )

+ ( = %D )

& % D (D ) =

!%# "

>

+
&

!%# &
?0

* =

) -

!$# &

) )


C D E F CE G %(

! # 6 9
9
9$

!%# (

C
4

-)

!$# 6 9

-)

!"# 6 9

! # &

}+

!$#

( ))
)
) -

}
{+4 } }

{+4

,4 2 )

!"# &

,2

&

!$#

}+

) = %D (
*

,.

{+4

&

!"#

www.gateforum.com

9
9

,
!

-)

?0

! =*

+*

0
"5%
6

)
!$#

?0

!, 4 !& 4 ! 4 !+
!"# 34 ,

"

+4 .

"5%

?0
)

9
)

! # 34 .

.0
9
!%# +4 2

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 6 of 19

ECTest ID: 00

www.gateforum.com

,3

.0
H

J
#

? '

'

&

F
.0

'

F+
?

; )

"
+4

9
*

!"# +4 ,4 .

!$# +4 ,4 .4 2

! # +4 4 &4 ,4 .

!%# +4 4 &4 ,4 .4 2

,:

))

;8 ;

;% ;

6)

$ ?

;84 ;%

$
? 9

( $
9

? 9
C
? 9

6)
? 9

)
7 '

,
))

"%%

&4

&

7 '

.4

,4

&

,D

&

( $

34

24

"%%
?

)
*

G +

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 7 of 19

ECTest ID: 00
!"# :

www.gateforum.com

!$# <

,<

! #

!%# .

- -)

?
<&,

K& , D G 2

-)

D0

D
!"# 34

!$# 24 :

,1

a b d e c f g,

)
!$#

+ .)

>

4 4 4 4 4 4 ,

4
9

!"# % L?
!$#

!%#

: "

!"# <4 4 4 4 4 4 +

! #

5
! #

!"#

(,

!%# 4 2

d b e a f c g

.+

! # ,4 &

4 ,4 <4 +
)9
!$#

4 <4 +4 4 4 4 ,

!%#

4 +4 <4 4 4 4 ,

)4
94

)
I

-> 4
)94

)
-

- .

(
/9

! #

%8(

!%#

$8(

.&

int f(int n)
{static int r = 0;
if (n <= 0) return 1;
if (n > 3)
{r = n;
return f(n-2)+2;
}
return f(n-1)+r;
}

(2)
!"# 2

!$# :

! # 1

!%# <

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 8 of 19

ECTest ID: 00
.,

"
'

'
)

!"# ,
..

www.gateforum.com

; ' F. 4

F +4

!$# .

! # 2

!%# 3

-0

int gcd(n,m)
{
if (n%m ==0) return m;
n = n%m;
return gcd(m,n);
}
=

!"# (

&

!$# (

! # (

&

&

!%#

( )

- .

.2

int DoSomething (int n) {


if (n <= 2)
return 1;
else
return (DoSomething (floor(sqrt(n))) + n);
}
!"#

( )

.3

&

!$# (

&

! # (

&

!%# (

&

&

struct CellNode {
struct CellNOde *leftChild;
int element;
struct CellNode *rightChild;
};
int GetValue (struct CellNode *ptr) {
int value = 0;
if (ptr != NULL)
{
if ((ptr->leftChild == NULL) &&
(ptr->rightChild == NULL))
value = 1;
else
value = value + GetValue(ptr->leftChild)
All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 9 of 19

ECTest ID: 00

www.gateforum.com

+ GetValue(ptr->rightChild);
}
return(value);
}
9/ M

)
!"#
!$#
! #
!%#
.:

2
)

( ))

4
!"# (

&

!$# (

&

&

! # (

.<

!%# (

L
!"# 8

!$# 8

4
9

)
)

! #

&

!%# 5
.1

'
) '

8"'(

!"#

!$# ;

2+

! #

!%#

"

)
9

!"# "

&

!$# "

2 &

! # "

&

)
)

!%# 5

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 10 of 19

ECTest ID: 00

www.gateforum.com

int IsPrime(n)
{
int i,n;
for(i=2;i<=sqrt(n);i++)
if(n%i == 0)
{printf(Not Prime\n); return 0;}
return 1;
}
'

( )

!"# $

( ) = 3(

! # $

( ) = 3( )

$
$

( ) = (

( ) = (

!$# $

( ) = 3(

9
!

( ) = ( )

= {!4 4 ! } 4

}4

!%# 5

2&
$ = { 4 "4 4 4

!!

! !
"

56 ''! #
!"#

!$#

! #

!%#

-0

2,
9

''! #

2.

'! #

!"# $

!$#

! #

!%# $

L4 &

4&

&

.6

&

9
76M -4 &

07

76M & 4 -

07

&

"%%

-0
&

-0

( $

?
All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 11 of 19

ECTest ID: 00
=

+"

&

www.gateforum.com

&
,

"

76M
?

!"# &
22

"

!$# ,
)

! # 2

!%# 3

!(

# )

)
-

"
&+

&

&2

,+

.2

)
!"# 2
23

!$#

"

&

! # .+

9 9
-

!%# 22

!8;86# )
)

)
(

!"# $

!$# $

! #

!%# $
2:

"
9

)
)

9)

C4 E

N4
9)

4
9)
)

4
9)

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 12 of 19

ECTest ID: 00

www.gateforum.com

*
C

&

&

&

,
&

&

+
&

&4

>

4 wants1

/*
P2
*/
while (true)
{
wants2 = true;
while (wants1==true);
/* Critical
Section
*/
Wants2=false;
}
/* Remainder section */

/*
P1
*/
while (true)
{
wants1 = true;
while (wants2==true);
/* Critical
Section
*/
wants1=false;
}
/* Remainder section */

! #

!$#

!%# 5
2<

&

&
!"#

wants2

false.

>

!"

!"# ;

!$# ;
! # ;

!%# ;
21

?4

;
# $% & !

; 4

-#
!

9
; #

'
'
!
; 4
! # "

? #

9
-)

((

=O

))

))

!"#
!$#

) )

! #

!%# 5

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 13 of 19

ECTest ID: 00
3+

www.gateforum.com

( '

?9

-4

)
)

!"# 5

) 9

!$# 5

) 9

! # 5

) 9

!%# 5

) 9

); 4

)
2

24

);

) 9

9#
) 9 4

9
9

!"

) 9
)

-F O

( '
"

+ 4 +&

( -)

) 9

( ) }

) 9

( )

) 9
9)

9
9

) 9

!(
+&

D8

) 9

);

) 9

FH
2J

9@F

9#

9@ " 9
!(

98

!"# +

!$# +&

! # $
!%# 5

) 9

FH
2J
#

+& )

+
+

+&

3&

!"# " 9

$ 58

!$# "

9? 9

&58

! # ")

?9

, 58

!%# " )

?9

$ 58

,+

3,
)
)
3 9
!"# 3,

# )
:
4

9
!$# 3.

? >
1
! # 3:

!
4
P 9 4
?)
!%# 3<

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 14 of 19

ECTest ID: 00

www.gateforum.com

3.
!"

( %) Q (() Q& ( %) Q& (() Q & (() Q ( %)


( %) Q& ( %) Q& (() Q & (() Q (() Q ( %)

!
!&
!"# $

!&

>

!$# !

>

!&

! # !

>

!%# $

!&

>

!&

>

32

'"5

!"#

33

>

!$#

?
&++

)
)

! #

!"# 2++

!$# &++

! # &+

!%# 2+

3:

$
!"# 3&

) )

30
-

!$# 3.

+&&

3<

!%#

&3& .&

! # 3&

+: )
?
*

K
R

+ ,

&3& .&

!%# 3.

+&.

++ ++

) 9

)
!"#

++ ++ +++

!$#

++ ++ +

! #

++ + +

!%#

++ ++ ++

31

1
) )
) 9 "

9)

' ?

"
' &

?
)

*
.
!"#

&

! #

&

5
K
-

-4>
4

&' & + &5


5

!$#

&

&' & + 5
5

!%#

&

&' &
5
&' & + 5
&5

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 15 of 19

ECTest ID: 00
:+

www.gateforum.com

7
! # (7

! # "))

! # $/

!&#

! #

!,# %

!(#

!.# 5

9
)

? 9
? 9

!2#

!"#

0 &

0 ,

( 0 2

!$#

0 .

0 &

( 0 ,

! #

0 .

0 &

( 0 2

!%#

0 &

0 .

( 0 ,

((
((

- # &

#
%

- #

;
76M
'66

"%%

&

&4

76M ! ,#4

'66

&
,G

,+++
9
+++ "

&

+
&+++

&+ +

"
)
!"#

G &

( )

&+++

!$#

)
! # &+

9
+

9
!%# &

"
9

!$#

++

4
++

&

>

:&

> !

7S ,T

"

!"#

) )

="'

"

7S ,T

&

&

S
,+++T

4 !,+++#
&

$5N

6)

76M &4 ! ,#

;5

#
%

. /0

,
)

&+ +
! #

+&

!%#

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 16 of 19

ECTest ID: 00

:,

"

www.gateforum.com

9
-

>
H
;5

)
!"#
((

++2

!$#

- # &

,&
,J
4

#
%

+&+
1.

! #

+&.

!%# +.+

"
*,

*+

:.

)
!"# "D "D "D "D

*&

!$#

+ ")

:2

! # "D

+ ")

*
!"#

##(

#&

! # ,

#
%

( ))

2#

#
%

/"/ / / /

:3

24

!%# .

3
0

4 4 4
4
4
4
& . < 3 ,& ,&

=
!"# +4 +4

+4

+4

!%# "D "D "D

8("

!$# &
%

/"/ / / /

+4

!$#

4 +4 +

4 + +4 ++ 4 +++

! #

4 +4 + 4 ++ 4 +++ 4 ++++

!%#

+4 ++4 + +4 +++4 ++ 4

::

:3
!"# ,

##(

#&

!$# & <:2


%

8/
)

-)
D

4(

#
%

{!4
9

4 ,}

! # & &2

!%#

1,:2

3 4 50

4 "}

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 17 of 19

ECTest ID: 00
!
,
,
,

www.gateforum.com

!"

!
!"

"
"!
,,

:<

9
!"#

:1

!$#

! #

:<4

!"#
##(

!$# &
#&

!%#
9

! # ,

#
%

43 0

9
))
" 2+ 2+
9
9

<+

!%# .

,&
9

3.

&

"

++= "
"

9
)9

!"# .<

!$# 2+

! # 23

!%# 21

<

9
!"#

! #

##(

#&

" )
)
)
<&

:
%

#
%

, )
9
#

!
;

!"# :
<,

9
)

!%#

&
<

4 3/0

)
*

9)

! # 1

!' # )
)

"
9
)
?
. . ./. .1. .2./.

!$# <

'
)

!$#

!%# +
9

'

!"# +

!$#

4
)

! # &

)) 9
) 9
!%# ,

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 18 of 19

ECTest ID: 00
##(

#&

( ))

#
%

+ 4 #)

<.

)
4

!"#

! +4 +#

!+4+#
!$# &&+

( ))
!24.#

4 #)

&+
+

! # &

!%# 5
!.4.#
4

! +4 +#
!"# &1
! #

"

(4#+ )
)

<2

31 4 3 0

)
)

www.gateforum.com

<

.
2

!+4+#
!$# &
!%#

&+
<

+
.
2

All rights reserved by GATE Forum Educational Services Pvt. Ltd. No part of this booklet may be reproduced or utilized in any form without the
written permission. Discuss this questions paper at www.gateforum.com.
Page 19 of 19

You might also like