Gate CS-2014-2 Question Paper With Solutions

Q. 21 Suppose n and p are unsigned int variables in a C program. We wish to set p to nC3. If n is large, which of the following statements is most likely to set p correctly?

(A) p = n * (n-1) * (n-2) / 6;

(B) p = n * (n-1) / 2 * (n-2) / 3;

(C) p = n * (n-1) / 3 * (n-2) / 2;

(D) p = n * (n-1) * (n-2) / 6.0;

Answer: (B)

Explanation:

Gate CS-2014-2 Question Paper With Solutions

Learn More:   Gate CS-2010 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here