GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Placement Papers  >  Honey Well  >  C

 Print  |  
Question:  Honey Well Written Test -  C Questions

Answer:

I did not attempted the C paper but still I just had a look on C and java paper.  in C most of the question were programs and their out was  asked in LINUX environment.

1)
      int main()
      {
      char *a= "Novell";
      char  *b;
      b=malloc(10*sizeof(char));
      memset(b,0,10);
      while(*b++=*a++);
      printf("%s",b);
      return 0;
      }
2) int main()
     {
     printf("Hello");
     fork();
     printf("World");
     }



March 03, 2006 05:56:18 #1
 gopi_ra   Member Since: November 2005    Total Comments: 1 

RE: Honey Well Written Test -  C Question...
 

1. output is Novell

2. output is Hello World World

because after 1st printf fork is executed .This creates the child process so child will execute 2nd printf & oncemore  by parent process.Hence world is printed twice.

     

 

Back To Question