300+ [LATEST] C & Data Structures Interview Questions and Answers

Q1. What Is A Linked List?

De acuerdo con datos de la agencia nacional de vigilancia sanitaria (anvisa) se calcula que la primera necesidad de la prócereña se vende por 4.9 mil 682 pesos y la segunda por 4.3 mil 682 pesos. Priligy 60 mg Aguadas 60 tablet priligy 60 mg 60 tablet, priligy 60 mg eczane fiyatı. The recipe is a bit long, and there is also a "cheat" version that i have not tried yet.

A linked list is a set of linear elements where each element has an index or a pointer that indicates the next element. An element of a linked list is referred to as a node. A node will store data as well as a pointer/index about the next node in the set. There are different types of linked lists. For example, a circular linked list is a list where the last element of the list points to the first element of the list, forming an unbroken chain of data. A double linked list is a list in which every node stores the index of the node on either side of it.

Q2. What Are The Types Of Collision Resolution Techniques And The Methods Used In Each Of The Type?

Open addressing (closed hashing), The methods used include: Overflow block.
Closed addressing (open hashing), The methods used include: Linked list, Binary tree.

Q3. Differentiate File Structure From Storage Structure.

Basically, the key difference is the memory area that is being accessed. When dealing with the structure that resides the main memory of the computer system, this is referred to as storage structure. When dealing with an auxiliary structure, we refer to it as file structure.

 

Q4. What Is Page Thrashing?

It happens when a high level of paging activity. Thrashing is caused by under allocation of minimum number of pages required by a process, forcing it to continuously page fault. 

Q5. What Is The Difference Between Call By Value And Call By Reference?

When using Call by Value, you are sending the value of a variable as parameter to a function, whereas Call by Reference sends the address of the variable. Also, under Call by Value, the value in the parameter is not affected by whatever operation that takes place, while in the case of Call by Reference, values can be affected by the process within the function.

Q6. What Are The Methods Available In Storing Sequential Files?

  • Straight merging.
  • Natural merging.
  • Polyphase sort.
  • Distribution of Initial runs.

Q7. What Is Syntax Error?

Syntax errors are associated with mistakes in the use of a programming language. It maybe a command that was misspelled or a command that must was entered in lowercase mode but was instead entered with an upper case character. A misplaced symbol, or lack of symbol, somewhere within a line of code can also lead to syntax error.

Q8. What Is The Type Of The Algorithm Used In Solving The 8 Queens Problem?

Backtracking.

Q9. How Do You Construct An Increment Statement Or Decrement Statement In C?

There are actually two ways you can do this. One is to use the increment operator ++ and decrement operator –. For example, the statement “x++” me to increment the value of x by @Likewise, the statement “x –” me to decrement the value of x by @Another way of writing increment statements is to use the conventional + plus sign or – minus sign. In the case of “x++”, another way to write it is “x = x +1”.

Q10. What Is Spaghetti Programming?

Spaghetti programming refers to codes that tend to get tangled and overlapped throughout the program. This unstructured approach to coding is usually attributed to lack of experience on the part of the programmer. Spaghetti programing makes a program complex and analyzing the codes difficult, and so must be avoided as much as possible.

Q11. Are Linked Lists Considered Linear Or Non-linear Data Structure?

It actually depends on where you intend to apply linked lists. If you based it on storage, a linked list is considered non-linear. On the other hand, if you based it on access strategies, then a linked list is considered linear.

Q12. What Is The Modulus Operator?

The modulus operator outputs the remainder of a division. It makes use of the percentage (%) symbol. For example: 10 % 3 = 1, meaning when you divide 10 by 3, the remainder is 1.

Q13. What Are Variables And It What Way Is It Different From Constants?

Variables and constants may at first look similar in a sense that both are identifiers made up of one character or more characters (letters, numbers and a few allowable symbols). Both will also hold a particular value.  Values held by a variable can be altered throughout the program, and can be used in most operations and computations. Constants are given values at one time only, placed at the beginning of a program. This value is not altered in the program. For example, you can assigned a constant named PI and give it a value 3.1415  .  You can then use it as PI in the program, instead of having to write 3.1415 each time you need it. 

Q14. What Is A Queue?

A queue is a collection of data that follows the FIFO (First in First Out) principle. It is a type of a linear data structure. Elements in a queue are removed only from the front, while new elements are added only at the back of a queue. Imagine a queue of people in front of movie theater for tickets. People can’t skip to the front for tickets – they have to join the back of the queue. People leave the queue only after they get their tickets, from the front. This is a great example of a queue in data structures. The two operations performed on a queue are enqueue (adding data elements) and dequeue(removing data elements).
A priority queue is a queue in which every element in the queue is assigned a priority and operations are performed on it according to this priority.

Q15. List Out Few Of The Application Of Tree Data-structure?

  • The manipulation of Arithmetic expression.
  • Symbol Table construction.
  • Syntax analysis.

Q16. What Is A Null Pointer?

A null pointer is a special pointer value that is known not to point anywhere. It me that no other valid pointer, to any other variable or array cell or anything else, will ever compare equal to a null pointer.

Q17. What Is A Stack?

A stack is one form of a data structure. Data is stored in stacks using the FILO (First In Last Out) approach. At any particular instance, only the top of the stack is accessible, which me that in order to retrieve data that is stored inside the stack, those on the upper part should be extracted first. Storing data in a stack is also referred to as a PUSH, while data retrieval is referred to as a POP.

Q18. When Is A Binary Search Algorithm Best Applied?

It is best applied to search a list when the elements are already in order or sorted.
The list here is searched starting in the middle. If that middle value is not the correct one, the lower or the upper half is searched in the similar way.

Q19. What Are Multidimensional Arrays?

Multidimensional arrays make use of multiple indexes to store data. It is useful when storing data that cannot be represented using a single dimensional indexing, such as data representation in a board game, tables with data stored in more than one column.

Q20. What Are Header Files And What Are Its Uses In C Programming?

Header files are also known as library files. They contain two essential things: the definitions and prototypes of functions being used in a program. Simply put, commands that you use in C programming are actually functions that are defined from within each header files. Each header file contains a set of functions. For example: stdio.h is a header file that contains definition and prototypes of commands like printf and scanf. 

Q21. How Does Dynamic Memory Allocation Help In Managing Data?

Aside from being able to store simple structured data types, dynamic memory allocation can combine separately allocated structured blocks to form composite structures that expand and contract as needed.

Q22. What Do You Mean By Dynamic Memory Allocation? Give An Example.

The process of allocating memory at the time of execution is called dynamic memory allocation. The allocation and release of this memory space can be done with the help of some built in functions whose prototypes are found in alloc.h and stdlib.h.
Example:-
#include
#include
main()
{
int *p, n, i;
printf( “Enter the number of integers to be entered.”);
scanf(“%d”, &n);
p=(int *)malloc(n*sizeof(int));
if(p==NULL)
{
printf(“Memory not available”);
exit(1);
}
for(i=0;i{
printf(“Enter an integer”);
scanf(“%d”, p+1);
}
for(i=0;iprintf(“%d”, *(p+i));
}
return 0;
}

 

Q23. 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.

Q24. Can The Curly Brackets { } Be Used To Enclose A Single Line Of Code?

While curly brackets are mainly used to group several lines of codes, it will still work without error if you used it for a single line. Some programmers prefer this method as a way of organizing codes to make it look clearer, especially in conditional statements.

Q25. Which Data Structure Is Used To Perform Recursion?

  • The data structure used for recursion is Stack.
  • Its LIFO property helps it remembers its ‘caller’. This helps it know the data which is to be returned when the function has to return.
  • System stack is used for storing the return addresses of the function calls.

Q26. How Do You Declare A Variable That Will Hold String Values?

The char keyword can only hold 1 character value at a time. By creating an array of characters, you can store string values in it. Example: “char MyName[50]; ” declares a string variable named MyName that can hold a maximum of 50 characters.

Q27. What Is Variable Initialization And Why Is It Important?

This refers to the process wherein a variable is assigned an initial value before it is used in the program. Without initialization, a variable would have an unknown value, which can lead to unpredictable outputs when used in computations or other operations.

 

Q28. What Is A Spanning Tree?

A spanning tree is a tree associated with a network. All the nodes of the graph appear on the tree once. A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized.

Q29. Does The Minimum Spanning Tree Of A Graph Give The Shortest Distance Between Any 2 Specified Nodes?

No. The Minimal spanning tree assures that the total weight of the tree is kept at its minimum. But it doesn’t mean that the distance between any two nodes involved in the minimum-spanning tree is minimum.

Q30. Compare And Contrast Compilers From Interpreters.

Compilers and interpreters often deal with how program codes are executed. Interpreters execute program codes one line at a time, while compilers take the program as a whole and convert it into object code, before executing it. The key difference here is that in the case of interpreters, a program may encounter syntax errors in the middle of execution, and will stop from there. On the other hand, compilers check the syntax of the entire program and will only proceed to execution when no syntax errors are found.

Q31. Explain The Types Of Data Structures

There are two basic types of data structures:

  • linear.
  • nonlinear. 

Linear data structures : Linear data structures are organized in a way similar to the way computer memory is organized. Linear data structures store elements one after the other, in a linear fashion. Only one element of the data can be traversed at a time. Imagine a stack of books placed on a shelf. A book will be placed between two other books, but not three books- a book will only have a relationship to two other books at the most at one time. Linear data elements are stored in a similar way.
Non linear data structures : Non linear data structures are stored in a sequential way. The data elements in the non linear data structures may have relationships with one or more elements at the same time. Manipulating non linear data structures is more difficult than manipulating linear data structures.

Q32. Differentiate Source Codes From Object Codes

Source codes are codes that were written by the programmer. It is made up of the commands and other English-like keywords that are supposed to instruct the computer what to do. However, computers would not be able to understand source codes. Therefore, source codes are compiled using a compiler. The resulting outputs are object codes, which are in a format that can be understood by the computer processor. In C programming, source codes are saved with the file extension .C, while object codes are saved with the file extension .OBJ

Q33. Does The Minimal Spanning Tree Of A Graph Give The Shortest Distance Between Any 2 Specified Nodes?

No, it doesn’t.It assures that the total weight of the tree is kept to minimum.It doesn’t imply that the distance between any two nodes involved in the minimum-spanning tree is minimum.

Q34. Which Is The Simplest File Structure? (sequential, Indexed, Random)

Sequential is the simplest file structure.

 

Q35. List Out Few Of The Applications That Make Use Of Multilinked Structures?

  • Sparse matrix.
  • Index generation.

Q36. In Rdbms, What Is The Efficient Data Structure Used In The Internal Storage Representation?

B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes searching easier. This corresponds to the records that shall be stored in leaf nodes.

Q37. What Is The Difference Between Calloc() And Malloc() ?

A block of memory may be allocated using the function malloc. The malloc function reserves a block of memory of specified size and returns a pointer of type void. This me we can assign the base address of the block to any type of pointer.
  Syntax –     P = (cast type*)malloc(byte size);
Calloc is also a memory allocation function which is generally used to allocate memory for array and structure .malloc is used to allocate a single block of storage space, calloc allocates multiple blocks of storage, each of same size and initializes them with zero.
  Syntax –     P = (cast type*)calloc(n,array size);

Q38. What Are The Major Data Structures Used In The Following Areas ?

 RDBMS, Network data model and Hierarchical data model.

  • RDBMS = Array (i.e. Array of structures)
  • Network data model = Graph
  • Hierarchical data model = Trees

Q39. Minimum Number Of Queues Needed To Implement The Priority Queue?

Two. One queue is used for actual storing of data and another for storing priorities.

Q40. What Is C Language?

C is a programming language used to write a program. Programs are the set of instructions given by a programmer to the computer in high level language. C uses a compiler to trlate the high level program into machine code before executing any instruction.

Q41. Sorting Is Not Possible By Using Which Of The Following Methods? (insertion, Selection, Exchange, Deletion)

Sorting is not possible in Deletion. Using insertion we can perform insertion sort, using selection we can perform selection sort, using exchange we can perform the bubble sort (and other similar sorting methods). But no sorting method can be done just using deletion.

Q42. What Is Lifo?

LIFO is short for Last In First Out, and refers to how data is accessed, stored and retrieved. Using this scheme, data that was stored last , should be the one to be extracted first. This also me that in order to gain access to the first data, all the other data that was stored before this first data must first be retrieved and extracted.

Q43. What Is The Difference Between The = Symbol And == Symbol?

The = symbol is often used in mathematical operations. It is used to assign a value to a given variable. On the other hand, the == symbol, also known as “equal to” or “equivalent to”, is a relational operator that is used to compare two values.

Q44. Advantages Of A Macro Over A Function?

Actually macro and function are used for different purposes. A macro replaces its expression code physically in the code at the time of preprocessing. But in case of function the control goes to the function while executing the code. So when the code is small then it is better to use macro. But when code is large then function should be used.

Q45. Some Coders Debug Their Programs By Placing Comment Symbols On Some Codes Instead Of Deleting It. How Does This Aid In Debugging?

Placing comment symbols /* */ around a code, also referred to as “commenting out”, is a way of isolating some codes that you think maybe causing errors in the program, without deleting the code. The idea is that if the code is in fact correct, you simply remove the comment symbols and continue on. It also saves you time and effort on having to retype the codes if you have deleted it in the first place.

 

Q46. What Is Data Structure?

  • Data structure is a group of data elements grouped together under one name.
  • These data elements are called members. They can have different types and different lengths.
  • Some of them store the data of same type while others store different types of data.

Q47. 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.

Q48. Differentiate Between Push And Pop?

Pushing and popping refers to the way data is stored into and retrieved from a stack.
PUSH – Data being pushed/ added to the stack.
POP – Data being retrieved from the stack, particularly the topmost data.

Q49. What Does Static Variable Mean?

Static variable is available to a C application, throughout the life time. At the time of starting the program execution, static variables allocations takes place first. In a scenario where one variable is to be used by all the functions (which is accessed by main () function), then the variable need to be declared as static in a C program.

Q50. How Do You Override A Defined Macro?

You can use the #undef preprocessor directive to undefined (override) a previously defined macro.