knoowgle logo
HOME
TOPICS
CONTRIBUTE ADVERTISE
T & C
KNOOWGLE

C-Programing Sample test 10

  1. What is the output of the Program?
  2. #define true 1
    #define false 0

    int f1()
    {
            char a[64];
            if ((&a[33] - &a[30])/4) return true; else
    return false;
    }

    int main()
    {
            if ( f1() && ! f1() ) return true;
             else return false;
    }

    (a)  true
    (b)  false
    (b)  Compile error.


  3. What is the output of the Program?
  4. #define true 1
    #define false 0

    int f1()
    {
            int v[2][3]={{1,2,3},{3,2,1}};
            if (v[0][2]>v[1][1]) return true; else return
    false;
    }

    int main()
    {
            if ( f1() ) return true;
            else return false;
    }

    (a)  true
    (b)  false
    (b)  Compile error.


  5. What is the output of the Program?
  6. #define true 1
    #define false 0

    int f1()
    {
            int i;
            int a[100];
            for (i=0; i<100; i++) a[i] = (i%2) ? 1 : 0 ;
            if (a[48]) return true; else return false;
    }

    int main()
    {
            if ( f1() == 0 ) return true;
            else return false;
    }

    (a)  true
    (b)  false
    (b)  Compile error.

  7. What is the output of the Program?
  8. #define true 1
    #define false 0

    int f1()
    {
            short he_has_a_pen = 0;
            double pen_length = 45.8;
            if (! he_has_a_pen || pen_length<40) return
    true; else return false;
    }

    int main()
    {
            if ( f1() || false ) return true;
            else return false;
    }

    (a)  true
    (b)  false
    (b)  Compile error.

  9. What is the output of the following Program?        
    #define true 1
    #define false 0

    int f1()
    {
            if (sqrt(4.0)>1.5*1.5) return true; else
    return false;
    }

    int main()
    {
            if ( f1() || false ) return true;
            else return false;
    }

    (a)  true
    (b)  false
    (b)  Compile error.




  10. Click here for answers

Google
 
Web www.knoowgle.com
Contributed by: www.knoowgle.com
Copyright 2006 knoowgle.com