NEW
Font size
WorksheetsBasic of C
Total questions: 10
Worksheet time: 10mins
Predict the output
#include <stdio.h>
int var = 20;int main(){
int var = var;
printf("%d ", var);
return 0;
}
Garbage Value
20
Compile Time Error
None of these
What will be the output?
int main(){
{
int var = 10;
}
{
printf("%d", var);
}
return 0;
}
Compile Time Error
10
Garbage Value
None of these
int main()
{
int x = 032;
printf("%d", x);
return 0;
}
32
26
0
50
int main()
{
int a=5,b=6,max;
a<b?max=b:max=a;
printf("%d",max);
return 0;
}
6
Compile Time Error
Run Time Error
None of these
What will be the output?
int main()
{
char c = 125;
c = c+10;
printf("%d", c);
return 0;
}
135
-121
-8
Compile time error
#include <stdio.h>
int main()
{
if (sizeof(int) > -1)
printf("Yes");
else
printf("No");
return 0;
}
Yes
No
Compiler Error
Run time Erroe
What will be the output?
Note: Consider size:( int 2 bytes) ,(float 4 bytes), (double 8 Bytes)
int main()
{
printf("%d", sizeof(3.5));
return 0;
}
4
8
2
None of these
What will be the output?
Note: Consider size:( int 2 bytes) ,(float 4 bytes), (double 8 Bytes)
int main()
{
printf("%d", sizeof(!3.5));
return 0;
}
4
8
2
None of these
What will be the output?
int main()
{
int n;
int i=printf("Hello world");
n=i+10;
printf("%d",n);
}
21
Hello world
Hello world21
Compiler Error
What will be the output?
int main()
{
int n=10;
printf(1+"%d",n);
}
10
0
d
Compiler Error
