knoowgle logo
HOME
TOPICS
CONTRIBUTE ADVERTISE
T & C
KNOOWGLE

C-Programing Sample test 6

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

    int f1()
    {
            int i=5, j=10;
            while (i) {j-=2; i--;};
            if (j/2) return true; else return false;
    }

    int main()
    {
            if ( 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 i,j;
            i=5+6+(7)/3;
            j=(5+6+7)/3;
            if (i == j) return true; else return false;
    }

    int main()
    {
            if ( f1() && false ) 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

    #define s8 "\n\"Boy\"\b\n"

    int f1()
    {
            if (strlen(s8)>10) return true; else return
    false;
    }

    int main()
    {
            if ( f1() && false ) 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()
    {
            char c;
            short int i = 3;
            i *= 0;
            c =(! i) ? 'T' : 'F';
            if (c=='T') return true; else return false;
    }

    int main()
    {
            if ( f1() > 0 ) 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()
    {
            struct dt {char b[20]; char age; double
    weight;} d[10];
            if (sizeof(d)>222) return true; else return
    false;
    }

    int main()
    {
            if ( f1() == 0 ) 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