M.P.BIRLA FOUNDATION H.S. SCHOOL UNIT ASSESSMENT I, 2025-26 CLASS IX
SUBJECT-COMPUTER APPLICATIONS MAXIMUM MARKS – 25
WRITING TIME 50 MINUTES
1.
i)A set of characters is assigned to:
a) int
b) String
c) float
d) char
ii)A word used in high level language which has a special meaning to the compiler is a called:
a) Token
b) Class
c) Keyword
d) Identifier
iii)Primitive data type that holds fractional values
a) double
b) boolean
c) float
d) both a and c
iv)The size of int data type in bits is:
a) 32 bits
b) 64 bits
c) 8 bits
d) 16 bits
v)Boolean data type holds
a) true
b) false
c) 0 and 1
d) both a and b
vi)if (a>b && a>c), then which of the given statements is true?
a) b is the smallest
c) a is the smallest
b) b is the greatest
d) a is the greatest
2. Answer the following: [2 X 2 =4]
a) Name the operators listed below:
i) && ! ii) <
i) && → Logical AND operator
ii) < Less than relational operator
b)Is the above statement correct? Give reason in support of your answer.
int x = ‘A’;
Ans.Yes, the above statement is correct.
Reason:
In Java, characters are internally represented using ASCII (or Unicode) values. The character ‘A’ has an ASCII value of 65.When you assign a character to an integer variable, Java implicitly converts the character to its corresponding numeric (ASCII) value.
3. Write a program to declare a class named ShowRoom. [15]
Accept the name of the customer and the cost of the items purchased. Calculate discounton the cost of purchased items, based on the following criteria:
cost(RS) | Discount(%) |
Less than or equal to Rs 15000 | 5% |
More tan 15000 to equal to 30000 | 10% |
Above Rs 30000 | 20% |
Display the name, discount and the amount to be paid after discount.The program should be written using Variable descriptions/Mnemonic codes so that the logic of the program is clearly depicted.
Program code:
import java.util.Scanner;
public class ShowRoom {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String n;
double c, d = 0, a;
System.out.print(“Enter name: “);
n = sc.nextLine();
System.out.print(“Enter cost: “);
c = sc.nextDouble();
if (c <= 15000)
d = 5;
else if (c <= 30000)
d = 10;
else
d = 20;
a = c – (d / 100) * c;
System.out.println(“Name: ” + n);
System.out.println(“Discount: ” + d + “%”);
System.out.println(“Amount to pay: ” + a);
}
}