|
Data Structures Interview Questions and Answers
List out the areas in which data structures are applied
extensively ?
Compiler Design, Operating System, Database Management System, Statistical
analysis package, Numerical Analysis, Graphics, Artificial Intelligence,
Simulation
If you are using C language to implement the heterogeneous
linked list, what pointer type will you use?
The heterogeneous linked list contains different data types in its nodes and we
need a link, pointer to connect them. It is not possible to use ordinary
pointers for this. So we go for void pointer. Void pointer is capable of storing
pointer to any type as it is a generic pointer type.
What is the data structures used to perform recursion?
Stack. Because of its LIFO (Last In First Out) property it remembers its caller
so knows whom to return when the function has to return. Recursion makes use of
system stack for storing the return addresses of the function calls. Every
recursive function has its equivalent iterative (non-recursive) function. Even
when such equivalent iterative procedures are written, explicit stack is to be
used.
Whether Linked List is linear or Non-linear data structure?
According to Access strategies Linked list is a linear one.
According to Storage Linked List is a Non-linear one
Tell how to check whether a linked list is circular ?
Create two pointers, each set to the start of the list. Update each as follows:
while (pointer1)
{
pointer1 = pointer1->next;
pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next;
if (pointer1 == pointer2)
? ? ? ? ? ? {
print (\”circular\n\”);
}
}
What is the difference between ARRAY and STACK?
STACK follows LIFO. Thus the item that is first entered would be the last
removed.
In array the items can be entered or removed in any order. Basically each member
access is done using index. No strict order is to be followed here to remove a
particular element.
What is the difference between NULL AND VOID pointer?
NULL can be value for pointer type variables.
VOID is a type identifier which has not size.
NULL and void are not same. Example: void* ptr = NULL;
What is precision?
Precision refers the accuracy of the decimal portion of a value. Precision is
the number of digits allowed after the decimal point.
What is impact of signed numbers on the memory?
Sign of the number is the first bit of the storage allocated for that number. So
you get one bit less for storing the number. For example if you are storing an
8-bit number, without sign, the range is 0-255. If you decide to store sign you
get 7 bits for the number plus one bit for the sign. So the range is -128 to
+127.
Page Numbers :
1
2
3
4
5
6
7
Have a Question ?
post your questions here. It
will be answered as soon as possible.
Check
Structs Interview
Questions for more Structs Interview Questions with answers
Check
Object Oriented Interview
Questions for more Object Oriented Interview Questions with answers
|