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  >>  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
Implement a function that returns the 5th element from the 
end in a singly linked list of integers in one pass.
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Implement a function that returns the 5th element from the end in a singly linked list of integers in one pass.
Answer
# 1
int return_fifth_from_end()
{
    int i,j;
    struct node *p,*q;
    *p=HEAD_NODE;
    for(i=0;i<4;i++)//will make p point to the 5th element
    {
        p=p->next;
        if(p==NULL)
        {
            printf("List has less than 5 elements");
        }
    }
    q=HEAD_NODE;
    while(p!=NULL)
    {
        p=p->next;
        q=q->next;
    }
    return(q->Value);
}
 
Is This Answer Correct ?    1 Yes 1 No
Manesh Nambiar
 
  Re: Implement a function that returns the 5th element from the end in a singly linked list of integers in one pass.
Answer
# 2
int return_fifth_from_end()
{
    int i,j;
    struct node *p,*q;
    *p=HEAD_NODE;
    for(i=0;i<4;i++)//will make p point to the 5th element
    {
        p=p->next;
        if(p==NULL)
        {
            printf("List has less than 5 elements");
        }
    }
    q=HEAD_NODE;
    while(p->next!=NULL)
    {
        p=p->next;
        q=q->next;
    }
    return(q->Value);
}
 
Is This Answer Correct ?    2 Yes 0 No
Gbohrn
 
 
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
HOW TO SWAP TWO NOS IN ONE STEP? Satyam10
what is the benefit of c30  1
what are the difference between ANSI C and Let Us c and Turbo C LG-Soft1
what is the use of pointers  4
what is a function pointer and how all to declare ,define and implement it ??? Honeywell3
1.write a program to merge the arrays 2.write efficient code for extracting unique elements from a sorted list of array? Qualcomm1
which of the following go out of the loopo if expn 2 becoming false a.while(expn 1){...if(expn 2)continue;} b.while(!expn 1){if(expn 2)continue;...} c.do{..if(expn 1)continue;..}while(expn 2); d.while(!expn 2){if(expn 1)continue;..} TCS2
write a program to display the array elements in reverse order in c language  2
15.what is the disadvantage of using macros? 16.what is the self-referential structure? 17.can a union be self-referenced? 18.What is a pointer? 19.What is the Lvalue and Rvalue? 20.what is the difference between these initializations? 21.Char a[]=”string”; 22.Char *p=”literal”; 23.Does *p++ increment p, or what it points to?  2
What is function pointer and where we will use it NetApp1
44.what is the difference between strcpy() and memcpy() function? 45.what is output of the following statetment? 46.Printf(“%x”, -1<<4); ? 47.will the program compile? int i; scanf(“%d”,i); printf(“%d”,i); 48.write a string copy function routine? 49.swap two integer variables without using a third temporary variable? 50.how do you redirect stdout value from a program to a file? 51.write a program that finds the factorial of a number using recursion?  3
print the following using nested for loop. 5 4 3 2 1 1 2 3 4 3 2 1 1 2 1 2 1 1 2 3 4 3 2 1 1 2 3 4 5  4
We can draw a box in cprogram by using only one printf();& without using graphic.h header file? NIIT2
The differences between Windows XP and Windows Visa HCL6
Find Error if any in below code, Justify ur answer: struct xx { int a; struct yy { char c; struct xx* p; } struct yy* q; } NDS2
int a=1,b=2,c=3; printf("%d,%d",a,b,c); What is the output? Verifone11
void main() { int i=5; printf("%d",i+++++i); } ME12
What are the commands should be given before weiting C Program i.e, Cd.. like Infonet2
program to get the remainder and quotant of given two numbers with out using % and / operators? IBM4
what is the difference between normal variables and pointer variables.............. Satyam4
 
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