C Declaration and Initialization
C Declaration and Initialization
Copy
int main(){
int m=10;
int x=printf("%d ",m);
printf("%d",x);
return 0;
}
1. 10 3
2. 103
3. 10 2
4. 102
Copy
int main(){
int x='A';
printf("%02X",x);
return 0;
}
1. 65
2. 97
3. Error
4. 41
Copy
int main(){
char a=0b1010;
printf("%02X",a);
return 0;
}
/
1. 0A
2. A
3. 0a
4. 10
Copy
int main(){
char a=2*2+2;
printf("%d",a);
return 0;
}
1. 0
2. Garbage
3. 6
4. 8
Copy
int main(){
unsigned char x=-1;
printf("%02X",x);
return 0;
}
1. 0xFFFFFFFF
2. FF
3. 0xFF
4. ff
1. Only (A)
2. Only (B)
3. Both (A) and (B)
4. Both (C) and (D)
7) Which special character can be used to separate two parts (words) of a variable/identifier
name?
1. - (Hyphen)
2. _ (Underscore)
3. $ (Dollar)
4. # (Hash)
Copy
#include <stdio.h>
int main()
{
char x='AB';
printf("%c",x);
return 0;
}
1. Error
2. Runs successfully and prints 'A' (without quote)
3. Run with warnings and prints 'B' (without quote)
4. None of these
1. YES
2. NO
Copy
#include <stdio.h>
int main()
{
int (x)=10;
printf("x= %d",x);
return 0;
}
1. x= 10
2. x= 0
3. Error
4. None of these
Copy
#include <stdio.h>
int main()
{
int i=50;
const int x=i++;
printf("x= %d",++x);
return 0;
}
1. x= 50
2. x= 51
3. x= 52 /
4. Error
Copy
#include <stdio.h>
int main()
{
int a=(10,20);
printf("a= %d",a);
return 0;
}
1. a= 10
2. a= 20
3. a= 30
4. Error