Home »
Placement Papers » subex
Placement Papers »Sonata Placement Paper 2
SUBEX-Placement Paper-17 May 2004
Pattern
Sec 1: 20 tech (full c) 30 min -ve marking 0.5 marks so no guessing.
Sec 2: Programming - 30 min
The questions are not in order...
paper code- #TC 07
1) main(){
int x;
printf("\n%d",x=0,x=20,x=40);
}
ans: 0
2) question om Macro sunstitution ( very easy)
3)main(){
int a[]={1,2,5,6,9,10};
int *b=&a[4];
printf("\n%d",b[-3]);
}
ans:6
4)main(){
int x=0,y=1;
if(x=y) y= 7;
else
y=2;
value of y?
}
ans:7
5)question on switch....
case A:case B...
some code.
ans:runtime error
6)main(){
int n=39,count=0;
while( i & 1) //some condition like this
{
count++;
i>>1;
}
}
value of count?
ans:4
7)main(){
int x=128;
printf("\n%d",1+x++);
}
ans:129
8)printf(const char,...);
main(){
some code
}
ans:complier error
9)main(){
FILE *f1;
FILE *f2;
f1=fopen("myfile","w");
f2=fopen("myfile","w");
fputc('A',f1);
fputc('B',f2);
fclose(f1);
fclose(f2);
}
what does f1 n f2 conatins?
ans:check out this
10)if i/p is code friday monday sunday in commad line then
main(int argc,char *argv[]){
printf("\n%c",**++argv);
}
ans:may be f (check out not sure...)
11)#define max 10
main(){
printf("\n%d",max++);
}
ans:compiler error
12)main(){
int a[]={1,2,9,8,6,3,5,7,8,9};
int *p=a+1;
int *q=a+6;
printf("\n%d",q-p);
}
ans:5
13)main(){
int i=3;
while(i--){
int i=100;
i--;
printf("\n%d",i);
}
}
o/p?
ans: 99,99,99
(this is not infinite loop)
14)what does (*a)[10] means?
ans: a is pointer to an array of 10 inegers
15)a big program involving malloc, strlen, strcmp...
ans:runtime error
.
.
.
.
.
20)
programming - 30 min
question: Open a file "input" and print the odd number of lines first on the
screen and then
even number of lines..something like that.....
Very easy.... u can do it within 15 min
|
|