0% found this document useful (0 votes)
13 views

Computer Programming (18ES1T03) - Mid-Term Exam - 2019-2020

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Computer Programming (18ES1T03) - Mid-Term Exam - 2019-2020

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

-si iltcen Silicon lnstitute of Technology

Silicon Hills, Bhubaneswar


, ., Swyr,rr# l*,,*e:dlrily I An Autonomous Institute I

1st Semester B.Tech Mid Term Examination2019-2020


COMPUTER PROGRAMMING(I 8ES I T03)
Duration: 01:30 Full Marks: 25

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);
)

b What do you mean by keywords? How many keywords are there in C? 1

c What is the output of this C code? 1

#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) ;
)

b Differentiate while loop and do.. while loop. 1

3 Answe, any Two


a Write a C program that accepts a distance in inches and prints the corresponding value in 2
centimeter. Note that 1 inch :2.54 cm.
b Draw a flowchart to compute the greatest among the three given numbers. 2

c What is explicit and implicit type conversion. Explain with suitable example. 2

4 Ans*r, any Two


a There are coins of Rs. lO, 5,2, and 1 in the bag. Write a program for the teller to calculate the 2
total amount of money. The teller will enter the number of coins from each denomination.

b Write a program to find factoriai of a number. 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++;
)
)

5 Ans*e, any Two


a Write a program to generate the Fibonacci series up to nth term, where n is provided by the
6

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.

You might also like