• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

Data structure Interview Questions Answers

Question - 21 : - How can I search for data in a linked list?

Answer - 21 : - Unfortunately, the only way to search a linked list is with a linear search, because the only way a linked list's members can be accessed is sequentially. Sometimes it is quicker to take the data from a linked list and store it in a different data structure so that searches can be more efficient.

Question - 22 : - Difference between calloc and malloc ?

Answer - 22 : - malloc: allocate n bytes calloc: allocate m times n bytes initialized to 0

Question - 23 : - What is the difference between NULL AND VOID pointer?

Answer - 23 : - 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;

Question - 24 : - If you are using C language to implement the heterogeneous linked list, what pointer type will you use?

Answer - 24 : - 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.

Question - 25 : - What is significance of  ” * ” ?

Answer - 25 : - The symbol “*” tells the computer that you are declaring a pointer. Actually it depends on context. In a statement like int *ptr; the ‘*’ tells that you are declaring a pointer. In a statement like int i = *ptr; it tells that you want to assign value pointed to by ptr to variable i. The symbol “*” is also called as Indirection Operator/ Dereferencing Operator.

Question - 26 : - What are the methods available in storing sequential files ?

Answer - 26 : - Straight merging, Natural merging,  Polyphase sort, Distribution of Initial runs.

Question - 27 : - ARRAY and STACK?

Answer - 27 : - 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.

Question - 28 : - Why do we Use a Multidimensional Array?

Answer - 28 : - A multidimensional array can be useful to organize subgroups of data within an array. In addition to organizing data stored in elements of an array, a multidimensional array can store memory addresses of data in a pointer array and an array of pointers. Multidimensional arrays are used to store information in a matrix form. e.g. a railway timetable, schedule cannot be stored as a single dimensional array. One can use a 3-D array for storing height, width and length of each room on each floor of a building.  

Question - 29 : - How is any Data Structure application is classified among files?

Answer - 29 : - A linked list application can be organized into a header file, source file and main application file. The first file is the header file that contains the definition of the NODE structure and the LinkedList class definition. The second file is a source code file containing the implementation of member functions of the LinkedList class. The last file is the application file that contains code that creates and uses the LinkedList class.

Question - 30 : - What is impact of signed numbers on the memory?

Answer - 30 : - 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.

Computer Contributors

Rajeev Katiyar
Yes Baroda

Share your email for latest updates


Our partners