| Back to Questions Page |
| |
| Question |
What is the main difference between STRUCTURE and UNION? |
Rank |
Answer Posted By |
|
Question Submitted By :: Mariaalex007 |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | All the members of the structure can be accessed at
once,where as in an union only one member can be used at a time.
Another important difference is in the size allocated to a
structure and an union.
for eg:
struct example
{
int integer;
float floating_numbers;
}
the size allocated here is sizeof(int)+sizeof(float);
where as in an union
union example
{
int integer;
float floating_numbers;
}
size allocated is the size of the highest member.
so size is=sizeof(float);  |
| Vijay Nag |
| |
| |
| Question |
how to store and retrive a set of values without using an
array |
Rank |
Answer Posted By |
|
Question Submitted By :: Kiran |
| This Interview Question Asked @ Maximus |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | please post the answer...
thanks and regards
kiran.y  |
| Kiran |
| |
| |
| Answer | link list i think..  |
| Karthik |
| |
| |
|
|
| |
| Question |
How will u find whether a linked list has a loop or not? |
Rank |
Answer Posted By |
|
Question Submitted By :: Vadivel152 |
| This Interview Question Asked @ Microsoft |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | findloop(struct node *start)
{
struct node *ptr,*ptr1;
start=ptr;
while(ptr!=NULL)
{
ptr1=ptr->next;
while(ptr1!=NULL)
{
if(ptr1->link==ptr->link)
{
printf("\nLoop found at %d node",ptr->data);
exit(0);
}
ptr1=ptr1->link;
}
ptr=ptr->link;
}
printf("\nNo Loop found in list");
}  |
| S.v.prasad Reddy |
| |
| |
| Answer | BOOL findloop(struct node *start)
{
struct node *ptr,*ptr1;
ptr=start;
ptr1= start->next;
while(ptr!=NULL && ptr->next!=null && ptr1->next!=null &&
ptr1->next->next!=null)
{
if(ptr==ptr1)
return FALSE;
ptr=ptr->next;
ptr1=ptr1->next->next;
}
return TRUE;
}  |
| Sivaraj |
| |
| |
| Question |
How can u say that a given point is in a triangle?
1. with the co-ordinates of the 3 vertices specified.
2. with only the co-ordinates of the top vertex given. |
Rank |
Answer Posted By |
|
Question Submitted By :: Vadivel152 |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | solution for 1st case:
Given:(x1,y1),(x2,y2),(x3,y3),the co-ordinates of the
vertices of the triangle.
Let (xx,yy) be the pt to be located.
Find the equations of the lines {(x1,y1),(x2,y2)} and
{(x1,y1)(x3,y3)} using the formula
((y-y1)/(y2-y1))=((x-x1)/(x2-x1))
Now substitute the y value in the 2 equations got. You 'll
be getting the x limits. If the given x value lies within
the limits you have found,the given pt is within the
triangle or else it is not.
 |
| Vadivel |
| |
| |
| Question |
how to write a program to accept names and marks of 10
students from the user and display the names and markes of
only the passed students. Marks greater than or equal to
35 is considered as pass. |
Rank |
Answer Posted By |
|
Question Submitted By :: Nl |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | #include<stdio.h>
void main()
{
char names[10][20];
int a[10][2],n;
printf(":enter the number of students :");
scanf("%d",&n);
printf("enter the names and marks");
for(int i=0;i<n;i++)
{
scanf("%s",names[i]);
scanf('%d",&a[i]);
}
printf("the passed students are :\n");
for(int i=0;i<n;i++)
{
if(a[i]>=35)
{
printf("%s",names[i]);
}
}
getch();
}  |
| Vignesh1988i |
| |
| |
|
| |
|
Back to Questions Page |