Showing posts with label data structure. Show all posts
Showing posts with label data structure. Show all posts

TCS c datastructure questions

2 comments Posted by Unknown at 02:05
TCS c datastructure interview Questions questions
1)How do you write a function that can reverse a linked-list?
void reverselist(void)
{
if(head==0)
return;
if(head->next==0)
return;
if(head->next==tail)
{
head->next = 0;
tail->next = head;
}
else
{
node* pre = head;
node* cur = head->next;
node* curnext = cur->next;
head->next = 0;
cur-> next = head;

for(; curnext!=0; )
{
cur->next = pre;
pre = cur;
cur = curnext;
curnext = curnext->next;
}

curnext->next = cur;
}
}

Read More »

C important Question

0 comments Posted by Unknown at 22:04
C important Question
What are the advantages of the functions?

- Debugging is easier

- It is easier to understand the logic involved in the program

- Testing is easier

- Recursive call is possible
- Irrelevant details in the user point of view are hidden in functions
- Functions are helpful in generalizing the program
Read More »

Infosys Solved Questions

0 comments Posted by Unknown at 14:27

Infosys Solved Questions

1.What will be the output of the following code?
void main ()
{ int i = 0 , a[3] ;
a[i] = i++;
printf (“%d",a[i]) ;
}
Ans: The output for the above code would be a garbage value. In the statement a[i] = i++; the value of the variable i would get assigned first to a[i] i.e. a[0] and then the value of i would get incremented by 1. Since a[i] i.e. a[1] has not been initialized, a[i] will have a garbage value.
-------------------------------------------------------------------------------------------------
Read More »

TCS interview questions Technical-DS

0 comments Posted by Unknown at 18:53

Data Structure Interview Questions

What is a data structure? 


What does abstract data type means? 



Evaluate the following prefix expression " ++ 26 + - 1324" (Similar types can be asked) 

Convert the following infix expression to post fix notation ((a+2)*(b+4)) -1 (Similar types can be asked) 



How is it possible to insert different type of elements in stack? 



Stack can be described as a pointer. Explain. 



Write a Binary Search program 



Write programs for Bubble Sort, Quick sort 



Explain about the types of linked lists
Read More »
 

© 2011. All Rights Reserved | Interview Questions | Template by Blogger Widgets

Home | About | Top