Motionzen
☰
×
◈ Introduction
◈ WIN-IT
◈ Smartplay Technologies
◈ TATA Power
◈ Sasken Technology
◈ MREC Tech
◈ RRSTB Consultancy
◈ Methode Electronics
◈ Hyundai Mobis
◈ Dexcel Electronices
◈ Data Patterns
◈ PROTECH
◈ VVDN - I
◈ VVDN - II
◈ VVDN - III
◈ UST Global - I
◈ UST Global - II
◈ UST Global - III
◈ Other Companies - I
◈ Other Companies - II
◈ Other Companies - III
Home
About
Consulting
Training
Tutorial
Interview Questions
Contact
Interview Questions
Protech - Interview Experience
Home
Company Interview Experience
◈ Introduction
◈ WIN-IT
◈ Smartplay Technologies
◈ TATA Power
◈ Sasken Technology
◈ MREC Tech
◈ RRSTB Consultancy
◈ Methode Electronics
◈ Hyundai Mobis
◈ Dexcel Electronices
◈ Data Patterns
◈ PROTECH
◈ VVDN - I
◈ VVDN - II
◈ VVDN - III
◈ UST Global - I
◈ UST Global - II
◈ UST Global - III
◈ Other Companies - I
◈ Other Companies - II
◈ Other Companies - III
Interview Questions
Protech - Interview Experience
« Prev
Next »
Protech - Interview Questions and Answer
Program 1 /* wap to count no of occurrence of each words in a given sentence. write your own logic to split the sentence into words i.e don’t use any library methods to split the string input : "programming is fun programming is pleasure programming is hobby" output : programming : 3 times, is : 3times, fun : 1 time, pleasure : 1 time, hobby : 1 time */ #include
#include
main(int argc,char **argv) { int i,j,k,l,c=0; char *m,*s,*buf; m=malloc(1000); s=malloc(1000); buf=malloc(1000); printf("enter main string :\n"); gets(m); for(i=0,j=0;m[i];i++) { if(m[i]!=' ') { s[j++]=m[i]; // continue; } else { s[j]='\0'; for(k=0,l=0;m[k];k++) { if(m[k]!=' ') { buf[l++]=m[k]; //continue; } else { buf[l]='\0'; if(strcmp(buf,s)==0) c++; l=0; } } printf("%s->%d",s,c); j=0; c=0; } } } Program 2 /* C program to find rank of a matrix */ #include
/* function for exchanging two rows of a matrix */ void swap(int mat[2][3], int row1, int row2,int col) { int i,temp; for (i=0;i
#include
void enqueue(); int dequeue(void); void print(void); int count(); int n=5; struct que { int roll; struct que *nxt; }; typedef struct que qe; qe *hdpt; main() { int num,op; while(1) { printf("enter the option: \n1)enqueue\n2)dequeue\n3)print\n"); scanf("%d",&op); if(op==1) { // printf("enter the number\n"); //anf("%d",&num); enqueue(); } else if(op==2) { int d,c; c=count(); printf("c=%d\n",c); if(c!=0) { d=dequeue(); printf("d=%d\n",d); } else printf("no element in queue\n"); } else if(op==3) { print(); } else { printf("invalid option\n"); break; } } } void enqueue() { static qe *temp,*temp1; int c=0; temp=malloc(sizeof(qe)); printf("enter roll no..\n"); scanf("%d",&temp->roll); if(c
nxt=temp; hdpt=temp; temp1=temp; } else { temp->nxt=hdpt; temp1->nxt=temp; hdpt=temp; } c++; } else { printf("over flows\n"); return; } } int dequeue(void) { int i; qe *x,*temp; x=hdpt; if(x->nxt==0) { hdpt=0; i=x->roll; free(x); return i; } while(x->nxt) { temp=x; x=x->nxt; } temp->nxt=0; i=x->roll; free(x); return i; } void print(void) { qe *temp; temp=hdpt; while(1) { printf("%d\n",hdpt->roll); hdpt=hdpt->nxt; if(temp==hdpt || hdpt==0) break; } } Program 4 /* input string : "abcdefghijkl123" output string : "abdcefhgijlk123" */ #include
int i=2; char a[100]; void swap(int,int); main() { printf("enter the strings...\n"); gets(a); while(a[i]) { swap(i,i+1); i=i+4; } printf("after ...%s\n",a); } void swap(int p,int q) { char temp; if((((a[p]>=65) && a[p]<=90)) || ((a[p]>=97) && a[q]<=122)) { if((((a[q]>=65) && a[q]<=90)) || ((a[q]>=97) && a[q]<=122)) { temp=a[p]; a[p]=a[q]; a[q]=temp; } } } Program 5 /* Write a c program to store student roll number using linked list */ #include
#include
void add(void **); void print(void *); typedef struct st { int r; struct st *link; }ST; main() { int i=1; void *head=0; while(i<5) { add(&head); i++; } //nu=(struct st*)malloc(sizeof(struct st )); print(head); } void add(void **p) { void *nu; nu=(ST*)malloc(sizeof(ST)); printf("Enter the roll number\n"); scanf("%d",&(*(ST*)nu).r); if(*(struct st**)p==0) { (*(ST*)nu).link=(ST*)*p; *(ST**)p=nu; } else { void *t; t=*(ST**)p; while((*(ST*)t).link) t=(*(ST*)t).link; (*(ST*)nu).link=(*(ST*)t).link; (*(ST*)t).link=nu; } } void print(void *t) { while(t) { printf("r=%d\n",(*(ST*)t).r); t=(*(ST*)t).link; } }
« Prev
Next »
Helpful Links
Sateeshkg Home
Interview Questions
Corporate Training
Recommended Books
Linux Consulting
Apply for Job Assistance
If you have any queries please email us at
info@motionzen.com