Programming in C - I/O Operations

51. For x and y are variables as declared below
double x=0.005,y=-0.01;
What is the value of ceil(x+y)

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


52. If the following program fragment(assume negative numbers are stored in 2's complement form)
unsigned i=1;
int j=-4;
printf("%d",8*size of(int));
output is (log in answers are to the base two)

  • Option : C
  • Explanation :
    Let size of (int)=1. So, -4 will be stored as 11111100. Since we are adding unsigned and signed integers the signed gets converted to unsigned.
    So, i + j will become 11111101. We are trying to print this as an unsigned integer.
    So, what is printed will be 2⁸-1-2. So, log (x+3)=8(i.e,*size of (int)).
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


53. Output of the following program fragment (in C) is
for (i = 1; i < 5; i ++);
if (i = = 3) continue;
else printf ("%d",i);

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


54. The following 'C' program
{
unsigned int num;
int c=0
scanf("%u",&num);
for(;num;num>>=1)
{
if(num &1)
c++;
}
printf("%d",c);
}

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


55. Find the output of following code segment
for(putchar('c');putchar('a');putchar('r'))
putchar('t');

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *