Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: 2 Questions from ets sample '99

  1. #1
    An Urch Guru Pundit Swami Sage
    Join Date
    Oct 2003
    Location
    Albania
    Posts
    534
    Rep Power
    12


    Good post? Yes | No
    13. Suppose one wishes to be certain that after execution of the statement

    Code:
    if a > b then
       x := a
    the value of x will equal the value of a.
    Of the following, which is the weakest (least restrictive) condition that must necessarily hold before execution of that statement?

    Code:
    A. (x = a)  or (a > b)
    B. (x = a) and (a > b)
    C. a > b
    D. x > b
    E. x = a
    29.
    Code:
     S -> A0B
     A -> The GRE Big Book|0
     B -> AA|1
    What is the number of terminal strings of length 5 generated by the context-free grammar shown above?

    (A) 4
    (B) 5
    (C) 6
    (D) 7
    (E) 8

    I did solve this problems to my best, but no match with ETS's answer keys

    AlbaLed

  2. #2
    Within my grasp!
    Join Date
    Oct 2003
    Location
    Turkey
    Posts
    191
    Rep Power
    10


    Good post? Yes | No
    13.
    Certainly a > b must hold, oth. you wont enter the if.

    weakest (least restrictive) condition among the choices thus
    with (x = a) or (a > b) you enter the if.
    Don't mind why x = a, or x = sth else, or sth else = sth else.
    The important thing here is (a > b) and any stupid thing ORed with it.

    29.
    I hate those questions by the way. You will try one by one and hope
    you will not miss anything.

  3. #3
    An Urch Guru Pundit Swami Sage
    Join Date
    Oct 2003
    Location
    Albania
    Posts
    534
    Rep Power
    12


    Good post? Yes | No
    So you're saying answer is B ?

    If that is the case, I think that is a strong condition because if either of the clauses is true, then after the execution x is definitely a.

    Did you check choice D, by any chance? Is that a strong condition?

    Thanks
    AlbaLed

  4. #4
    Within my grasp!
    Join Date
    Oct 2003
    Location
    Turkey
    Posts
    191
    Rep Power
    10


    Good post? Yes | No
    No I say the answer is a
    A. (x = a) or (a > b)

    What I understand from weakest(least restrictive) condition is that it should contain something that must necessarily hold, in this case (a>b)
    and something that does not affect the execution (in this case (or (x=a).

    Strong condition is something that should hold always, in this case (x > a) is a strong condition.



  5. #5
    An Urch Guru Pundit Swami Sage
    Join Date
    Oct 2003
    Location
    Albania
    Posts
    534
    Rep Power
    12


    Good post? Yes | No
    Sorry I meant A,

    My main concern is about D, because it only contains a condition which does not affect the execution at all. I think A is a weak condition, but D is weaker. What do you think maked D a stonger conditiona than A?

    AlbaLed

  6. #6
    An Urch Guru Pundit Swami Sage
    Join Date
    Oct 2003
    Location
    Albania
    Posts
    534
    Rep Power
    12


    Good post? Yes | No
    Here is a usefull definition

    "The weakest precondition is the least restrictive precondition that will guarantee the validity of the associated postcondition (x=a in our case)"
    I had forgotten it

    So D in this case is not even a valid precondition


    AlbaLed

  7. #7
    Within my grasp!
    Join Date
    Oct 2003
    Location
    Turkey
    Posts
    191
    Rep Power
    10


    Good post? Yes | No
    Sorry this time, I misspelled it.

    Strong condition is something that should hold always, in this case (x > a) is a strong condition.
    IT should be a > b by the way.


    Yes you have given the answer yourself. A is the weakest, C is the strongest, B, D, E does not satisfy the conditions.

    Also you should check out the exact wording in the question

    Suppose one wishes to be certain that after execution of the statement


    if a > b then
    x := a


    the value of x will equal the value of a.
    Of the following, which is the weakest (least restrictive) condition that must necessarily hold before execution of that statement?

    B, D, E are out of the table right away.

  8. #8
    An Urch Guru Pundit Swami Sage
    Join Date
    Oct 2003
    Location
    Albania
    Posts
    534
    Rep Power
    12


    Good post? Yes | No
    Thanx

    here is a useful link that describes semantics
    http://clem.mscd.edu/~gordona/csi3210/lects/lect19.html

    Can you try 29 and see what you get?

    AlbaLed

  9. #9
    Within my grasp!
    Join Date
    Jun 2003
    Location
    Israel
    Posts
    111
    Rep Power
    10


    Good post? Yes | No
    29. (B)

    Since S -> A0B
    to get a string of length 5, the possibilities are:
    Code:
     len(A) | len(B)
    --------|-------
      4     | 0         impossible
      3     | 1         two: 00101 10001 *
      2     | 2         one possiblity: 11000
      1     | 3         two: 00011 00110 **
      0     | 4         impossible
    
    * (3,1):  S->A0B->BB0B->AAB0B->00101
              S->A0B->BB0B->BAA0B->10001
    
    ** (3,2): S->A0B->A0AA->A0BBA->00110
              S->A0B->A0AA->A0ABB->00011

  10. #10
    Eager!
    Join Date
    Oct 2003
    Posts
    45
    Rep Power
    10


    Good post? Yes | No
    I am not sure if B and E are off the table, since they would also gurantee the post-condition. Also not sure if "strongest" could be defined as a>b, it could be x=a as well. Weakest condition is the one which could cover iff (if and only if) test.

    Thanks for the link albaled.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 05-20-2010, 05:45 PM
  2. Replies: 0
    Last Post: 07-26-2008, 12:57 PM
  3. Replies: 0
    Last Post: 03-17-2006, 05:25 PM
  4. Replies: 0
    Last Post: 03-17-2006, 05:24 PM
  5. Q12 in ETS HEA CS Sample Questions
    By murboy in forum GRE Computer Science
    Replies: 2
    Last Post: 11-20-2003, 07:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

SEO by vBSEO ©2010, Crawlability, Inc.