Standard Input & Output

31. What is the output of the following code?

int main()
{
    int k=1;
    printf("%d == 1 is" "%s", k, k==1?"TRUE":"FALSE");
    return 0;
}\

A. k == 1 is TRUE
B. 1 == 1 is TRUE
C. 1 == 1 is FALSE
D. K == 1 is FALSE

View Answer


32. What is the output of the following code?

int main()
{
    int k=2;
    printf("%d == 1 is" "%s", k, k==1?"TRUE":"FALSE");
    return 0;
}

A. k == 1 is TRUE
B. 2 == 1 is TRUE
C. 2 == 1 is FALSE
D. K == 1 is FALSE

View Answer


33. What is the output of this program?

char *str = "char *str = %c%s%c; main(){ printf(str, 4, str, 4);}";
int main()
{
    printf(str, 4, str, 4);
    return 0;
}

A. char *str = "char *str = %c%s%c; main(){ printf(str, 4, str, 4);}"; main(){ printf(str, 4, str, 4);}
B. char *str = %c%s%c; main(){ printf(str, 4, str, 4);}
C. No output
D. Error in program

View Answer


34. What is the output of this program?

main ( )
{
     float a=4.1589;
    printf("%2.3f", a);
    return 0;
}

A. 4
B. 4.159
C. 4.2
D. 4

View Answer


35. What is the output of this program?

main ( )
{
     float a=4.1589;
    printf("%2.1f", a);
    return 0;
}

A. 4
B. 4.1
C. 4.2
D. 4

View Answer


36. What is the output of this program?

int main()
{
   printf("%c", ~('C'*-1));
   return 0;
}

A. A
B. B
C. C
D. D

View Answer


37. What is the output of this program?

int main()
{
   printf("%c", ~('W'*-1));
   return 0;
}

A. S
B. T
C. U
D. V

View Answer


38. What is the output of this program ?

int main()
{
    char *p;
    p="%d";
    p++;
    p++;
    printf(p-2, 13);
    return 0;
}

A. 11
B. 13
C. Error
D. No output

View Answer


39. What is the output of this program 32 bit c compiler ?

int main()
{
     printf("%%%%");
    return 0;
}

A. %%%%%
B. %%
C. No output
D. Error

View Answer


40. What is the output of this program ?

int main()
{
     int a=250;
    printf("%1d<0x1d>", a);
    return 0;
}

A. 1250
B. 2
C. 50
D. 250

View Answer







Also check :


Discussion


* You must be logged in to add comment.