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       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
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
Write a program that find and print how many odd numbers in 
a binary tree
 Question Submitted By :: Mellic
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Write a program that find and print how many odd numbers in a binary tree
Answer
# 1
struct node
{
int data;
struct node *l;
struct node *r;
};
typedef struct node *n;
int oddnos(n root)
{
static int count;
n cur = root;
if(cur!=NULL)
{
if(cur->data%2==1)
count++;
oddnos(root->l);
oddnos(root->r);
}
return count;
}
 
Is This Answer Correct ?    5 Yes 2 No
Raghuram.A
 

 
 
 
Other C Code Interview Questions
 
  Question Asked @ Answers
 
#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }  1
main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }  1
Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all. Microsoft2
main() { if ((1||0) && (0||1)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above HCL1
What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }  1
void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }  1
main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }  1
main() { char *p="GOOD"; char a[ ]="GOOD"; printf("\n sizeof(p) = %d, sizeof(*p) = %d, strlen(p) = %d", sizeof(p), sizeof(*p), strlen(p)); printf("\n sizeof(a) = %d, strlen(a) = %d", sizeof(a), strlen(a)); }  1
main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }  1
main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above HCL1
#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }  1
main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }  1
program to Reverse a linked list Ness-Technologies4
Print an integer using only putchar. Try doing it without using extra storage.  1
How will u find whether a linked list has a loop or not? Microsoft6
main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; printf("\n%d %d %d",a,*f1,*f2); }  1
Finding a number which was log of base 2 NetApp1
How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”) HCL1
main() { int i=10,j=20; j = i, j?(i,j)?i:j:j; printf("%d %d",i,j); }  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
 
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