C Online Test 6
32. What is the output of the following code?
void main()
{
int a = 010;
printf(“\n a = %d “, a);
}
33. What is the output of the following code?
void main()
{
int a = 010;
printf(“\n a = %o “, a);
}
34. What is the output of the following code?
void main()
{
int a = 53;
printf(“\n a = %o “, a);
}
35. What is the output of the following code?
void main()
{
int a = 53;
printf(“\n a = %x “, a);
}
Attend Free Demo and Learn C LANGUAGE ONLINE TRAINING by Real-Time Expert
36. What is the output of the following program?
void main()
{
int a=5, b=3;
printf(“%d”, ++(a*b+1));
}
37. What is the output of the following program?
void main()
{
printf(“%d”, ++2);
}
38. What is the output of the following code?
void main()
{
int i=0, j = 1;
printf(“%d “, i++ && ++j);
printf(“%d %d “, i, j);
}
39. What is the output of the following code?
void main()
{
float c = 3.14;
printf(“%f” , c % 2);
}
40. What is the output of the following code?
void main()
{
printf(“%d”, ‘A’);
}
Attend Free Demo and Learn C LANGUAGE ONLINE TRAINING by Real-Time Expert
41. What is the output of the following code?
void main()
{
double d = 1/2.0 – 1/2;
printf(“d = %0.2lf”, d);
}
42. What is the output of the following code?
void main()
{
unsigned int c = -2;
printf(“c = %u” , c);
}
43. What is the output of the following code?
void main()
{
char c = ‘A’;
printf(“%c”, c + 10);
}
44. What is the output of the following code?
void main()
{
int a = 5;
a = printf(“Good”) + printf(“Boy”);
printf(“%d”, a);
}
45. What is the output of the following code?
void main()
{
printf(“Work” “Hard”);
}
Attend Free Demo and Learn C LANGUAGE ONLINE TRAINING by Real-Time Expert
46. What is the output of the following code?
void main()
{
int a = 5,i;
i = !a > 10;
printf(“i = %d”, i);
}
47. What is the output of the following code?
void main()
{
char n;
n = !2;
printf(“%d “, n);
}
48. What is the output of the following code?
void main()
{
int b;
b=’b’ > ‘B’;
printf(“%d” , b);
}
49. What is the output of the following code?
void main()
{
int x;
x=20;
x*=30+5;
printf(“%d”, x);
}
50. What is the output of the following code?
void main()
{
printf(“%d %d”, sizeof(10), sizeof(2.5));
}
Attend Free Demo and Learn C LANGUAGE ONLINE TRAINING by Real-Time Expert
51. what is the output of the following program?
void main()
{
int x = 100, y = 200;
x>=300? y=400: y=500;
printf(“%d”, y);
}
52. what is the output of the following program?
void main()
{
int x = 100, y = 200;
x>=300? (y=400): (y=500);
printf(“%d”, y);
}
53. What is the output of the following code?
void main()
{
char ch = 321;
printf(“%d %c” , ch, ch);
}
54. What is the output of the following code?
void main()
{
char ch = ‘\t’;
printf(“%c5”, ch);
}
55. what is the output of the following code?
void main()
{
int i = 97;
printf(“%c”, (char)i);
}
Attend Free Demo and Learn C LANGUAGE ONLINE TRAINING by Real-Time Expert
56. What is the output of the following code?
void main()
{
float f = 66.6;
printf(“%c” , (char) f);
}
57. What is the output of the following code?
void main()
{
int i = -0777;
printf(“%d” , i);
}
58. What is the output of the following code?
void main()
{
int i = + -1234;
printf(“%d” , i);
}
59. What is the output of the following code?
void main()
{
char ch = ‘A’;
printf(“%c” , (int) ch);
}
60. What is the output of the following code ?
void main()
{
int i = 4;
float f = 3;
printf(“%d” , i/f );
}
Attend Free Demo and Learn C LANGUAGE ONLINE TRAINING by Real-Time Expert
61. What is the output of the following code?
void main()
{
signed char ch1 = ‘Z’ , ch2= ‘z’;
ch1 = printf(“%c%c”, ch1, ch2);
printf(“%d “, ch1);
}
62. What would be the result of the expression (-13 % 5) ?
63. What will be the value of y in the following expression?
y = ( 5 > 4) == 1 ;
64. If integer num has a value 40, what will be the output of the following code?
num % 19 ? printf(“Hello”) : printf(“Hi %d” , (num / 100) + num);
A. Hello
B. Hi 40.04
C.Hi 80
D. Hi 40
65. What is the output of the following code?
void main()
{
num = 5;
printf(“%d” , ++num++);
}
Attend Free Demo and Learn C LANGUAGE ONLINE TRAINING by Real-Time Expert
66. What will be the value of num after executing the following statement?
void main()
{
Int num = 10;
num/= num/= 2;
printf(“%d” , num);
}
67. What is the output of the following code?
void main()
{
const int c = 10;
printf(“%d” , c++);
}
68. What will be the value of ‘a’ after executing following statements?
void main()
{
int x = 1, y = 0, a;
a = ! ! x + ! y;
printf(“%d” , a);
}
69. If the integer variable ‘a’ has a value 2, then after executing the following statement what will be its value?
–a * –a && –a || –a ;
70. What will be the value of variable ‘a’ after execution the following statements?
void main()
{
int a = 2;
if ( a– || –a || a– )
a += 1;
printf(“%d” , a);
}
Attend Free Demo and Learn C LANGUAGE ONLINE TRAINING by Real-Time Expert
71. What is the output of the following code?
void main()
{
int a = 10 , b = 10, c;
c = a+++++b;
printf(“%d %d %d ” , c, a, b);
}
72. What is the output of the following program?
void main()
{
printf(“%d %d %d %d” , 10, 20, 30);
}
73. What is the output of the following program?
void main()
{
int j = 4, k;
k = !5 && j;
printf(” k = %d \n” , k);
}
74. What is the output of the following code?
void main()
{
int x;
x = 18.52;
printf(“%d” , x);
}
75. What is the output of the following program?
void main()
{
int i = -1 , j = 1, k, l;
k = !i && j;
l = !i || j;
printf(“%d %d %d %d \n” , i, j, k, l);
}
Attend Free Demo and Learn C LANGUAGE ONLINE TRAINING by Real-Time Expert
76. What is the output of the following code?
void main()
{
printf(“%d %d %d “, 10, 20, 30, 40);
}
77. What is the output of the following program?
void main()
{
int i = -1, j = 1, k, l;
k = i && j;
l = i || j;
printf(“%d %d %d %d \n” , i, j, k, l);
}
78. What is the output of the following code?
void main()
{
printf( ” %d %d %d %d %d” , 5%2 , -5%2, 5%-2,
-5%-2, 2%5);
}
79. What is the output of the following program?
void main()
{
int i = 4 , j = -1, k = 0, y, z;
y = i + 5 && j + 1 || k + 2;
z = i + 5 || j + 1 && k + 2;
printf(” y = %d z = %d \n” , y, z);
}
80. What is the output of the following program?
void main()
{
int i = 4, j = -1, k = 0, w, x, y, z;
w = i || j || k ;
x = i && j && k;
y = i || j && k;
z = i && j || k;
printf(“w = %d x = %d y = %d z = %d \n” , w,x,y,z);
}
Attend Free Demo and Learn C LANGUAGE ONLINE TRAINING by Real-Time Expert
81. What is the output of the following code?
void main()
{
int x;
float y;
x = 5 / 2;
y = 5 / 2;
printf(“%d %f” , x, y);
}
82. What is the output of the following program?
void main()
{
int k = 35;
printf(“%d %d %d \n” , k == 35, k = 50, k > 40);
}
83. What is the output of the following program?
void main()
{
int x = 3, y, z;
y = x = 10;
z = x < 10;
printf(“x = %d y = %d z = %d \n” , x,y,z);
}
84. What is the output of the following code?
void main()
{
int x,y;
x = 10;
y = 20;
x = x + y;
y = x – y;
x = x – y;
printf(“x = %d y = %d” , x, y);
}
85. What is the output of the following code?
void main()
{
int x = -1;
printf(“%d %u %o %x”, x, x, x, x);
}
Attend Free Demo and Learn C LANGUAGE ONLINE TRAINING by Real-Time Expert
86. The expression x = -7 % 2 – 8 is evaluates to
A) -9
B) -7
C) 1
D) None of the above
87. What is the output of the following code?
void main()
{
printf(“%d ” , -5 && 5 );
}
88. What is the output of the following code?
void main()
{
int y;
y = ++2;
printf(“%d” , y);
}
89. The expression, a = 22/ 7 * ( 6.28 + 6.28) * 5 / 3 ; evaluates to
A) 62.799999
B) 6.28
C) 12.56
D) 0
90. What is the output of the following program?
void main()
{
printf(“nn \n\n nn\n”);
printf(“nn /n/n nn/n”);
}
Attend Free Demo and Learn C LANGUAGE ONLINE TRAINING by Real-Time Expert
91. What is the output of the following code?
void main()
{
int x;
x=10;
x*=x+5;
printf(“%d” , x);
}
92. What is the output of the following code?
void main()
{
int x;
x=5;
x++ * ++x;
printf(“%d”, x);
}
93. What is the output of the following program?
void main()
{
float a=5, b = 2;
int c,d;
c = a % b;
d = a / 2;
printf(“%d \n” , d);
}
94. What is the output of the following program?
void main()
{
int a,b;
a = -3 – -25;
b = -3 – -(-3);
printf(“a= %d b = %d \n” , a,b);
}