Programming Fundaments Terminal - Online
Programming Fundaments Terminal - Online
Marks = 50
Please add your name, class and roll no on answer book before submitting online. You can submit
the solution of this paper through email using : [email protected] or on my Whatsapp no. Do
not share solution on Whatapp group. Good luck and stay safe!
(1) What would be the output of the following program segments: (5 marks each: 15)
(a) main( ) {
printf ( "\nOnly stupids use C?" ) ;
display( ) ;
printf ( "\n No genius use C?" ) ;
}
display( )
{
printf ( "\nFools too use C!" ) ;
main( ) ;
}
(b) main( )
{
int i = 45, c ;
c = check ( i ) ;
printf ( "\n%d", c ) ;
}
check ( int ch )
{
if ( ch >= 45 )
return ( 100 ) ;
else
return ( 10 * 10 ) ;
}
(c) main( ) {
int x = 4, y = 0, z ;
while ( x >= 0 )
{
if ( x == y )
break ;
else
printf ( “\n%d %d”, x, y ) ;
x-- ;
y++ ;
}}
(2) If the ages of Aslam, Akram and Munir are input through the keyboard, Draw a flowchart to
determine and print the name of the youngest of the three. (8)
(3) Write a program to print the multiplication table of the number entered by the user. The table
should get displayed in the following form. (9)
29 * 1 = 29
29 * 2 = 58
(4) Write a program to calculate overtime pay of 10 employees. Overtime is paid at the rate of Rs.
12.00 per hour for every hour worked above 40 hours. Assume that employees do not work for
fractional part of an hour. (8)
(5) In a company an employee is paid as: If his basic salary is less than Rs. 1500, then HRA = 10%
of basic salary, DA = 90% of basic salary and CA=20% of basic salary. If his salary is either equal
to or above Rs. 1500, then HRA = Rs. 500 , DA = 98% of basic salary and CA=25% of basic salary.
If the employee's salary is input through the keyboard write a program to find his gross salary. (10)