SUBEX SYSTEMS PAPER - 25 MAR 2008
Hi Chetanaites
They have 5 rounds:
1) Written test
2) 3 technical interviews
2) 1 HR interview.
Written test: consists of C and C++ qns..
Two sections:
1. Objective (20 qns: 30 minutes)
2. Programming(2 qns, answer any 1, 30 mins)
Some of the objective qns are...
1. enum sample{x,y=2,z,a=60,b}
........
........ printf("%d",b);
opt: a. 0 b. 53 c.61 d.3
2. How many time the following code will print "Hello"
void main()
{
printf ("Hello");
main();
}
3. char str[]="Hello";
char *p;
char str2[]="Abc";
p=str;
p=str2;
printf("p=%s");
Some of the programming qns:
1. Find the occurrance of the following "C" keywords in a given text file.
i. int
ii. char
iii. return
Find the occurrance of each keyword seperately and also find the sum of all occurrances.
It following code will work but may not be an efficient one.
ans:
#include
#include
#include
#include
void main(int argc,char *argv[])
{
FILE *fp;
char s1[]="int ",s2[]="char ",s3[]="return ",ch;
int i,j,k,l,cnt1,cnt2,cnt3;
int l1,l2,l3;
cnt1=j=k=l=cnt2=cnt3=0;
clrscr();
if(argc!=2)
{http://www.ChetanaS.org
printf ("Invalid Arguments\n");
exit(0);
}
fp=fopen(argv[1],"r");
if(fp==NULL)
{
printf("File '%s' Cannot open\n",argv[1]);
exit(0);
}
l1=strlen(s1);
l2=strlen(s2);
l3=strlen(s3);
for(;((ch=fgetc(fp))!=EOF);)
{
if(ch!=s1[j] && ch!=s2[k] && ch!=s3[l])
{ j=k=l=0;
continue;
}
else
{
if(ch==s1[j])
j++;
else if(ch==s2[k])
k++;
else if(ch==s3[l])
l++;
}
if(l1==j)
{
cnt1++;
j=0;
}
else if(l2==k)
{
cnt2++;
k=0;
}
else if(l3==l)
{
cnt3++;
l=0;
}
}
printf ("\n\nOccurrance of 'int'=%d",cnt1);
printf ("\n\nOccurrance of 'char'=%d",cnt2);
printf ("\n\nOccurrance of 'return'=%d",cnt3);
printf ("\nTotal : %d",(cnt1+cnt2+cnt3));
fclose(fp);
getch();
}
2. Program to compare two strings and return 0 if they are equal else return -1.
3. Write a function for eliminating the duplicate elements in an array.
Author: Ramu
(Paper Submitted By : Priya)