knoowgle logo
HOME
TOPICS
CONTRIBUTE ADVERTISE
T & C
KNOOWGLE

C-Programing Sample test 8

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

    int f1()
    {
            int i=100;
            while (i>1) i=i/3;
            if (i) return true; else return false;
    }

    int main()
    {
            if ( f1() || true ) 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=64;
            do i=i/2; while (i>2);
            if (i/2) 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()
    {
            double a=1.0, b=2.0, c=3.0;
            a=(-a+b)/c;
            if (a>1/b) return true; else return false;
    }

    int main()
    {
            if ( f1() && true ) 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 s[77]="ABXDEFG";
            if (s[7]=='\0') return true; else return
    false;
    }

    int main()
    {
            if ( ! f1() ) 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()
    {
            int i=1, j=10, k;
            k=i; i=j; j=k;
            if (j>i) return true; else return false;
    }

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