C-PROGRAMMING
i-GATE
Test Ur Skills
Duration: 60min.
Maximum Marks: 50
Read the following instructions carefully.
1.
This questions paper contains 30 objective type questions.
2.
Question no 1 to 10 carry one mark each.
3.
Question no 11 to 30 carry two mark each
4.
Un attempted question carry zero marks
5.
Negative Marking: For Question no 1 to 10, 1/3rd mark will be deducted for each
wrong answer. For Question no 11 to 30, 2/3rd mark will be deducted for each wrong
answer.
Terms and Condition
1.
2.
To avail the scholarship, candidate needs to enroll before 8th Feb 2015.
After 8 Feb 2015 scholarship provided on the test will be void.
Notes: Scholarship is also available on basis of BE %.
New batches for GATE 2014-15 starting from 2 Feb 15 at 7:00 am
to 9:00 am / 5:30 pm to 7:30 pm
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 1
C-PROGRAMMING
Q.1 to Q.10 carry one mark each
1. aaa() {
printf("hi"); }
bbb(){
printf("hello"); }
ccc(){
printf("TechPreparation.com"); }
main()
{
int (*ptr[3])();
ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2]();
}
(A) TechPreparation.com
(C) hi hi TechPreparation.com
(B) hi TechPreparation.com
(D) hello TechPreparation.com
2. What will print out?
void main()
{
char *p;
p="%d\n";
p++;
p++;
printf(p-2,300);
}
(A) 300
(B) 400
(C) 500
(D) None
3.What will print out?
main()
{
char *p1=name;
char *p2;
p2=(char*)malloc(20);
memset (p2, 0, 20);
while(*p2++ = *p1++);
printf(%s\n,p2);
}
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 2
C-PROGRAMMING
(A) N
(B) name
(C) empty string.
(D) None
4. Find out the for the following :
main()
{
char X = A;
printf(%c /n%3c /n%5c/n, x, x, x);
printf(%3c/n %c\n, x, x);
}
A
(A) A
(B)
(C)
A
A
A
A
A
(D)
A
A
5. Consider the statement given below :
main()
{
char c[] = string;
printf(%*.*s\n, w,6, c);
}
What would be the minimum value of w (integer) so that no blank place gets
printed at the left hand side of the printed character string?
(A) 6
(B) 7
(C) 8
(D) 9
6. What will be printed as the result of the operation below:
#define swap(a,b) a=a+b;b=a-b;a=a-b;
void main()
{
int x=5, y=10;
swap (x,y);
printf(%d %d\n,x,y);
swap2(x,y);
printf(%d %d\n,x,y);
}
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 3
C-PROGRAMMING
int swap2(int a, int b)
{ int temp;
temp=a; b=a; a=temp;
(A) 10, 5
5, 10
(B) 10, 5
return 0; }
10, 10
(C) 10, 5
10, 5
(D) 10, 5
5, 5
7. Find out the output of the following program.
#include <stdio.h>
void modify(int a);
main()
{
int a = 2;
printf(\na =%d\t, a);
modify(a);
printf(a=%d\t,a);
}
modify(int a)
{
a*=3;
printf(a=%d\t, a);
return;
}
(A) a = 2 a = 6 a = 2
(C) a = 2 a = 2 a = 2
(B) a = 2 a = 6 a = 6
(D) a = 2 a = 2 a = 6
8. What will be output if you will compile and execute the following c code?
void main(){
char *url="c:\tc\bin\rw.c";
printf("%s",url);
}
(A)c:\tc\bin\rw.c
(B)c:/tc/bin/rw.c
(C)c: c inw.c (D) w.c in
9. What will be printed as the result of the operation below:
int x;
int modifyvalue()
{
return(x+=10); }
int changevalue(int x)
{
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 4
C-PROGRAMMING
return(x+=1);
}
void main()
{
int x=10;
x++;
changevalue(x);
x++;
modifyvalue();
printf("First output:%d\n",x);
x++;
changevalue(x);
printf("Second output:%d\n",x);
modifyvalue();
printf("Third output:%d\n",x); }
(A) 12, 13 , 13
(B) 12,12,12
(C) 13,12,13
(D) None
10. Find the output of the following program.
#include <stdio.h>
main()
{
int a, b
int v =3;
int *pv;
a = 2*(v + 5);
pv = &v;
b = 2*(*pv + 5);
printf(\n a=%d b=%d, a, b);
}
(A) a 16 b 16
(B) a 16 b 32
(C) a 16 b 8
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
(D) a 16 b 64
Page 5
C-PROGRAMMING
Q.11 to Q.30 carry one mark each
11. 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) 77
(B) 76
(C) 75
(D) 78
12. what is the value an integer value an integer can hold in an ANSI C complier?
(A) 65536
(B) 2147483647
(C) INT_MAX
(D) 1<<INT_BITS
13. Consider the following code
main()
{
int j = 8, *i = &j;
if(fork())
{
wait(0)
printf(%d,i);
}
else
*i=*i+10;
}
The result is :
(A) 10
(B) 8
(C) 18
(D) None of these.
14. Consider the following pair of mutually recursive functions:
int f(int x)
{if (x>0) return g(x) + f(x 1); return 1;}
int g(int x)
{if(x > 0) return g(x-1) + f(x-1)-1; return 1;}
What is the value of f(3)?
(A) 10
(B) 9
(C) 11
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
(D) 12
Page 6
C-PROGRAMMING
15. What will be the output of the following program?
main()
{
int i = 4, j = 2;
junk(&i, j);
printf(\n %d %d, i, j);
}
junk(int *i , int j)
{
*i * *i;
j = j*j;
}
(A) 16, 4
(B) 4, 2
(C) 16, 2
(D) 4, 4
16. What is the output of the following program
void main()
{
int i=1,j=-1;
if((printf(%d\n,i))<(printf(%d\n,j)))
printf(%d\n,i);
else
printf(%d\n,j);
}
(B) 1
(A) 1
(C) 1
(D) 0
17. What is the effect of the following recursive C function?
int strange(int x)
{
if(x<=0) return 0;
if(x%2) !=0) return x-1;
return 1+strange(x-1);
}
(A) It decreases the value of any nonzero positive integer by 1
(B) it deceases the value of any integer by 1
(C) It decreases the value of only nonzero prime number by 1
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 7
C-PROGRAMMING
(D) It decreases the value of only nonzero odd integer by 1
18. The value of j at the end of execution of following C program is :
main()
{
int j;
j = incr();
printf(%d,j);
}
int incr();
{
int i, c;
c = -2;
for(i = 0; i<4; i++)
{
c = c + i;
}
return (c);
}
(A) 10
(B) 4
(C) 8
(D) 5
19. What will be the output of the following C program?
main()
{
int slogan();
int c = 5;
c = slog an();
printf(\t %d, c); }
int slogan()
{
printf(\n C is best programming language!);
Return 0;
(A) C is the best programming language 0
(B) C is the best programming language 1
(C) Garbage value
(D) Error message by compiler
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 8
C-PROGRAMMING
20. Consider the following C program :
int fun(int *i)
{
*i += 5;
return 4;
}
void main()
{
int x = 3;
x = x + fun(&x);
}
What is the value of x after the assignment statement in main, assuming
operands are evaluated right to left.
(A) 7
(B) 8
(C) 12
21. The for loop
for(i=0;i<10;++i)
printf(%d, i & 1);
prints
(A) 0101010101
(B) 0111111111
(D) 16
(C) 0000000000
(D) 1111111111
22. What will the following code fragment do
void something(int a, int z)
{
int x, y;
x = a;
y = 0;
while( x z )
{
x x z;
y y 1;
}
}
(A) Finds GCD of a, z
remainders
(B)
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Finds
quotient
and
Page 9
C-PROGRAMMING
(C) Finds multiples of a, z
(D)
Finds LCM a, z
23. The number of tokens in the following C statement
printf(i=%d;&i=%x,i, &i); is
(A) 3
(B) 26
(C) 10
(D) 21
24. void main()
{
printf(sizeof (void *) = %d \n, sizeof( void *));
printf(sizeof (int *) = %d \n, sizeof(int *));
printf(sizeof (double *) = %d \n, sizeof(double *));
printf(sizeof(struct unknown *) = %d \n, sizeof(struct unknown *));
}
(A) 0, 2 , 4, unknown
(B) 0 2 4 4 8
(C) 2 2 2 2
(D) Error
25. Consider the following code segment :
int count = 0;
void Test()
{
int i;
for( i = 1; i <=5; i++)
count = count + 1;
}
void main ()
{
Parbegin
Test();
Test();
Print(count);
Parend;
}
The output will be,
(A) 10
(B) 20
(C) 11
(D) 15
26. The value printed by the printf statement in the following C program is
main()
{
int y, s = 2, t = 5;
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 10
C-PROGRAMMING
y = fun(s + t);
printf(%d%d%d, s, t, y);
}
int t = 8;
fun(s)
{
s++;
t++;
return (s + t);
}
(A) 2, 9, 15
(B) 2, 9, 17
(C) 3, 5, 15
(D) 2, 5, 17
27. What would be the output of the following program?
main()
{
int x, y, s = 2;
s * = 3;
y = f(s);
x = g(s);
printf(\n %d %d, s, y, x);
}
int t = 8;
f(int a)
{
a + = -5;
t -= 4;
return(a + t);
}
g(int a)
{
a = 1;
t+=a;
return (a + t);
}
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 11
C-PROGRAMMING
(A) 1, 5, 6
(B) 6, 5, 5
(C) 6, 5, 6
(D) None of these
28. What would be the output of the following program?
#define PROD(X) (X*X)
main()
{
int i = 3, j, k;
j = PROD(i++);
k = PROD(++i);
printf(\n %d %d j, k);
}
(A) 9 49
(B) 9 36
(C) 9 25
(D) None of these
29. what is the output of the following program?
void main()
{
struct student
{
sex : 15;
status:6;
};
printf(\n size of= %d,sizeof(struct student ));
}
(A) 2
(B) 1
(C) 0
(D) 3
30. void display(int x)
{
if(x!=0)
{
display(x/16);
putchar(0123456789ABCDEF[x%16]);
}
else
putchar(\n);
}
What will be o/p if the above function is called with x=1234?
(A) 1234
(B)4321
(C)4D2
(D)It will not compile
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 12
C-PROGRAMMING
BEST INDUSTRY PACKAGE BY i - GATE Mentor STUDENTS in CS
/IT
Student Place in IITc & IITs CS / IT 2013
S.NO
1
NAME
Niraj Kant Sinha
COLLEGE
IIT-k
COMPANY
EPIC(US)
PKG.
80 Lac.
Dilesh Verma
IISc-b
Gold Mansachs
15 Lac.
Rahul Pawar
IISc-b
N- Vedia
13.5 Lac.
Ayush Dubey
IISc-b
Enlightichs
12 Lac.
Akanksha Patel
IIT-b
EMC2
12 Lac.
Kritika Jain
IIT-b
Oracle Corp
12 Lac.
7.
Pratik Agrawal
IIT-g
Oracle Corp
12 Lac.
Pushpendra Sinha
IIIT-b
CISCO System
12 Lac.
Sameer Pandit
IIT-d
Oracle Corp
12 Lac.
10
Keshaw Vaishnav
IIT-c
DELL
10 Lac.
11
Keshav Dewangan
NIT-d
TCS(R&D)
8 Lac.
12
Rakesh Chandra
PSUs
CSEB
7 Lac
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 13
C-PROGRAMMING
BEST INDUSTRY ` PACKAGE BY i - GATE Mentor STUDENTS in CS /IT
Student Place in IITc & IITs CS / IT 2012
S.NO
NAME
COLLEGE
COMPANY
PKG.
1
Ankit Dixit
IISc-b
AMAZON
18 Lac.
2
Chandrhas Dewangan
IISc-b
Straindslife
15 Lac.
Paras Nath
NIIT-b
14.5 Lac.
Siddharth Jain
IIT-c
Adobe
13 Lac.
Jyoti Triyar
IIT-k
Groupon
12.5 Lac.
Bhawana Nayak
IIT-c
Citix R& D
12 Lac.
Sumit Rai
IIT-r
Oracle Corp
12Lac.
Shikha Singhal
IIIT-b
Aruba network
10 Lac.
Ajay Pajapati
IIT-k
CDOT
10 Lac.
10
Deepak kumar
PSUs
ECIL
8 Lac.
11
Mitilesh Kumar
PSUs
ECIL
8 Lac.
12
Shradha Piparia
NIT-r
Oracle
8 Lac.
In PhD Selection :
1 Achyut Mani tripathi
IIT- G
Akanksha Patel
IIT- B
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 14
C-PROGRAMMING
GATE RESULT
S.No. Name
Collage
Branch
BEST IN C.G.
Year/AIR Selection
Omprakash
BIT-D
CSE
2014
IIT-C
Aviral Srivastava
BIT-D
IT
2014
IIT-Kh
Mouly Gupta
BIT-D
CSE
2014
IIT-D
Amit Khanna
BIT-D
CSE
2014
IIT-G
UmaShankar Lahre
CIT-R
CSE
2014
IIT-Kh
Pragendra Sahu
RCET-B
CSE
2014
IIT-G
Inderjeet Singh
BIT-D
CSE
2014
NIT-S
Prabhat Kumar
BIT-D
CSE
2014
NIT-Durgap
Deepika Meshram
SSIMT
CSE
2014
NIT-W
10
Shubhangi
SSCET-B
CSE
2014
NIT-Durgap
11
Anshu vji
SSCET-B
CSE
2014
BARC
12
Surendra Pratap
BIT-D
CSE
2014
IIIT-B
13
Ashish Sharma
BIT-D
CSE
2014
IIIT-B
14
Deepshikha Benerjee
SSCET-B
CSE
2014
NIT-Durgap
15
Aprove Srivastava
BIT-D
CSE
2014
IIIT-B
16
Bhumika Mane
SSCET-B
IT
2014
IIIT-Bhun
17
Rohit Narayan
BIT-D
CSE
2014
NIT-Rou
18
Akanksha agrawal
BIT-D
CSE
2014
NIT-Patna
19
Ashita Nigam
BIT-D
CSE
2014
NIT-Durgap
20
Hulesh chandra
RCET-B
CSE
2014
NIT-S/IIIT-B
21
Vibha Gangir
BIT-D
IT
2014
BITS-M
22
Monika Jain
BIT-D
CSE
2014
NIT-Bhopal
23
Sajel Sahu
SSCET-B
CSE
2014
IIIT-Bhun
24
Supriya Sharma
BIT-D
CSE
2013
IIT-B
25
Shraddha Bhatted
BIT-D
CSE
2013
IIT-B
26
Prakash Agrawal
SSCET-B
CSE
2013
IIT-B
27
Rupesh Koshariya
SSCET-B
CSE
2013
IIT-G
28
Anjali Priyanka Tigga
BIT-D
CSE
2013
NIT-Rou
29
Akshaya Taywade
Ashoka
CSE
2013
VIT-C
30
Shilpa Sinha
SSCET-B
CSE
2013
BITS-M
31
Punit Singh
SSEC-B
CSE
2013
IIIT-B
32
Balmukund Agrawal
RCET-B
CSE
2013
IIIT-B
33
Anjali Sharma
SSIET-D
CSE
2013
IIIT-B
34
Priya Sharma
BIT-D
CSE
2013
NIT-C
35
Ankita Agrawal
CSIT-D
CSE
2013
C-DEC
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 15
C-PROGRAMMING
36
Achyut Mani Tripathi
SSCET-B
IT
2013
IIIT-D
37
Ankita Swamy
SSCET-B
CSE
2013
NIT-T
38
Aditya Mani Tripathi
SSCET-B
IT
2012
BITS-P
39
Ayush Dubey
BIT-D
CSE
2012
IISc-B
40
Rahul Pawar
BIT-D
CSE
2012
IISc-B
41
Kritika Jain
BIT-D
CSE
2012
IIT-B
42
Akanksha Patel
BIT-D
CSE
2012
IIT-B
43
Dilesh Verma
CSIT-D
CSE
2012
IISc-B
44
Niraj Kant
NIT-R
CSE
2012
IIT-K
45
Keshaw Vaishnav
CSIT-D
CSE
2012
IIT-C
46
Sameer Pandit
NIT-R
IT
2012
IIT-D
47
Pratik Agrawal
BIT-D
CSE
2012
IIT-G
48
Anshul Sharma
BIT-D
CSE
2012
IIIT-B
49
Rohit Jain
SSEC-B
CSE
2012
IIIT-D
50
Bindu BIswas
BIT-D
CSE
2012
IIIT-A
51
Pushpendra Sinha
BIT-D
CSE
2012
IIIT-B
52
Prashant Jha
CSIT-D
CSE
2012
NIT-S
53
Divya Nagrath
NIT-R
CSE
2012
IIT-R
54
Keshaw Dewangan
BIT-D
CSE
2012
NIT-D
55
Shraddha Piparia
CCET-B
CSE
2012
NIT-Rou
56
Aachal Arora
BIT-D
IT
2012
NIT-N
57
Priyank rathi
SSEC-B
CSE
2012
VJIT-B
58
Vikas Kumar
BIT-D
CSE
2012
NIT-Rou
59
Bhawana Sharma
SSCET-B
CSE
2012
NIT-N
60
Aachal Sood
SSITM-B
CSE
2012
IIIT-B
SSITM-B
CSE
2012
IISc-B
63
Sakshi Chourashia
Manoj Sharma
SSCET-B
BIT-D
IT
MCA
2012
2012
IIT-C
NIT-H
64
Salini Tawari
SSEC-B
CSE
2012
IIIT-B
65
Dipti Shukla
CIT-R
CSE
2012
IIIT-B
66
Chandrahas Dewangan
BIT-D
CSE
2011
IISc-B
67
Ankit Dixit
SSCET-B
CSE
2011
IISc-B
68
Jyoti Triyar
BIT-D
CSE
2011
IIT-K
69
Ajay Kumar
SSCET-B
CSE
2011
IIT-K
70
Siddharth Jain
NIT-R
CSE
2011
IIT-C
71
Bhawana Nayak
BIT-D
CSE
2011
IIT-C
72
Anuran Mohanty
BIT-D
CSE
2011
IIT-C
73
Deepak Kumar
BIT-D
CSE
2011
IIT-R
61
62
Pratik Nagwanshi
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 16
C-PROGRAMMING
74
Prateek Halwe
SSCET-B
IT
2011
IIT-G
75
Shikha Singhal
BIT-D
CSE
2011
IIIT-B
76
Prerna Tiwari
GEC-R
CSE
2011
IIIT-B
77
Keshaw Narayan
RIT-R
CSE
2011
NIT-D
78
Yaswant Verma
BIT-B
CSE
2011
Niiti-B
79
Prateek Barapatra
BIT-D
CSE
2010
IIT-C
80
Paras Nath
SSCET-B
IT
2010
Niiti-B
81
Nitish Chaturesh
SSCET-B
CSE
2010
IISc-B
82
Sumit Rai
SSCET-B
IT
2010
IIT-R
83
Sriniwas Rao
SSCET-B
CSE
2010
IIIT-B
84
Shweta Malwe
RECT-B
CSE
2010
ISM-D
85
Lohit Kumar
BIT-D
CSE
2010
IIIT-H
86
Preeti Tarmrakar
RCET-B
CSE
2010
ISM-D
Features:
1-Best Result in C.G.
2-Study Material
3-Question Bank(Subject Wise)
4-Test Series(Full length)
5-Test Series(Subject Wise)
6-Cover all technical and non technical topics
i-GATE, B-713, St: 22, Smriti Nagar, Durg, Bhilai, 98271-62352
Page 17