C Programming Exam
Essay Preview: C Programming Exam
Report this essay
(1)void main(){    char i;    clrscr();    for(i=120;i<=128;i++){         printf("%d ",i);    }    getch();}Output: Infinite loop(2)void main(){    int i;    clrscr();    for(i=0,i++,i<=5;i++,i<=2;i=0,i<=5,i+=3){         printf("%d ",i);    }    getch();}Output: 2(3)void main(){    int i=1;    clrscr();    for(;;){         printf("%d ",i);    }    getch();}Output: Infinite loop(4)void main(){    int i=2;    clrscr();    for(i=0;i<=3;i++){         static int i;         i=i+8;    }    printf("%d",i);    getch();}Output: 4(5)extern int j;void main(){    int i=0;    clrscr();    for(i=0;i<=2;i+=1){         int j=5;         printf("%d ",j);         j++;    }    getch();}int j=25;Output: 5 5 5(6)extern int j;void main(){    int i=0;    clrscr();    for(i=0;i<=2;i+=1){         int j=5;         printf("%d ",j);         j++;    }    getch();}int j=25;1.What will be output when you will execute following c code?#includevoid main(){    printf("%d ",sizeof(6.5));    printf("%d ",sizeof(90000)); printf("%d",sizeof(A));}Choose all that apply:(A)4 2 1[pic 1](B)8 2 1 [pic 2](C)4 4 1[pic 3](D)8 4 1[pic 4](E)8 4 2[pic 5]Explanation:By default data type of numeric constants is:6.5 :  double 90000: long int‘A’: char In C size of data type varies from compiler to compiler. In TURBO C 3.0 (16 bit compilers) size of: double is 8 byteLong int is 4 byteCharacter constant is 2 byte   (size of char data type is one byte)In TURBO C 4.5 or Linux GCC compilers (32 bit compilers) size of:double is 8 bytelong int is 8 byteCharacter constant is 2 byte   2.Consider on following declaring of enum.(i)        enum  cricket {Gambhir,Smith,Sehwag}c;(ii)      enum  cricket {Gambhir,Smith,Sehwag};(iii)    enum   {Gambhir,Smith=-5,Sehwag}c;(iv)      enum  c {Gambhir,Smith,Sehwag};Choose correct one:(A)Only (i) is correct declaration[pic 6](B)Only (i) and (ii) is correct declaration[pic 7](C)Only (i) and (iii) are correct declaration[pic 8](D)Only (i),(ii) and are correct declaration[pic 9](E)All four are correct declaration[pic 10]Explanation:Syntax of enum data type is:enum  []{    [=],    …} [,…]Note: [] : Represents optional .<>: Represents any valid c identifier3.What will be output when you will execute following c code?#includevoid main(){    signed x;    unsigned y;    x = 10 +- 10u + 10u +- 10;    y = x;    if(x==y)         printf(“%d %d”,x,y);    else if(x!=y)         printf(“%u  %u”,x,y);}Choose all that apply:(A)0 0[pic 11](B)65536 -10 [pic 12](C)0 65536 [pic 13](D)65536 0[pic 14](E)Compilation error[pic 15]

Get Your Essay

Cite this page

C Programming Exam And Default Data Type Of Numeric Constants. (June 30, 2021). Retrieved from https://www.freeessays.education/c-programming-exam-and-default-data-type-of-numeric-constants-essay/