CISP457 Practice Midterm 2

Prof. Tak Auyeung

Instructions: You may bring any material that is handwritten or printed prior to the examination to help you. You can also bring a calculator if you think it may help you. However, you can only use the calculator for numerical computations only.

You, as an individual, are expected to do your own work. This means you cannot seek, receive or otherwise acquire any assistance except clarifications from the professor during an examination. Any communication involving the contents of the subject matter or the examination is considered cheating. Do not initiate or accept such communication, or the result of your examination is automatically voided.

Each correct answer is worth one point, each wrong answer is worth -0.25 point, and each unanswered question is worth zero point.

Make sure you write down you name on the upper right corner first, otherwise I cannot give points to anonymous students!

The baseline is 10, there are 12 questions.

  1. In this flowchart, what must be true when we arrive at the ``end'' terminator?

    \includegraphics{mt22005_fc1}

    1. $x < y$
    2. $x > y$
    3. $x \le y$
    4. $x \ge y$
    5. none of the above can be guaranteed
  2. Observe the pseudocode.


    \begin{algorithmic}
\IF{$x < y$}
\STATE $x \leftarrow x + 1$
\ELSE
\STATE $x \leftarrow x \times 2$
\ENDIF
\end{algorithmic}

    If $x$ has a value of 24, and $y$ has a value of 20 before this code, what will be the new value of $x$ after this pseudocode?

    1. 24
    2. 25
    3. 48
    4. 23
    5. 12
  3. Observe the following decision table:

    $x < y$ $y < z$ op1 op2 op3
    T T X X  
    T F X   X
    F T   X  
    F F X X X

    As per our usual notation, ``T'' means true, ``F'' means false, ``X'' means the action is taken.

    Assuming a system is implemented as specified, and all of ``op1'', ``op2'' and ``op3'' are performed, what do we know about $x$, $y$ and $z$?

    1. $x < y$ and $y < z$
    2. $x \ge y$ and $y \ge z$
    3. $x < y$ and $y \ge z$
    4. $x \ge y$ and $y < z$
    5. $x \ne y$ and $y \ne z$
  4. Choose one representation of logic that is not graphical.
    1. Pseudocode
    2. Activity Diagram
    3. State Diagram
    4. Flowchart
    5. Decision Tree
  5. Assume that we are in state S2. Which trigger or triggers must have occured?

    \includegraphics[scale=0.7]{mt22005_sd1}

    1. t1
    2. t2
    3. t3
    4. t1 and t2
    5. none of the above is guarranteed
  6. To what type of construct are guard conditions associated?
    1. state in a state diagram
    2. step (state) in an activity diagram
    3. transition in a state diagram or activity diagram
    4. relationship in a class diagram
    5. generalization in a class diagram
  7. Analyze this class diagram. Given that I have 30 objects of ``Class_2'', and 23 objects of ``Class_4'', what is the minimum number of objects of ``class_3''?

    \includegraphics[scale=0.7]{mt22005_cd1}

    1. 30
    2. 23
    3. 53
    4. $30 \times 23$
    5. 1
  8. Given $n$ independent conditions, there are $2^n$ possible combinations in a decision table. What if we are given the conditions as follows: $x = y+1$ and $x < y$? How many possible combinations are there?
    1. 0
    2. 1
    3. 2
    4. 3
    5. 4
  9. Read the class diagram. If an object of ``Class_7'' is deleted, objects of what other classes must be deleted as well?

    \includegraphics[scale=0.7]{mt22005_cd2}

    1. only Class_5
    2. only Class_6
    3. only Class_8
    4. only Class_5 and Class_6
    5. Class_5, Class_6 and Class_8
  10. Which diagram type allows data flow as a construct?
    1. Activity diagram
    2. Class diagram
    3. Sequence diagram
    4. State diagram
    5. Use case diagram
  11. Which diagram type is suitable when we need to document how a passive object responses to external triggers?
    1. Activity diagram
    2. Class diagram
    3. Sequence diagram
    4. State diagram
    5. Use case diagram
  12. What is wrong with the following activity diagram?

    \includegraphics[scale=0.7]{mt22005_ad1}

    1. there is no problem with it
    2. triggers are mandatory
    3. guard conditions are mandatory for all transitions
    4. we cannot tell whether Action_State_2 will transition to Action_State_3 or Action_State_4
    5. we cannot tell whether Action_State_4 will transition to Action_State_2 or Action_State_3


Copyright © 2005-04-18 by Tak Auyeung