Archive for February 18, 2007

Question 12

F(n) defines the function to recursively calculate the factorial of n. Which of the following is the correct expression to be placed in the blank h16bsp-06b.gif

If n>0, F(n) = h16bsp-06b.gif
If n=0, F(n)=1

a) F(n) x F(n-1)
b) n x F(n-1)
c) (n-1) x F(n)
d) (n-1) x F(n-2)

answer

Advertisements

Leave a Comment

Question 11

Data items whose keys are natural numbers are managed using a hash table. Hash function h(x) is defined by the following expression:
h(x) = x mode n

Here, “n” indicates the size of the table, and “x mode n” indicates the remainder of the division of x by n. Assume that there is a data item whose key is “a” and a data item whose key is “b”. Which of the constitutes a condition to cause a collision?

a) “a+b” is a multiple of “n”.
b) “a-b” is a multiple of “n”.
c) “n” is a multiple of “a+b”.
d) “n” is a multiple of “a+b”.

answer

Leave a Comment