knoowgle logo
HOME
TOPICS
CONTRIBUTE ADVERTISE
T & C
KNOOWGLE

C-Programing Sample test 5

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

    int f1()
    {
            int i,j;
            for(i=0,j=0;i<321;i++)
                    if(i%111==0) j++;
            if (j==3) 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;
            double a[100]; a[0]=0.9;
            for (i=1;i<100;i++) a[i]=sqrt(a[i-1]);
            if (a[77]>a[66]) return true; else return
    false;
    }

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

    char *s_set(char *ss, int ch)
    {
            char *res=ss;
            while (*ss) *ss++=ch;
            return (res);
    }

    int f1()
    {
            char a[5]="ABCD";
            char *s;
            s=s_set(a,'E');
            if (s[1]==s[3]) 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()
    {
            if(4 * sizeof(char) == sizeof(double)) 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()
    {
            if (log10(100.0)-2>0.2) return true; else
    return false;
    }

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

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



    Click here for answers

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