ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Code Snippets  >>  Programming Code  >>  C Code
 
 


 

 
 C Code interview questions  C Code Interview Questions
 C++ Code interview questions  C++ Code Interview Questions
 VC++ Code interview questions  VC++ Code Interview Questions
 Java Code interview questions  Java Code Interview Questions
 Dot Net Code interview questions  Dot Net Code Interview Questions
 Visual Basic Code interview questions  Visual Basic Code Interview Questions
 Programming Code AllOther interview questions  Programming Code AllOther Interview Questions
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.
 Question Submitted By :: Vadivel152
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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.
Answer
# 1
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.
 
Is This Answer Correct ?    3 Yes 0 No
Vadivel
 

 
 
 
Other C Code Interview Questions
 
  Question Asked @ Answers
 
main() { char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]); }  1
Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])  1
main() { int i =0;j=0; if(i && j++) printf("%d..%d",i++,j); printf("%d..%d,i,j); }  1
Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable, but aac or bcd are unacceptable. Microsoft5
Given n nodes. Find the number of different structural binary trees that can be formed using the nodes. Aricent7
main() { unsigned char i=0; for(;i>=0;i++) ; printf("%d\n",i); }  1
#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); }  1
Finding a number multiplication of 8 with out using arithmetic operator NetApp8
main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }  1
void main() { static int i=i++, j=j++, k=k++; printf(“i = %d j = %d k = %d”, i, j, k); }  1
main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }  1
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it. Microsoft6
How we will connect multiple client ? (without using fork,thread) TelDNA2
1 o 1 1 0 1 0 1 0 1 1 0 1 0 1 how to design this function format in c-language ?  1
struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }  1
#include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?  2
To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. Synergy2
struct Foo { char *pName; char *pAddress; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); obj->pName = malloc(100); obj->pAddress = malloc(100); strcpy(obj->pName,"Your Name"); strcpy(obj->pAddress, "Your Address"); free(obj); printf("%s", obj->pName); printf("%s", obj->pAddress); } a. Your Name, Your Address b. Your Address, Your Address c. Your Name Your Name d. None of the above HCL1
What is the main difference between STRUCTURE and UNION?  5
What is the output for the following program main() { int arr2D[3][3]; printf("%d\n", ((arr2D==* arr2D)&&(* arr2D == arr2D[0])) ); }  1
 
For more C Code Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com