Header Ads

Easy C Quiz - 2



8. How many times will the loop execute?
#include<stdio.h>
int main()
{
    char c = 85;
    while(c = 25)
    {
        printf("Everything must comes to an end!");
    }       
}   
ANS : Infinite

9. What is the Output of the below C-Code.?
#include<stdio.h>
int main()
{
    int a = 5 , b = 10 , c = 1;
    if (a && b > c)
    {
        printf("InfiBytes");
    }
    else
    {
        break;
    }
}
ANS : Compiler Error

10. What is the Output of the below C-Code.? 
int main()
{
    int a = -12;
    a = a >> 3;
    printf("%d", a);
}    
ANS : -2

11. What is the Output of the below C-Code for a 32 bit system.? 
#include<stdio.h> 
int main()
{
    printf("%d\t", sizeof(6.5));
    printf("%d\t", sizeof(9000));
    printf("%d\t", sizeof('A'));
}
ANS : 8   4   4

12. What is the Output of the below C-Code.?
int main()
{
    char a,b,c;
    a = 100;
    b = 100;
    c = a+b;
    printf("%d",c);
}    
ANS : -56

13. How many times will the Loop execute?
for (; ;);     
ANS : Infinite

14. What is the Output of the below C-Code.?
#include<stdio.h> 
int main()
{
    int k=1;
    printf("%d==1 is ""%s", k, k==1? "TRUE" : "FALSE" );
}    
ANS : 1 == 1 is TRUE

15. What is the Output of the below C-Code.?
#include<stdio.h> 
int main( )
{
    char a = 250;
    int expr;
    expr =  a +  !a  +  a  +  ++a;
    printf("%d", expr);
    return 0;
}  
ANS : -17

16. What is the Output of the below C-Code.?     
#include<stdio.h> 
int main()
{
    int a, b;
    a = 1, 3, 15;
    b = (2, 4, 6);
    printf("%d ", a+b);
}
ANS : 7

No comments