Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

C Programming :: Variables & Data Types

Home > C Programming > Variables & Data Types > General Questions

11. #include
#include
float avg(float,float,float);
void main(){
float p=1,q=2,r=-2,a;
a=avg(p,(q=4,r=-12,q),r);
printf("%f",a);
}
float avg(float x,float y,float z){
return (x+y+z)/3;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

12. #include
int main()
{
const int i=4;
float j;
j = ++i;
printf("%d %f", i, ++j);
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option C

Explanation:

i is a constant. you cannot change the value of constant

Workspace

Tags:

No Tags on this question yet!

13. #include
int main()
{
register i=5;
char j[]= "hello";
printf("%s %d",j,i);
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option D

Explanation:

if you declare i as register compiler will treat it as ordinary integer and it will take integer value. i value may be stored either in register or in memory.

Workspace

Tags:

No Tags on this question yet!

14. # include
int i=10;
int main()
{
extern int i;
{
int i=20;
{
const volatile unsigned i=30;
printf("%d",i);
}
printf("%d",i);
}
printf("%d",i);
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option C

Explanation:

{' introduces new block and thus new scope. In the innermost block i is declared as,
const volatile unsigned
which is a valid declaration. i is assumed of type int. So printf prints 30. In the next block, i has value 20 and so printf prints 20.
In the outermost block, i is declared as extern, so no storage space is allocated for it. After compilation is over the linker resolves it to global variable i (since it is the only variable visible there). So it prints i's value as 10.

Workspace

Tags:

No Tags on this question yet!

15. #include
int main()
{
static int i=5;
if(--i){
main();
printf("%d ",i);
}
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

The variable "I" is declared as static, hence memory for I will be allocated for only once, as it encounters the statement.
The function main() will be called recursively unless I becomes equal to 0, and since main() is recursively called, so the value of static I ie., 0 will be printed every time the control is returned.

Workspace

Tags:

No Tags on this question yet!

16. What is the output of the following C Program?

#include
void main()
{
unsigned int i=65000;
while(i++!=0);
printf("%d",i);
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Note the semicolon after the while statement. When the value of i becomes 0 it comes out of while loop. Due to post-increment on i the value of i while
printing is 1.

Workspace

Tags:

No Tags on this question yet!

17. What is the output of the following C Program?

#include
int main()
{
static int i=i++,j=j++,k=k++;
printf("%d%d%d",i,j,k);
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option D

Explanation:

Since static variables are initialized to zero by default.

Workspace

Tags:

No Tags on this question yet!

18. What will be output of the following "c" code?

#include
auto int a=5;
int main(){
int x;
x=~a+a&a+a< printf("%d",x);
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option E

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

19. What will be output of the following "c" code?
=>For input as 1 2

#include
int main(){
register int a,b;
int c;
scanf("%d%d",&a,&b);
c=~a + ~b + ++a + b++;
printf(" %d",c);
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option E

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

20. What will be output of the following "c" code?

#include
int main(){
float x;
x=0.35==3.5/10;
printf("%f",x);
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!