printf( "%c", 100);
A. | prints 100 |
B. | prints ASCII equivalent of 100 |
C. | prints garbage |
D. | none of above |
Option: B Explanation : Click on Discuss to view users comments. |
The program fragment
int i = 263 ;
putchar( i );
A. | prints 263 |
B. | prints the ASCll equivalent of 263 |
C. | rings the bell |
D. | prints garbage |
Option: C Explanation : Click on Discuss to view users comments. |
The following statement
prlntf( ‘%f ’, 9/5) ;
prints
A. | 1.8 |
B. | 1.0 |
C. | 2.0 |
D. | 0.00 |
Option: D Explanation : This statement is undefined behavior because the argument has to be of type double and 9 / 5 is of type int. Following program yields an output of 1.8
int main()
{
printf("%f",9/5.0);
return 0;
}
Click on Discuss to view users comments. |
The following program fragment
unsigned i = 1;
int j = -4;
printf ("%u ", i + j);
prints
A. | garbage |
B. | -3 |
C. | an integer that changes from machine to machine |
D. | none of above |
Option: C Explanation :
In the computer I used to execute this program. the output was 4294967293. That's because in my system, Click on Discuss to view users comments. |
If the following program fragment ( assume negative numbers are stored in 2's complement form )
unsigned i=1;
int j = -4;
printf( " %u ", i + j);
prints x, then printf( " %d ", 8* sizeof( int ));
outputs an integer that is same as (log in the answers are to the base two)
A. | an unpredictable value |
B. | 8 * log( x + 3 ) |
C. | log( x+ 3 ) |
D. | none of above |
Option: C Explanation : Let size of ( int ) = 1. So, -4 will be stored as 1 1 1 1 1 1 0 0. Since we are adding unsigned and signed integers, the signed gets converted to unsigned. So. i + j will become 1 1 1 1 1 1 0 1. We are trying to print this as an unsigned integer. So, what is printed will be 28 - 1 - 2. So, log (x + 3) = 8 (i.e.. 8 * sizeof ( int)}. Click on Discuss to view users comments. |
Syllabus Covered in this section is
This Section covers Multiple Choice Questions Answers in C Programming . Here questions answers are given with explanation and references. These questions can be used for the preparation of various competitive and academic exams.
Who can benefit -
Various Search Terms used for this section are