Results 1 to 4 of 4

Math Help - Outcome table

  1. #1
    Newbie
    Joined
    Apr 2013
    From
    glasgow
    Posts
    3

    Talking Outcome table

    Hey guys im really stuck on this question and would appreciate a bit of help.

    Give an outcome table for the following code fragment. You should show which line in the fragment determines the outcome for that row.

    CODE FRAGMENT 2
    case
    if r then case
    if q then case
    if p then x C x + 2 (A)
    else x <-- x + 1 (B)
    end-case
    else x <-- x + 2 (C)
    end-case
    else case
    if p OR q then case
    if NOT(p) then x C x + 2 (D)
    else x <-- x + 1 (E)
    end-case
    else x <-- x + 2 (F)
    end-case
    end-case
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Oct 2009
    Posts
    5,537
    Thanks
    778

    Re: Outcome table

    Quote Originally Posted by ianal09 View Post
    Give an outcome table for the following code fragment.
    The "outcome table" is not a universally accepted term in math or computer science. I assume it means the table that shows the final value of x for each combination of truth values of p, q and r. But what is the initial value of x, or do you need to express the final value in terms of the initial one? Also, is C in "x C x + 2" a synonym of <--, i.e., assignment? Are "case" and "end-case" used for grouping only? Other programming languages use "begin" and "end" (Pascal) or curly braces (C, C++, Java) for grouping, and "case" often is a separate choice operator. Finally, on this forum you can put computer code between the [code]...[/code] tags to preserve alignment.

    What exactly is your difficulty with this problem? Granted, it is tedious to follow the branching structure for each truth value of p, q and r, but this is not complicated. In fact, even computers can do it very well.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Apr 2013
    From
    glasgow
    Posts
    3

    Re: Outcome table

    im totally not sure about that question. That was given to us and no one could understand what it mean only the subject tutor i think its practically like this.
    Code:
    Give an outcome table for the following code fragment. You should show which line in the fragment determines the outcome for that row.
    
    CODE FRAGMENT 2
        case
            if  r  then case
                if q  then case
                        if  p     then     x <-- x + 2            (A)
                            else     x <-- x + 1            (B)
                              end-case
                       else    x <-- x + 2                    (C)
                end-case
            else case
                if  p OR q   then case
                            if NOT(p) then     x <-- x + 2    (D)
                                     else      x <-- x + 1    (E)
                              end-case
                            else           x <-- x + 2                (F)
            end-case
        end-case
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    Apr 2013
    From
    glasgow
    Posts
    3

    Re: Outcome table

    First of all i was given a question just like this
    Code:
    Derive a fragment of code, involving nested cases and only the elementary expressions p, q and r, equivalent to the following.
    
    CODE FRAGMENT 1
    	case
    	    if [ (p AND (q AND NOT( r AND p))) OR NOT(p OR NOT(r)) ]
    							then		x  x + 1
    							else		x  x + 2
    	end-case
    which i have answer just fine
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Same binary operation * with two different outcome:Why?
    Posted in the Advanced Algebra Forum
    Replies: 10
    Last Post: May 13th 2012, 12:35 PM
  2. Which outcome occurs first?
    Posted in the Advanced Statistics Forum
    Replies: 2
    Last Post: November 2nd 2010, 08:32 PM
  3. number of trial to obtain an outcome
    Posted in the Advanced Statistics Forum
    Replies: 0
    Last Post: November 15th 2009, 01:56 PM
  4. Probability outcome
    Posted in the Advanced Statistics Forum
    Replies: 2
    Last Post: October 28th 2009, 11:45 AM
  5. Percentage chance of each outcome
    Posted in the Statistics Forum
    Replies: 3
    Last Post: July 23rd 2007, 03:35 AM

Search Tags


/mathhelpforum @mathhelpforum