Question 77
77. Consider the following English sentence :
"Agra and Gwalior are both in India".
A student has written a logical sentence for the above English sentence in First-Order Logic using predicate In(x, y), which means x is in y, as follows :
In(Agra, India) ∨ In(Gwalior, India)
Which one of the following is correct with respect to the above logical sentence ?
Options:
-
(1) It is syntactically valid but does not express the meaning of the English sentence.
-
(2) It is syntactically valid and expresses the meaning of the English sentence also.
-
(3) It is syntactically invalid but expresses the meaning of the English sentence.
-
(4) It is syntactically invalid and does not express the meaning of the English sentence.
Answer : (1) It is syntactically valid but does not express the meaning of the English sentence.
Given:
Hash table has indexed from 0 to 6.
keys are 44, 45, 79, 55, 91, 18, 63
h(key)=key mod 7 ( h(key) value is in range of 0-6 inclusive)
Solution:
Table after inserting 44, 45
h(key)= key mod 7
h(44) = 44 mod 7 = 2
h(45) = 45 mod 7 = 3
44 is placed position 2 and 45 is placed at position 3.
Table after inserting 79
h(79) = 79 mod 7 = 2
but 2 is already filled by 44, linear probing is applied but 3 is also filled by 45.
To apply linear probing, we check for the next unoccupied position in the table.
So, 79 will occupy 4.
Table after inserting 55, 91
h(55) = 55 mod 7 = 6
h(91) = 91 mod 7 = 0
55 is placed position 6 and 91 is placed at position 0.
Table after inserting 18
h(18) = 18 mod 7 = 4
but 4 is occupied by 79 so, it will occupy 5.
Table after inserting 63
h(63) = 63 mod 7 = 0.
0 is also occupied so, it will occupy 1.
So, option (3) is correct.