C Programming MCQ - Variables & Datatypes

31. What is the output of this program?

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

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

View Answer


32. What is the output of this program?

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

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

View Answer


33. 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


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

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

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

View Answer


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

#include <stdio.h>
int main()
{
    printf("%d	",sizeof(5.5));
    printf("%d	",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


36. 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


37. 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


38. 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


39. The format identifier %i is also used for _____ data type?

A. char
B. int
C. float
D. double

View Answer


40. Variable names beginning with underscore is not encouraged. Why?

A. It is not standardized
B. To avoid conflicts since assemblers and loaders use such names
C. To avoid conflicts since library routines use such names
D. To avoid conflicts with environment variables of an operating system

View Answer







Also check :


Discussion


* You must be logged in to add comment.