Study

Review of the semester ;)

  •   0%
  •  0     0     0

  • What is the first change that insertion sort would make to this sequence? “6 2 5 9”
    2 6 5 9
  • A function can have _____ inside the parenthesis
    Arguments/Parameters
  • Using a binary search why will the number 9 never be found in the following list: 11, 8, 13, 9, 7, 3
    The list is not in order
  • What is the worst case complexity of a quick sort algorithm?
    O(𝒏^𝟐 )
  • If the sequence of operations - push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop are performed on a stack, the sequence of popped out values
    2,2,1,1,2
  • What output is displayed after the following segment of code executes:
    10 an infinite number of times. top() simply copies the top element of the stack. Use push() to remove an element from the stack.
  • What is the output of the following program segment?
    10
  • Specify whether the statement below is valid or invalid.
    Invalid
  • In C++ what the following command does: delete a;
    Free memory allocated for the variable
  • The following lists represent 3 passes of a sorting algorithm. Which algorithm is being used to sort the list?
    Bubble Sort
  • The maximum comparisons needed in Binary Search on array of size 16 is:
    4
  • Given the following Banana class in C++. Create a new Banana object properly
    Banana sample("yellow");
  • When struct is used instead of the keyword class means, what will happen in the program?
    access is public by default
  • Which sorting algorithm uses a pivot point?
    Quick sort
  • A function that changes the values of an object's attributes in a Class is also known as a:
    Setter
  • The object in the image resembles which data structure
    Linked List
  • A ________ is blue print that defines certain characteristics and behavior. It is simply a representation of different types of objects.
    Class
  • What advantage does a linked list have over an array?
    A linked list is not of a fixed size
  • How many null pointers exists in a circular linked list?
    0
  • In linked list implementation of a queue, the important condition for a queue to be empty is?
    FRONT is null
  • If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed?
    ABCD
  • Which sorting algorithm splits a list of items into individual lists?
    Merge
  • We are sorting the following list in ascending order: 5 4 2 9 3 1 8 What does the list look like after ONE pass of the selection sort algorithm?
    1 4 2 9 3 5 8
  • When is Binary Search preferred over Linear Search?
    Sorted Array
  • Make the following function return the following number in the fibonacci sequence
    fibo(n-1)+fibo(n-2)