Beruflich Dokumente
Kultur Dokumente
Mock Campus
( 2009 Batch )
1)
(a) 10
(c) 7
(b) 8
(d) Compilation error
main()
{char *p1="Name";
char *p2;
main()
p2=(char *)malloc(20);
{char a[10]="hello";
while(*p2++=*p1++);
strcpy(a,'\0');
printf("%s\n",p2);
printf("%s",a);
}
}
(a) Name
(c) program error
Page 1
Mock Campus
( 2009 Batch )
printf("greater");
else
(a) dharmadharmahewlett-packard
(b) harmaharmaewlett-packard
(c) hewlett-packardsiemensbm
(d) Compilation error
if(i==j)
printf("equal"); }
(a) greater
(c) less
error
(b) equal
(d) Compilation
switch(i)
#define one 0
case 1: printf("%d",i);break;
#ifdef one
{ case 2:printf("%d",i);break;
printf("one is defined ");
case 3:printf("%d",i);break;
#ifndef one
}
printf("one is not defined ");
switch(i) case 4:printf("%d",i);
(a) one is defined
(b) one is not
defined
(c) empty string
(d)
Compilation error
}
(a) Compilation error
error (c) 1234
output
(b) Run-time
(d) no
char **p;
p=s;
(*ptr)++;
printf("%s",++*p);
printf("%s\n",ptr);
printf("%s",*p++);
printf("%s",++*p);
Training and Placement Office , MNNIT Allahabad
of 8
Page 2
Mock Campus
( 2009 Batch )
}
(a) Hello!
(c) To All
(b) Welcome
(d) Welcome To All
#include<stdio.h>
int bags[5]={20,5,20,3,20};
main()
void main(void)
{char s1[]="Ramco";
{int pos=5,*next();
char s2[]="Systems";
*next()=pos;
s1=s2;
printf("%d %d %d",pos,*next(),bags[0]);
printf("%s",s1);
}
}
int *next()
(a) Samco Systems
(b) Ramco
Systems
(c) Compilation error (d)
Run-time error
{int i;
for(i=0;i<5;i++)
if (bags[i]==20)
void main(void)
return(bags+i);
printf("Error!");
unsigned x=0x3;
exit(0);
switch(c&x)
(a) 5 20 5
(c) 20 3 20
(b) 20 5 20
(d) 5 20 3
case 3: printf("Hello!\t");
case 2: printf("Welcome\t");
void main(void)
default:printf("\n");
{int y,z;
int x=y=z=10;
Page 3
Mock Campus
( 2009 Batch )
int f=x;
float ans=0.0;
f *=x*y;
main()
ans=x/3.0+y/3;
printf("%d %.2f",f,ans);
int y;
y = ~0;
(a) 10000 6
(c) 1000 6.33
if(x == y)
printf("same");
else
printf("not same");
void main()
{char *s="\12345s\n";
a) same, MAXINT, -1
b) not same, MAXINT, -MAXINT
c) same , MAXUNIT, -1
d) same, MAXUNIT, MAXUNIT
printf("%d",sizeof(s));
}
(a) 5
error
(c) 7
(b) Compilation
(d) 6
{char c=-64;
void main()
int i=-32;
{float j;
j=1000*1000;
if(c>i)
printf("%f",j);
{printf("pass1,");
if(c<u)
(a). 10000
(b).
Overflow (c). Compilation Error
(d). None
printf("pass2");
else
Page 4
Mock Campus
( 2009 Batch )
printf("Fail2");
free(a);
else
printf("Fail1);
if(i<u)
printf("pass2");
else
printf("Fail2")
FILE *fp1,*fp2;
}
a) Pass1,Pass2
c) Fail1,Pass2
b) Pass1,Fail2
d) Fail1,Fail2
fp1=fopen("one","w")
fp2=fopen("one","w")
fputc('A',fp1)
fputc('B',fp2)
void main()
fclose(fp1)
{int i;
fclose(fp2)
char a[]="String";
Temp=a;
a=malloc(strlen(p) + 1);
20).
______ Minimum number of
queues needed to implement the priority
queue?
printf("(%s, %s)",a,p);
free(p);
Mock Campus
( 2009 Batch )
void x(char* a)
f(p);
{ (a[0])?x(a+1):1;
printf("%s",p);
printf("%c",*(a+0));
return 1;
(a) BYE
(c) BYEhello
(b) hello
(d) helloBYE
..;
}
Input string 'a' is assigned as AaBbCc ,
what is the output?
(a) AaBbCc
(c) BbaCAc
(b) cCbBaA
(d) bBCacA
{ int c;
while(n)
{ n&=n-1;
(a).heap
(c).quick
(b).selection
(d). insertion
c++;
}
print c;
___________________
(b) . int *p
(d). int*
void main()
{int d=5;
{ p = (char*)malloc(6);
printf("%f",d);
strcpy(p,"hello");
(a) 5.0
error (c) 5
Undefined
void main( )
(b) Compilation
(d)
{ char *p = "BYE";
Training and Placement Office , MNNIT Allahabad
of 8
Page 6
Mock Campus
( 2009 Batch )
break;}
printf("%d,",i);
_______________
}
28) In the following C program
}
int f()
a) 0,5,9,13,17
c) 12,17,22
void main()
b) 5,9,13,17
d) 16,21
{f(1);
f(1,2);
f(1,2,3);
void swap(int*,int*);
main()
int arr[8]={36,8,97,0,161,164,3,9}
printf("%d %d %d",i,j,k);
b) 2
c) 3
if(arr[i]<arr[j])
swap(&arr[i],&arr[j]);
}
Page 7
Mock Campus
( 2009 Batch )
b) 15
d) none of these
Page 8