Skip to main contentCal State San Bernardino / [CNS] / [Comp Sci Dept] / [R J Botting] >> [CSci202] >> 20
[Index] [Schedule] [Syllabi] [Text] [Labs] [Projects] [Resources] [Search] [Contact] [Grading]
Notes: [01] [02] [03] [04] [05] [06] [07] [08] [09] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]
Mon Jun 11 16:47:30 PDT 2007
Opening the PDF files on this page may require you to download Adobe Reader or an equivalent viewer (GhostScript).

Contents


    CSci202 Computer Science II, Session 20 Review


      (previous): Miscellanea [ 19.html ]

      Preparation

      Study this page, an earlier CSci202 final [ final2002.pdf ] and use the book's index, this web site [ search.php ] , and the handouts, and the lab work, and experiments on the machines, to fill in the gaps in your knowledge.

      Write down the questions, doubts, and surprises that you have on a piece of paper.

      Assigned Work Due

      Hand in your questions, doubts and surprises.

      Input -- Topics to Review

        Everything in CSci201. But not the CCC library(graphic input/output).

      1. Tracing a program with loops, function calls, etc.

        Functions

      2. Function declarations, definitions, and calls.
      3. Passing arguments by value and by reference.
      4. Passing arguments by 'const' references.
      5. Simple recursion. For example work what this outputs [ 20rec.cpp ] (answer in lab).

      6. All the labs.
      7. All the quizzes.
      8. Your last project. Hand this in again (improvements are good).
      9. Review tutorials like: [ 07tf.html ] and [ stl.review.html ]
      10. int main(int argc, argv *char[]) [ Echo.cpp ] [ puzzle.cpp ]

        UML [ uml0.html ]

      11. UML class diagrams: including generalization, association, operations, attributes.
      12. UML object diagrams: objects, name:class, attribute=values, associations/links.
      13. Drawing UML of given class & coding in C++ a UML class.

        The standard library for accessing files: fstream, ifstream, ofstream,...

      14. Stringstreams.
      15. Direct access files.
      16. The standard library containers and simpler algorithms.

        Containers and iterators.

      17. Class declarations and definitions.
      18. const arguments, variables and member functions.

        Inheritance and deriving a new class from an old one.

      19. Rules of inheritance.
      20. Virtual functions.
      21. Pure virtual functions and abstract classes.
      22. Polymorphism: predict program behavior that depends on polymorphism.
      23. Various kinds of Constructors and how to code them.
      24. Simple destructors.

        Declaring objects and declaring pointers.

      25. Pointers and addresses. [ pointers.html ]
      26. Distinguishing correct operations for pointers and for objects they point at.
      27. Using objects and calling member functions.
      28. Searching and sorting algorithms, the Big O notation,
      29. Exceptions. Write and trace. try....throe.....catch...

        Properties and uses of standard containers/data structures.

        Single and doubly linked lists in C++. Fill in blanks in code. [ linked.html ]

        Template classes and template functions. Fill in blanks in code. See previous labs and classes.

        Predicting what templated linked data does: [ pq4a.cpp ]

      Things not on the final

      1. Namespaces, union, bit operators, bit fields, enum.
      2. Function objects and using them in algorithms.
      3. The old way (14.3.1) of putting different types of objects into a container.

      Questions

        I tried to output the alpha bet and got numbers!

         		for(int i=0; i<25; i++)   cout << 'a'+i;

        The 'a'+i is an int and so cout shows a number.... cast the data into a char:

         		for(int i=0; i<25; i++)   cout << (char)('a'+i);

        Please review containers and algorithms

        [ alg.html ]

        Is -> used only for functions?

        No. It is also used to access data inside an object pointed at by a pointer.

        A common example would be:

         		this->data
        except that C++ abbreviates the above to
         		data
        !!

        How to put pointers into a queue?

        Here is an example of a pointer to a queue of pointers to ints: [ qt.cpp ]

        As a rule you should always put pointers into containers rather than the objects: this is faster, saves space, and lets objects behave correctly.

        Can you give us an example of a double linked list?

        [ dll.cpp ]

        When drawing in the UML is the word const used?

        No. Not in the standard. In the standard you use the stereotype <<query>> to indicate a C++ "const" member function, if you really need to.

        However, our Dia graphic program does use "const" instead of "<<query>>".

        More on member functions

        [ Functions%20in%20Classes in functions ]

        Say more about virtual functions and polymorphism

        [ polymorphism.html ]

        More about templates?

        [ templates.html ]

        When should we use pointers and when iterators?

        Whenever possible use an iterator to refer to places in standard containers, or in non-standard containers that define iterators.

        Use a pointer to refer to another object that is not in a container, or as an iterator to places in an array.

        What do the visibility symbols in UML mean?

        SymbolMeaning
        +public
        -private
        #protected

        Can you review the UML symbols?

        In the final you need to know and use class diagrams.

        Classes are boxes. In the boxes you can have a compartment for attributes (data) and operations (functions). Classes have three common links:

        Four Common links between classes

        Here are some examples: [ Set.png ] [ SetIterator.png ]

        My notes: [ uml0.html ]

        Composition and aggregation in UML

        [ lookup.php?search=composition ] (use only when you have a whole that has parts inside it).

        [ lookup.php?search=aggreg ] (deprecated.... use an association with an arrow not an uncolored diamond).

        What is the purpose of a union?

        The Union lets you have several meaning for one piece of storage. So, it can save space. It is most useful for getting at parts of words at the bit level. This is very useful for system programming.

        As a rule unions are not used very much any more, except in system programs.

        What are the Basics of throw and catch?

        (1) When poisoned a function can
         		throw up;
        and so terminate.

        (2) When something is thrown some part of the program should be ready to catch the result....

         		catch ( Yucc up){ clean(up); }

        Are namespaces blocks used to separate functions with many definitions?

        Close! They can also separate multiply defined variables.

        Quick review of operators

        [ lookup.php?search=operator ]

        Is there ever a really good reason to use goto?

        Official answer: NO.

        My answer: to simulate co-functions and restartable code -- a simple to use form of concurrency. [ ../cs320/ ]

        What is the most rewarding program that you've done that is still running?

        [ ../cookie.php ]

      Exercises

      Depends on your questions!

    . . . . . . . . . ( end of section CSci202 Computer Science II, Session 20 Review) <<Contents | End>>

    Lab 10 on chapter 15

    [ lab10.html ]

    Next

    The Final [ final.html ]

    Bring your final project 5 (resubmit) to the final.

    Abbreviations

  1. TBA::="To Be Announced", something I have to do.
  2. TBD::="To Be Done", something you have to do.
  3. Dia::="A free Open Source Diagramming tool for Linux, Windoze, etc. ".
  4. YAGNI::="You Ain't Gonna Need It".
  5. DRY::="Don't Repeat Yourself".

End