WORKSHEET_CLASS9_CTS

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

WORKSHEET

CLASS – 9
SECTION - A

Q1) Answer the following Questions:


1) Define source code and object code.
2) Define byte code and JVM. Write two difference between OOP and POP.
3) What do you mean by type conversion ? How is implicit conversion different from
Explicit conversion?
4) What will be the output :
( i) if a= 8 ; find the value of : a - = ++a + a++ + 4
(ii ) if int y = 10 then find int z = (++y * (y++ + 5) ;
5) Rewrite the following program segment using if – else statements instead of the ternary
operator :
commission = (sale > 5000) ? sale * 10 / 100 : 0 ;

Q2) Answer the following Questions:


1) Define token, literal and identifiers with examples.
2) Define data types and its types with examples. Write the size of int and double data type
in terms of bytes.
3) What are comments? Explain with examples and its types.
4) Rewrite the following using ternary operator :
if(income < 10000)
tax = 0;
else
tax = 12 ;
5) Write the java expression for the following :
(i ) p = a / b2 + b / a2
√𝟑𝐱 + 𝒙𝟐
(ii) 𝒅 =
(𝒂+𝒃)

SECTION – B
(NOTE : Solve the following Programs , Write Variable Description table after each program)

Q1) Write a program in java to input the name and basic salary of an employee. Find the gross
pay and net salary of an employee for the following allowances and deduction.
Use meaningful variables:
da(Dearness Allowance) : 25 % of Basic Pay
hra(House Rent Allowance ) : 15 % of Basic Pay.
Pf(Provident Fund) : 10 % of Basic Pay
gross : basic + hra + da.
Net pay : gross - pay.
Q2) a) Write a java program to accept length and breadth of a Rectangle. Find the area and
Perimeter of the rectangle and display the area and perimeter.
b) Write a java program to accept principle , rate and time . Display Simple interest by
using the following formula : si = (p * r * t ) / 100 ;
Q3) Write a menu driven program to calculate :
(a ) Area of square = side * side
(b) Area of rectangle = length * breadth
(c ) Area of circle = p * r2 , where p =22 / 7
Enter ‘c ‘ to calculate area of circle , ‘s’ to calculate area of square and ‘r ‘ to calculate
area of rectangle .

Q4) ‘Sangam Electronics ‘ has announced the following seasonal discounts on purchase of
certain items :

Purchase Amount Discount on Laptop Discount on Desktop PC


Up to Rs. 30000 0.0 % 5.0 %
Rs. 30001 to Rs. 60,000 5.0% 8.0 %
Rs. 60001 to Rs. 1,00,000 8.0% 10.0 %
More than Rs. 1,00,000 10.0 % 15.0 %

Write a program to input name , amount of purchase and the type of purchase (‘L’ for Laptop
and ‘D’ for desktop ) by a customer . Compute and display the net amount to be paid by a
customer along with his name.
(Net Amount = Amount of purchase - discount).

Q5) Write a program to compute the amount that a customer pays for a taxi that he hires based
on the following conditions :

Kms Travelled Amount per km


Upto less or equal to 1 km 25
More than 1 to 6 km 10
More than 6 to 12 km 15
More than 12 to 18 km 20
More than 18 25

Input the customers name , the taxi number and the number of kilometers travelled by him.

You might also like