What is printed after execution of each of the following C-programs?

What is printed after execution of each of the following C-programs?

  1. void main()
    {f
    loat reals[5];
    *(reals+1) = 245.8;
    *reals = *(reals + 1);
    printf(“ %f”, reals[0] );
    }
  2. void main( )
    { int nums[3];
    int ptr = nums; nums[0] = 100; nums[1] = 1000; nums[2] = 10000; printf( “%d\n”, ++ptr );
    printf( “%d”, *ptr );
    }
  3. void main()
    { int digit =
    0;
    while (digit <= 9)
    printf( “%d\n”, digit++);
    }
  4. void main()
    { int a=7, b=6;
    fun1(a,b);
    printf(“\n a is %d b is %d”, a, b);
    }
    int fun1(int c,int d)
    { int e;
    e = c * d;
    d = 7 * c;
    printf(:\n c is %d d is %d e is %d”, c, d, e);
    return;
    }

Write a ‘C’ program to calculate and display the monthly income of a salesperson

Write a ‘C’ program to calculate and display the monthly income of a salesperson
corresponding to the value of monthly sales input in the scanf() function, let us consider
the following commission schedule: (Note: use if-else statement)
Monthly Sales Income
Greater than or equal to Rs.50,000 375 plus 16% of sales
Less than Rs. 50,000 but
Greater than or equal to Rs. 40,000 350 plus 14% of sales
Less than Rs. 40,000 but
Greater than or equal to Rs. 30,000 325 plus 12% of sales
Less than Rs. 30,000 but
Greater than or equal to Rs. 20,000 300 plus 9% of sales
Less than Rs. 20,000 but
Greater than or equal to Rs. 10,000 250 plus 5% of sales
Less than Rs. 10,000 200 plus 3% of sales

PROGRAMMING AND PROBLEM SOLVING THROUGH ‘C’ LANGUAGE

1.9. Which of the following is true for the switch statement:
switch(var)
{
};
A) Can be used when only one variable is tested
B) The variable must be an integral type
C) Each possible value of the variable can control a single branch
D) All of the above

PROGRAMMING AND PROBLEM SOLVING THROUGH ‘C’ LANGUAGE

1.8. Consider the following declarations.
union id {
char color;
int size;
}
struct {
char country;
int date;
union id i;
} flag;
To assign a color to a flag, the correct statement would be
A) flag.color = ‘W’;
B) flag.i.color = ‘W’;
C) flag.color = ‘White’;
D) flag.i.color = ‘White’;