Computer Programming (18ES1T03) - Mid-Term Exam - 2019-2020
Computer Programming (18ES1T03) - Mid-Term Exam - 2019-2020
l Answer All
a What will be the output of the following code segment? 1
#include <stdio.h>
main ( )
{
inta=to,b= 20 , va1 ue
value=(a<b) ? a++ : ++b;
Pnintf("a = %d, b = %d, value=%d", d, b, value);
)
#include <stdio.h>
int main( )
{
int a 5, b= 6;
printf (" R= %d , a&&b);
printf (" S= %d , allb);
)
2 Answer All
a What is the output of this C code? 1
#include <stdio.h>
void main( )
{
int k;
for(k=0;k<10;k+2)
pnintf( "%d ", k) ;
)
c What is explicit and implicit type conversion. Explain with suitable example. 2
tP. T. O.l
c Find out the output of the following code segment' )
main( )
t
int i -L;
while (i<= 70 )
{
if(i%5==0)
break;
printf(" %d\t", i);
i++;
)
)
user.
b Enter 3 sides of a triangle, WAP to check whether the triangle is valid or not (triangle is valid 6
if the sum of two side is greater than the larlest of three sides) and then classiff the given
triangle is isosceles, equilateral or right-angled or scalars.
c Write a program to calculate the electric bill by inputting the previous and present meter 6
reading. thi cost for the lst 100 units is Rs. 1.40 per unit, for the next 100 units Rs. 2.50 per
unit and for rest units Rs. 3.20 per uait.