Data Structures Exam Prep
Full explanation, worked examples & memory tricks in the app
Shared by a Veda learner · Generated with Veda AI
Full explanation, worked examples & memory tricks in the app
Every question in the paper gets a full exam-length answer in the app — organised by marks, the way a topper writes it.
1. Define pointer in C 2. Define structure in C 3. Give the full form of DMA 4. Give the definition of linked list 5. Differentiate between doubly linked list and singly linked list (at least three points).
Pointer: variable storing memory address; Structure: user-defined data type; DMA: Dynamic Memory Allocation; Linked List: collection of nodes; Doubly linked list has two pointers per node, singly linked list has one.
The full exam-length answer is in the app.
Give limitation of simple queue. Explain concept of circular queue. Construct an algorithm for inserting element in simple queue.
Limitation: fixed size; Circular queue allows reuse of empty spaces; Algorithm: adjust front and rear indices circularly.
The full exam-length answer is in the app.
Draw BST for the following data: 30, 50, 29, 84, 66, 27, 19, 56. Find in-order, pre-order and post-order traversal for the same.
BST: 30 as root, 29 left, 50 right, etc.; Traversals: in-order: 19, 27, 29, 30, 50, 56, 66, 84; pre-order: 30, 29, 19, 27, 50, 66, 56, 84; post-order: 19, 27, 29, 56, 66, 84, 50, 30.
The full exam-length answer is in the app.
Define (or Explain) the following terms: 1. Primitive data structure 2. strcat() function of C 3. name any one application of stack 4. draw the figure of doubly linked list 5. out-degree of a tree 6. sorting 7. Big Oh.
Primitive data structures: basic types; strcat(): concatenates strings; Stack application: expression evaluation; Doubly linked list: node structure with two links; Out-degree: number of edges from a node; Sorting: arranging data; Big Oh: notation for algorithm complexity.
The full exam-length answer is in the app.
Write any three characteristics of an array. Explain row major and column major array.
Characteristics: fixed size, indexed access, same data type; Row major stores rows in contiguous memory, column major stores columns.
The full exam-length answer is in the app.
Justify the need of circular queue. Write an algorithm to delete an element from the queue.
Circular queue prevents wastage of space; Algorithm: adjust front index and return element.
The full exam-length answer is in the app.
Explain the process of converting general tree into binary tree. Draw binary tree for the following general tree.
Convert each node to binary; draw binary representation.
The full exam-length answer is in the app.
Construct an algorithm for quick sort. Also give the trace of quick sort for the following data: 25, 52, 37, 63, 14, 17, 8.
Algorithm: choose pivot, partition array; Trace: show steps of sorting.
The full exam-length answer is in the app.
Define hashing. Explain division method, mid square method and folding method.
Hashing: mapping data to fixed-size values; Division: key mod table size; Mid square: square key, use middle digits; Folding: sum parts of key.
The full exam-length answer is in the app.
Construct an algorithm for bubble sort. Give trace of bubble sort for following data: 37, 22, 64, 84, 58, 52, 11.
Algorithm: repeatedly swap adjacent elements; Trace: show sorted steps.
The full exam-length answer is in the app.
Construct a program in C to reverse a string without using library function.
Use a loop to swap characters from start to end until the middle is reached.
The full exam-length answer is in the app.
Write an algorithm for merge sort.
Divide array into halves, sort each half, merge sorted halves.
The full exam-length answer is in the app.
Write an algorithm for binary search method.
Compare target with middle element; if equal, return index; if less, search left half; if greater, search right half.
The full exam-length answer is in the app.
Construct an algorithm to insert a node at the first position in singly linked list.
Create new node, set its next to head, update head to new node.
The full exam-length answer is in the app.
List different operations that can be performed on string. Write an algorithm to concatenate two strings into third one.
Operations: length, comparison, concatenation; Algorithm: copy characters from both strings into third.
The full exam-length answer is in the app.
A binary tree T has 9 nodes. The in-order and pre-order traversal of tree T yields the following sequence. Find the binary tree. In-order: 5 1 3 11 6 8 4 2 7. Pre-order: 6 1 5 11 3 4 8 7 2.
Construct tree using traversal sequences.
The full exam-length answer is in the app.
Differentiate between static memory allocation and dynamic memory allocation. (Give at least 4 differences).
Static: fixed size, allocated at compile time; dynamic: variable size, allocated at runtime.
The full exam-length answer is in the app.
State the use of malloc() function. Explain it with example.
malloc(): allocates memory dynamically; Example: int* arr = (int*)malloc(size * sizeof(int));
The full exam-length answer is in the app.
Write an algorithm to insert a node in ordered singly linked list.
Traverse list, find position, insert node.
The full exam-length answer is in the app.
Identify at least three differences between stack and queue.
Stacks are LIFO, queues are FIFO; stacks allow push/pop, queues allow enqueue/dequeue; stacks use a single end, queues use both ends.
The full exam-length answer is in the app.
Convert following prefix expression to postfix expression using stack: (a/b) * (c/(d+e)-f)
(ab/cde+f-)*
The full exam-length answer is in the app.
Define following: 1. DS 2. Time complexity 3. Algorithm.
DS: data structure; Time complexity: measure of algorithm efficiency; Algorithm: step-by-step procedure for computation.
The full exam-length answer is in the app.
Define following: 1. Root node 2. Forest 3. Leaf node.
Root node: top node in a tree; Forest: collection of disjoint trees; Leaf node: node with no children.
The full exam-length answer is in the app.
Write and explain algorithm for PUSH operation of stack data structure.
Increment top index, assign value to stack[top].
The full exam-length answer is in the app.
Explain scanf() and gets() functions with example.
scanf(): reads formatted input; gets(): reads string until newline.
The full exam-length answer is in the app.
Explain different tree traversal methods.
Methods: in-order, pre-order, post-order.
The full exam-length answer is in the app.
Explain with diagram: Complete Binary Tree & Strict Binary Tree.
Complete: all levels filled except last; Strict: each node has 0 or 2 children.
The full exam-length answer is in the app.
Write a C program to find sum of two 1D arrays.
Iterate through arrays, sum corresponding elements.
The full exam-length answer is in the app.
The full Veda Bites deck, complete notes, spaced-repetition flashcards, leveled MCQs, tests and games for this kit — plus Daily Facts and the Arena, every day.