C Programming MCQ - Variables & Datatypes

21. What is the output of this program?

int main()
{
char ch;
ch = 128;
printf("%d\n", ch);
return 0;
}

A. 128
B. -128
C. Depends on compiler
D. None of the above

View Answer


22. What is the output of this program?

int main()
{
float x = 'a';
printf("%f", x);
return 0;
}

A. a
B. a.000000
C. 97.000000
D. Run time error

View Answer


23. How would you round off a value from 6.66 to 7.0?

A. ceil(6.66)
B. floor(6.66)
C. roundup(6.66)
D. roundto(6.66)

View Answer


24. What will be the output of the program in 16 bit platform ?

#include<stdio.h>
int main()
{
extern int i;
i = 20;
printf("%d\n", sizeof(i));
return 0;
}

A. 2
B. 4
C. 8
D. Linker Error

View Answer


25. What will be output when you will execute following c code?

#include<stdio.h>
int main()
{
printf("%d\t",sizeof(5.5));
printf("%d\t",sizeof(50000));
printf("%d",sizeof('A'));
return 0;
}

A. 4 2 1
B. 8 4 4
C. 8 4 2
D. compiler dependent

View Answer


26. What is the output of this program?

void main()
{
int i=0, j=1, k=2, m;
m = i++ || j++ || k++;
printf("%d %d %d %d", m, i, j, k);
}

A. 1 1 2 3
B. 1 1 2 2
C. 0 1 2 2
D. 0 1 2 3

View Answer


27. What is the output of this program?

void main()
{
int c = - -14;
printf("%d", c);
}

A. 13
B. 14
C. -14
D. Compilation Error

View Answer


28. What is the output of this program?

void main()
{
int i=5;
i = !i>10;
printf("%d", i);
}

A. 5
B. 10
C. 0
D. None of the above

View Answer







Also check :


Discussion


* You must be logged in to add comment.