80 Programming and Data Structures
7) What would be the value of x on execution of the program?
# include <stdio.h>
# include <conio.h>
void main ()
{
fl o a t x=2. 3 ;
tSlrscrO ;
x+=.2;
printf C%g",x);
a) 2.5 b) 4.3
c) 4 d) none of the above
8) What will be the output of the following prograih?
main()
{
system ("" );
}
a) control goes to the dos prompt b) syntax error
c) bad command or file name d) none of the above
9) Which is the correct statement for finding the cube of 2 ?
a) pcw (2,3); b) pow (3,2);
c)
pcfw (3); d) none of the above
10) The abs () function displays
a) absolute value b) negative value
c) zero value d) none of th above
C) Attem pt the following program s.
1) Write a program to input the rainfall of three consecutive days in CMS and find its average?
2) Find the simple interest? Inputs are principal amount, period in year and rate of interest.
3) Write a program to find total number of minutes in 12 hours?
4) Find the area and perimeter of a) square b) rectangle? Input the s id e (s ) through the keyboard?
5) Accept any three numbers and find their squares and cubes?
6) The speed of a van is 80 km / hour. Find the number of hours required for covering a distance of
500 km? Write a program in this regard.
7) Write a program to convert Inches to Centimeters.
8) Write a program to enter the name of this book and display it.
9) Write a program to store and interchange two float numbers in variables a & b.
10) Write a program to enter text with g e ts () and display it using p r i n t f () statement also find
the length of the text.
11) Write a program to ensure that the difference between any two-digit number and its reverse
(number interchanged) is always a multiple of nine. For example entered number is 54 and it's
reverse is 45. The difference between them is 9.
12) Write a program to convert kilograms to grams.
13) Write a program to find the total amount when there are 5 notes of Rs.100,3 notes of Rs.50 &
20 notes of Ks.20.
14) Write a program to enter the temperature in Fahrenheit and convert it to Celsius. Formula to be
used is tc= ((tf-32)*5)/9 where tc and tf are temperatures in Celsius and Fahrenheit respectively.
15) Write a program to display list of c program files and directories. Use sy s tem () function to
execute Dos commands.