Variables & Datatypes in C

29. What is the output of this program?

void main()
{
int p, q, r, s;
p = 1;
q = 2;
r = p, q;
s = (p, q);
printf("p=%d q=%d", p, q);
}

A. p=1 q=1
B. p=1 q=2
C. p=2 q=2
D. Invalid Syntex

View Answer


30. What is the output of this program?

void main()
{
printf("%x",-1<<4);
}

A. fff0
B. fff1
C. fff2
D. fff3

View Answer


31. What is the output of this program?

#include<stdio.h>
void main()
{
int a=1, b=2, c=3, d;
d = (a=c, b+=a, c=a+b+c);
printf("%d %d %d %d", d, a, b, c);
}

A. 11 3 5 11
B. 11 1 5 11
C. 11 3 2 11
D. 11 3 3 11

View Answer


32. What is the output of this program?

void main()
{
int a, b = 5, c;
a = 5 * (b++);
c = 5 * (++b);
printf("%d %d",a,c);
}

A. 30 35
B. 30 30
C. 25 30
D. 25 35

View Answer

33. What is the output of this program?

#include<stdio.h>
int main(){
printf("%d",EOF);
return 0;
}

A. 0
B. 1
C. -1
D. NULL

View Answer


34. What is the output of this program?

#include<stdio.h>
int main(){
char num = '\010';
printf("%d", num);
return 0;
}

A. 010
B. 08
C. 10
D. 8

View Answer


35. What is the output of this program?

#include<stdio.h>
int main(){
void num=10;
printf("%v", num);
return 0;
}

A. Compilation error
B. 10
C. Garbage value
D. 0

View Answer


36. What is the output of this program?

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

A. 8 4 2
B. 8 4 1
C. 4 4 1
D. 2.5 2 A

View Answer


37. What is the output of this program?

#include<stdio.h>
int main(){
signed a;
unsigned b;
a = 6u + -16 + 16u + -6;
b = a + 1;
if(a == b)
printf("%d %d",a,b);
else
printf("%u %u",a, b);
return 0;
}

A. Compilation error
B. 0 0
C. 0 1
D. address address

View Answer


38. By default a real number is treated as a

A. float
B. double
C. long double
D. far double

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.