Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitwise Operations and not logical

I'm new to computer science and recently took a class. I'm struggling with this question which i don't quiet understand though i'm aware of bitwise operations

Question image: enter image description here

Can I have a clear explanation please ?

like image 961
f855a864 Avatar asked Dec 19 '22 12:12

f855a864


2 Answers

Answer: B

Explanation:

Use DeMorgan's Laws (https://en.wikipedia.org/wiki/De_Morgan's_laws)

NOT (A and B) = (NOT A) or (NOT B)
NOT (A or B) = (NOT A) and (NOT B)

Following this logic:

The diagram represents

NOT ( NOT (male and adult male) and NOT (female and minor female) )

NOT (male and adult male) is satisfied as long as you are NOT adult male and thus can be replaced by this. Similarly, NOT (female and minor female) can be replaced by NOT minor female

Thus:

NOT ( (NOT adult male) and (NOT minor female) )

Using DeMorgan's law, this becomes:

adult male or minor female

We can see that this matches answer B.

like image 94
Nick Meyer Avatar answered Jun 28 '23 08:06

Nick Meyer


The answer is b). For instance in the left bottom box, the adult male is not allowed. Since the result of this box is not allowed on the upper level, the opposite of the allowed must be the very solution. The same needs to be done for the right box.

a) and c) don't work, because they result in true for either of the lower boxes. d) doesn't work, because 'minor male' for instance would be allowed in both lower boxes, hence the and condition in the upper box would give true and the negation would make it false.

This is a very simple explanation that makes the point clear without using too complex algebra stuff...

like image 27
Jan Rothkegel Avatar answered Jun 28 '23 09:06

Jan Rothkegel