Data Structures - Multiple Choice Questions
24 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the primary purpose of using two additional stacks to reverse the order of elements on a stack S?

  • To maintain the order of elements (correct)
  • To allow for faster retrieval of elements
  • To allow elements to be inserted in sorted order
  • To increase the stack size
  • A quick sort algorithm has a worst-case time complexity of O(n^2).

    True

    Describe how values are hashed using the division method of hashing.

    Values are hashed by dividing the key by the table size and using the remainder as the index.

    Dijkstra's algorithm is primarily used for finding the _____ path in graphs.

    <p>shortest</p> Signup and view all the answers

    Match the following sorting techniques with their key characteristics:

    <p>Quick Sort = Divides and conquers method based on pivot Merge Sort = Stable sort using dividing and merging Bubble Sort = Simple but inefficient comparison sort Heap Sort = Utilizes a binary heap data structure</p> Signup and view all the answers

    Which of the following is not a method of collision resolution in hashing?

    <p>Direct mapping</p> Signup and view all the answers

    What is an expression tree for the infix expression: ((a + b) + c * (d + e) + f) * (g + h)?

    <p>The expression tree has '*' at the root, with left subtree as '((a + b) + c * (d + e) + f)' and right as '(g + h)'.</p> Signup and view all the answers

    In an array implementation of a double ended queue, elements can only be added at one end.

    <p>False</p> Signup and view all the answers

    Which data structure may give an overflow error, even if the current number of elements is less than its size?

    <p>Stack</p> Signup and view all the answers

    A fully parenthesized infix expression requires precedence rules for evaluation.

    <p>False</p> Signup and view all the answers

    List three major applications of stack.

    <p>Function call management, Backtracking algorithms, Expression evaluation and conversion.</p> Signup and view all the answers

    The ______ of a queue is calculated by tracking the index of the first element.

    <p>front</p> Signup and view all the answers

    The number of comparisons needed in the worst case by merge sort for two sorted lists of size m and n is:

    <p>m + n - 1</p> Signup and view all the answers

    What is the primary data structure used for recursion?

    <p>Stack</p> Signup and view all the answers

    Match the following data structures with their typical applications:

    <p>Stack = Function call management Queue = Order processing systems Linked List = Dynamic memory allocation Binary Tree = Hierarchical data representation</p> Signup and view all the answers

    In an AVL tree, balancing is performed when the height difference between the left and right subtrees exceeds ______.

    <p>1</p> Signup and view all the answers

    What is the minimum number of queues needed to implement a priority queue?

    <p>23</p> Signup and view all the answers

    A linked list is considered a non-linear data structure.

    <p>False</p> Signup and view all the answers

    What is a header linked list?

    <p>A header linked list is a linked list that includes a special header node to simplify list operations.</p> Signup and view all the answers

    In C language, to implement a heterogeneous linked list, one should use a __________ pointer type.

    <p>void</p> Signup and view all the answers

    Match the following terms to their definitions:

    <p>Abstract Data Type (ADT) = A model for data types based on their behavior and operations Doubly Linked List = A linked list where each node has pointers to both next and previous nodes Sparse Matrix = A matrix predominantly composed of zero elements Garbage Collection = The process of reclaiming memory by removing unreachable objects</p> Signup and view all the answers

    What are the advantages of a doubly linked list over a singly linked list?

    <p>All of the above</p> Signup and view all the answers

    What is insertion sort and how many key comparisons does it make in its worst case?

    <p>Insertion sort is a simple sorting algorithm that builds the final sorted array one item at a time. In its worst case, it makes $O(n^2)$ key comparisons.</p> Signup and view all the answers

    The expression P: (A+B)/(C-D) can be converted to __________ and __________ notation.

    <p>prefix, postfix</p> Signup and view all the answers

    Study Notes

    Data Structures - Multiple Choice Questions

    • Memory Allocation: The operating system (OS) periodically collects free memory space to form contiguous blocks. This process is known as dynamic memory allocation.
    • Direct Search Techniques: Binary Search, Linear Search, Tree Search, and Hashing are direct search techniques.
    • Binary Tree Deletion: Nodes with two children (in a binary tree) are replaced by either their inorder predecessor or inorder successor.
    • Data Structures Model: A collection of operations defined on a mathematical model is called a data structure.
    • Graph Vertex Degree: The sum of the degree of each vertex in an undirected graph with n vertices and e edges equals 2e.
    • Full Binary Tree Nodes: A full binary tree with 2n+1 nodes contains n-1 non-leaf nodes.
    • Linear Lists: A linear list in which deletion occurs from one end (front) and insertion from the other end (rear) is called a queue.
    • Postfix Expression: The postfix form of -A/BC$DE is ABC$ED/-.
    • Full Binary Tree Leaves: A full binary tree with n leaves contains 2n-1 nodes.
    • Graph Traversal Data Structure: A queue is used for Breadth-First Traversal of a graph.
    • Hashing Collisions: The expected number of collisions when hashing n keys into a table of size m (where n < m) is less than 1.
    • Adjacency Matrix: The i,jth entry in an adjacency matrix A of graph G gives the number of paths of length K from vertex Vi to vertex Vj.

    Data Structures - Short Answer Questions

    • Data Structures Applications: Data structures are used extensively in databases, networks, hierarchical data models.
    • Array Vs Variable: An array is a collection of variables of the same data type stored in contiguous memory locations, unlike a single variable that stores a single value.
    • Abstract Data Type (ADT): A mathematical model of a user-defined type along with the set of operations that can be performed on that type.
    • Column Major Ordering: Elements in a multi-dimensional array are stored in columns first, then subsequent columns.
    • Queue as Linear: A queue is considered a linear data structure as the elements are arranged in a sequential manner, where the first element inserted is the first to be removed.
    • Postfix Expression: The postfix expression for A+B/C is A B+ C/.
    • Binary Search Tree (BST): BSTs are used for efficient searches, insertions, and deletions of data.
    • Stack Operations: Stack operations include pushing new elements onto the stack and popping elements off the stack.
    • Queue Front Calculation: The front of a queue is calculated as the index of the first element in the array that stores the queue.
    • Queue and Array Relationship: A queue is implemented using an array; elements are added to the end of the array and deleted from the front.
    • Spanning Tree: A connected, acyclic graph.
    • Hash Function Types: Hashing functions can be categorized based on the methods used to derive the key value from the input.
    • Collision Resolution Methods: Collision resolution techniques are strategies used in hashing to manage when different keys map to the same slot within the hash table.
    • Recursion Data Structure: A stack is often used to support recursion.
    • AVL Tree Balancing: AVL trees balance themselves after insertions or deletions, using rotations to ensure that the height difference between subtrees is always at most one.
    • RDBMS Data Structure: RDBMS use a variety of data structures to represent relationships, potentially using trees, graphs, or other structured forms, in the internal storage representation.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    Description

    Test your knowledge with this quiz on Data Structures covering various topics such as memory allocation, search techniques, binary tree deletion, and more. Answer multiple choice questions to see how well you understand the fundamentals of data structures in computer science.

    More Like This

    Use Quizgecko on...
    Browser
    Browser