Skip to main content
Engineering LibreTexts

Assessment

  • Page ID
    50394
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Course Assessment

    Continuous Assessment

    Instructions

    Answer the following questions and be as detailed as possible.

    1. What is sequential search? What is the average number of comparisons in a sequential search?
    2. How would one sort a linked list?
    3. What is a data structure? Give three types of data structures and briefly explain each.
    4. Which data structure is used to perform recursion?
    Feedback
    1. Sequential search: Searching an element in an array, the search starts from the first element till the last element.

      The average number of comparisons in a sequential search is (N + 1) / 2 where N is the size of the array. If the element is in the 1st position, the number of comparisons will be 1 and if the element is in the last position, the number of comparisons will be N.

    1. Step 1: Compare the current node in the unsorted list with every element in the rest of the list. If the current element is greater than any other element go to step 2 otherwise go to step 3.

      Step 2: Position the element with higher value after the position of the current element. Compare the next element. Go to step 1 if an element exists, else stop the process.

      Step 3: If the list is already in sorted order, insert the current node at the end of the list. Compare the next element, if any and go to step 1 or quit.

    1. The scheme of organizing related information is known as ‘data structure’. Three types of data structure are:

      Lists: A group of similar items with connectivity to the previous or/and next data items.

      Arrays: A set of homogeneous values.

      Records: A set of fields, where each field consists of data belonging to one data type.

      Trees: A data structure where the data is organized in a hierarchical structure. This type of data structure follows the sorted order of insertion, deletion and modification of data items.

    1. The data structure used for recursion is Stack.
      • Its LIFO property helps it remember 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.

    Grading Scheme

    The marks will be awarded as shown below

    Question Scores (marks)
    1 Each correct answer award 2 marks each total mark is 6 (maximum)
    2 Each correct answer award 2 marks; maximum 6
    3 Each correct answer award 2 marks; maximum 6
    4 Each correct answer award 2 marks; maximum 2
    Total 20
    Final Examination

    Instructions

    Answer all the questions that follow below.

    1. Briefly describe:
      1. three different applications of a stack. (9 marks)
      2. the hashing technique. (8 marks)
      3. the binary search algorithm. (8 marks)
    2. Differentiate between:
      1. PUSH and POP as used in a stack. (8 marks)
      2. a stack and a Queue? (8 marks)
    3. Explain the following:
      1. the types operations of an array. (9 marks)
      2. three properties of an algorithm. (6 marks)
    4. How do you insert a new item in a binary search tree? (14 marks)
    Feedback
      • Any three among the following applications of stack are as follows:
        • Function calls.
        • Reversal of a string.
        • Checking validity of an expression containing nested parenthesis.
        • Conversion of infix expression to postfix.
      • In general, in all searching techniques, search time is dependent on the number of items. Hashing is a technique where search time is independent of the number of items or elements. In this technique a hash function is used to generate an address from a key. The hash function takes a key as input and returns the hash value of that key which is used as an address index in the array.
      • Binary search algorithm always chooses the middle of the remaining search space, discarding one half or the other, again depending on the comparison between the key value found at the estimated position and the key value sought. The remaining search space is reduced to the part before or after the estimated position.
      1. - 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.
      2. Stack – Represents the collection of elements in Last In First Out order.

        Operations includes testing null stack, finding the top element in the stack, removal of topmost element and adding elements on the top of the stack.

        Queue – Represents the collection of elements in First In First Out order. Operations include testing null queue, finding the next element, removal of elements and inserting the elements from the queue.

        Insertion of elements is at the end of the queue.

        Deletion of elements is from the beginning of the queue.

      1. Arrays are used for storing the data until the application expires in the main memory of the computer system. So that, the elements can be accessed at any time. The operations are:

        Any 3 operations

        • Adding elements
        • Sorting elements
        • Searching elements
        • Re-arranging the elements
        • Performing matrix operations
        • Pre-fix and post-fix operations
      2. Properties of an algorithm:

        Any 3 properties

        • Should be written in simple English
        • Should be unambiguous, precise and lucid
        • Should provide the correct solutions
        • Should have an end point
        • The output statements should follow input, process instructions
        • The initial statements should be of input statements
        • Should have finite number of steps
        • Every statement should be definitive
    1. Assuming that the data to be inserted is a unique value (that is, not an existing entry in the tree), check first if the tree is empty. If it’s empty, just insert the new item in the root node. If it’s not empty, refer to the new item’s key. If it’s smaller than the root’s key, insert it into the root’s left subtree, otherwise, insert it into the root’s right subtree.

    Grading Scheme

    The marks will be awarded as shown below

    Question Scores (marks)
    1 (a) Each 3 mark total mark is 9
    1 (b) Each line of explanation 2 marks; maximum 8
    1 (c) Each line of explanation 1 mark; maximum 8
    2 (a) Each line of explanation 2 marks; maximum 8
    2 (b) Each line of explanation 2 marks; maximum 8
    3 (a)

    For any operation explained, award 3 marks (maximum 9)

    For any property explained award each 2 marks (maximum 6)

    3 (b) Any 3 properties each 2 marks; maximum 6
    4 Each explanation per type 3 mark; total maximum 14 marks
    Total 70
    • Was this article helpful?