Tutorial One


  1. Explain the concept of data abstraction [4]
  2. In the context of object-oriented programming, explain what encapsulation and data hiding are. [4]
  3. Differentiate between a class and an object. [4]
  4. How is data abstraction promoted by the usage of objects and classes ? [3]
  5. What is a constructor ? What is its purpose ? How do we declare a constructor ? [6]
  6. Write the declaration for a Fraction class, which stores a numerator and denominator and allows addition, subtraction and multiplication. [4]
  7. What is the difference between public and private members, within a class declaration ? [4]
  8. Write a function to insert an element at the head of a linear list implemented as an array (push all other elements one position to the right) [5]
  9. What is a stack ? [2]
  10. What is a queue ? [2]
  11. What is a circular queue ? Why are circular queues used ? [4]
  12. Write a function to pop an element from a stack, implemented as an array, assuming the existance of a Position variable indicating the next position to be used for storage. (do not check for errors) [3]
  13. Write a function to add an element to a circular queue, implemented as an array with a gap, assuming the existance of Head and Tail pointers. [5]
  14. In circular queues, a gap could be used in the array to differentiate between a full and empty queue. Another method is to use a counter for the current length of the queue. Discuss this method and comparatively analyse the efficiency of both techniques. [10]
  15. Use a complexity analysis to show why a queue anchored at the beginning of an array is not efficient, compared to a circular one that moves down the array. [8]
  16. How is the absolute address in a 8086 machine calculated from a segment:offset pair ? [1]
  17. If anIntegerPtr is of type (int *) and has a value of 0FB0:1234, what address is pointed to by (anIntegerPtr + 10) ? [2]
  18. What is a linked list ? [2]
  19. Give two advantages and one disadvantage of linked lists, compared to arrays [6]
  20. Write the code to Traverse a singly linked list and output its contents to the screen. Assume that each node of the linked list (of type Node) contains a string data item and a Next pointer. [4]
  21. Write the code to Delete an element from the head of a singly linked list (with the above specs). [6]
  22. Write the code to Append an element to the tail of the singly linked list. [4]
  23. Is it at all possible to create a linked list using only a Head pointer ? If so, how will this be accomplished ? [5]
  24. List one important benefit of doubly linked lists. [2]
  25. Although doubly linked lists are beneficial, they also have disadvantages. List one. [2]
  26. Compare the efficiency of insertion and deletion at particular points within a linked list with similar functions for an array. [4]
  27. Write the code to Insert an element at the head of a circular doubly linked list. [5]
  28. Write the code to Dispose of a circular doubly linked list. [5]
  29. Explain how circular doubly linked lists can be used to manipulate windows in a GUI [8]
  30. Although circular linked lists are advantageous in most contexts, most PCs contain a keyboard buffer implemented as an array within the BIOS. Why ? [4]