2010年12月8日 星期三

NVIDIA Interview Question (2)

1. How do you give comments about the following code:
   int f (int x)
   {
        return x = << 3 / 2;   // it's amazing that  divide has higher priority than shifting!
    }

2. If there is rubric cube has 100x100x100 small cubes, how many of them are never touch by player?

3. Will the following code has infinite loop?
    void f( )
    {
          double x = 0;
          double y;
          do{
                y = x ++;
          }while( y -x ! = 0)  // think about 0 and 0.0, and also the floating precision issue
    }

1 則留言: