Showing posts with label logic. Show all posts
Showing posts with label logic. Show all posts

Monday, March 23, 2009

GATE 2002 CS question 1.8 (Propositional logic)

1.8 "If X then Y unless Z" is represented by which of the following formulae in propositional logic?
(a) (X ^ ¬Z) → Y (b) (X^Y)→ ¬Z (c) X → (Y^ ¬Z) (d) (X →Y) ^ ¬Z
Ok, let's first be clear what that statement means: If X then Y unless Z.
In English, A unless B means that A will be true provided B is not true.
So here, the unless means that X being true implies Y also being true, except when Z is true.
So, for Y to be true, we need both X to be true and Z to be false.
This is best expressed by (a) - it literally reads as (X AND NOT(Z)) implies Y.
So, the answer is (a) (X ^ ¬Z) → Y

Friday, December 26, 2008

GATE 2000 CS question 1.1 (Probability)

1.1. The mininum number of cards to be dealt from an arbitrarily shuffled deck of 52 cards, to guarantee that three cards are from some same suite is:
(a) 3 (b) 8 (c) 9 (d) 12

Explanation (answer at the end):

This is a standard cards problem, and the solution is quite easy. First of all, there are 4 suites in a deck of cards (usually called Spades, Clubs, Hearts and Diamonds, though several other names also have been given to them). Each suite has 13 cards in it.

We want a guarantee that three cards from the same suite come to us, we shall assume the worst case and ensure 3 cards of same suite occur even in that case.

The worst case here is that, as we pick cards, each card is of a different type. In that case, with the first 4 picks, we'd have taken one card of each suite. With the next 4 cards, we'd have 2 cards of each suite. Now, if we pick another card, whatever suite it may be, we have 2 other cards of that suite already. So, we now have 3 cards of the same suite, which was our objective!!

So, from the above, it's clear that to guarantee that three cards are from some same suite, we have to pick 9 cards from the deck.

Answer: (c)