HYE Computer Science 2024-2025
HYE Computer Science 2024-2025
SESSION: 2024-25
HALF YEARLY EXAMINATION
COMPUTER SCIENCE
CLASS – 11
Maximum Marks: 70
Time allowed: 3 hours
Answers to this Paper must be written on the paper provided separately.
The time given at the head of this Paper is the time allowed for writing the answers.
The intended marks for questions are given in brackets [ ].
1
Question 2
a. What do you mean by non-primitive data type? Give example [2]
b. Convert the following arithmetic expression into java statement: [2]
√
c. Differentiate between static variable and non-static variable. [2]
d. What is the output of the following code: [2]
String m = “STEM WORLD SCHOOL”;
(i) String r = m.substring(m.indexOf(“W”),m.lastIndexOf(‘ ’));
(ii) String k = m + 2024;
e. Write the syntax of StringTokenizer ? [2]
f. What is the output of the following segment ? [2]
(i) System.out.println(12+34+ “123”+12+34);
(ii) System.out.println((int)“ABCD”.charAt(2));
2
SECTION-B [20 Marks]
(Attempt any two questions)
Each program should be written in such a way that it clearly depicts the logic of the problem.
This can be achieved by using mnemonic names and comments in the program.
(Flowcharts and algorithms are not required. Programs must be written in Java)
Question 6
Write a program in Java to input employee code, annual salary and deductible annual savings. Find
the taxable income and calculate the income tax as per the following:
Question 7
Write a class with the name Area using method overloading that computes the area of a
parallelogram, a rhombus and a trapezium.
Formula:
Area of a parallelogram (pg) = base * ht
Area of a rhombus (rh) = (1/2) * d1 * d2
(where, d1 and d2 are the diagonals)
Area of a trapezium (tr) = (1/2) * ( a + b) * h
(where a and b are the parallel sides, h is the perpendicular distance between the parallel sides)
[10]
Question 8
Write a program to accept the names of 10 cities in a single dimensional string array and their STD
(Subscribers Trunk Dialling) codes in another single dimension integer array. Search for the name of
a city input by the user in the list. If found, display "Search Successful" and print the name of the
city along with its STD code, or else display the message "Search unsuccessful, no such city in the
list".
[10]
Question 10
Write a program to accept a string. Display the characters which are vowels. [5]
Question 11
Write a program to accept a number. Display the sum of the digits of the number. [5]