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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Write code for finding depth of tree
 Question Submitted By :: Superhuman
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Write code for finding depth of tree
Answer
# 1
/*
 * Simple tree node representation
  */
struct node_t {
  struct node_t *left;
  struct note_t *right;
};

/*
 * Return the maximum depth of the tree given a pointer
 * to its root node.
 */
unsigned int
tree_depth (node_t *root)
{
   return (NULL == root) ? 0 :
           MAX(tree_depth(root->left, root->right)+1);
}
 
Is This Answer Correct ?    1 Yes 2 No
Crispin
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
macros and function are related in what aspect? a)recursion b)varying no of arguments c)hypochecking d)type declaration HCL8
what is the difference between. system call and library function? CDAC2
What is encapsulation?  1
which one is highest Priority in c? a)=,b)+,c)++,d)==  3
without using arithmatic operator convert an intger variable x into x+1  1
How to implement call back functions ? HP2
write a program to swap bits in a character and return the value prototype of function char fun (char a, charb flag c) where fun returns a char, char a is a the value char b is the bit to be changed and flag c is the bit value for eg: x=fun(45,7,0) since 45 is 0010 0101 and ow x should contain the value 65 (0110 0101) Bosch1
2. What is the function of ceil(X) defined in math.h do? A)It returns the value rounded down to the next lower integer B)it returns the value rounded up to the next higher integer C)the Next Higher Value D)the next lower value Accenture2
Write code for finding depth of tree Adobe1
Write a routine that prints out a 2-D array in spiral order! Lucent1
what are brk, sbrk? Oracle1
how many times of error occur in C  7
i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k); HCL6
i want explaination about the program and its stack reprasetaion fibbo(int n) { if(n==1 or n==0) return n; else return fibbo(n-1)+fibbo(n-2); } main() { fibbo(6); }  2
Which command is more efficient? *(ptr+1) or ptr[1]  3
what is the size of an integer variable?  1
what is pointer TCS1
2. Counting in Lojban, an artificial language developed over the last fourty years, is easier than in most languages The numbers from zero to nine are: 0 no 1 pa 2 re 3 ci 4 vo 5 mk 6 xa 7 ze 8 bi 9 so Larger numbers are created by gluing the digit togather. For Examle 123 is pareci Write a program that reads in a lojban string(representing a no less than or equal to 1,000,000) and output it in numbers. Nagarro2
x=2,y=6,z=6 x=y==z; printf(%d",x) HCL8
How can I find out how much memory is available? Persistent1
 
For more C 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