10 Icse
10 Icse
R. T. Nagar, Bangalore
I Prefinal Examination – November 2023
Sub: Computer Application
Class: X [ICSE]
Date: 24-11-23
Time Duration: 2 hours Max Marks: 100
1. The method of Scanner class that accepts a String with space is __________.
a. nextLong() b. next() c. nextString() d. nextLine()
2. Which of the following is not true about constructor
a. It is used to initialize the instance variables.
b. It is usually public.
c. It returns nothing so the return type should be void.
d. It is invoked during instantiation.
3. Assertion(A): The process of having two or more functions with the same name but different signature is
called as function overloading.
Reason(R): function that doesn’t return any value should have return type as void .
a. Both Assertion(A) and Reason(R) are true and Reason(R) is a correct explanation of Assertion(A)
b. Both Assertion(A) and Reason(R) are true and Reason(R) is not a correct explanation of
Assertion(A)
c. Assertion(A) is true and Reason(R) is false.
d. Assertion(A) is false and Reason(R) is true.
4. Math. random( ) returns __________ type of value.
a. int b. double c. long d. boolean
5. The loop in which initialization, condition and updation is grouped together at one place is:
a. while( ) b. do-while( ) c. for( ) d. None
9. String method used to check if one string is greater than the other string:
a. trim() b. compareTo() c. equals( ) d. greaterThan()
17. The method that doesn’t change state of an object is called as ___________
a. Pure method b. impure method c. mutator d. both b. and c.
Question 2
Do as directed
1. Observe the following code and answer the given questions: [5]
class cuboid
{
int len, bre, height;
double vol;
static String shape;
void input( )
{ ----
}
void calculate()
{ int a=len*bre;
}
void display()
{ ---
}
public static void main()
{
cuboid box= new cuboid();
}
}
a. Mention the class and instance name
b. Name the instance variables and instance methods.
c. Name the class variables and class methods.
d. Name the local variable/s.
e. Write default constructor for the above class.
4. Mention how many times the loop is going to execute and also mention its output [2]
for(int i=5; i<=50; i+=5)
{
if(i/10==1)
continue;
System.out.print(i+“, ”);
}
5. Mention the java keyword used to perform the following [2]
a. To execute the block of statement when the condition given in front of if( ) is false.
b. Jump statement that returns the control back to the call of function.
Question 5 [15]
Design a class Employee with the following descriptions.
Instance Variables:
String name – to store the name of the employee
int age – to store age of the employee
double basic_sal – to store basic salary of the employee
double DA – to store Dearness Allowances
double HRA – to store House rent Allowance
double PF – to store Provident Fund
double Net_Sal - to store Net Salary
Instance Methods:
Employee() - default constructor to initialize the instance variables with default values.
void accept() - to input values for name, age and basic salary.
void calculate() - to calculate DA(15% of basic_sal),
HRA(10% of basic_sal), PF(9.5% of basic_sal)
Net_Sal = basic_sal+DA+HRA-PF
If the age is greater than 45 additional Rs.20000 to be added to Net_Sal as Diwali Bonus,
else 12000 to be added to Net_Sal.
void display() - to display the details
Write a main method to create an object and invoke the above methods.
Question 6 [15]
Write a program to input a string and perform as given below:
a. Convert it to upper case.
b. Count and display number of special characters in the string.
c. Display all the starting characters of each word.
Sample Input: Nothing is impossible, the word itself says ‘I’m possible’!
Output: Number of special characters = 5
NIITWISIP
Question 7 [15]
Create a class to overload the function check( ) as given below:
1. boolean check(int n) - checks and returns true if the number is abundant number, else returns false.
[Abundant - The sum of factors of the number excluding itself is greater than the
number]
Ex: if n=12, factors→ 1,2, 3, 4, 6 → 1+2+3+4+6 → 16>12 hence 12 is abundant number.
2. boolean check(String s , char c) – checks and returns true if the character c is present in the string
else returns false.
3. boolean check(char c) – checks and returns true if the character is a special character else returns
false.
Question 8 [15]
Write a program to input 30 students marks into an array, find and display the statistics as given below:
No. of Students securing I class (60 – 100) : ___________
No. of Students securing II class(50 – 59) : ___________
No. of Students securing Pass class(35 – 49) : ____________
No. of Students detained(<35) : _____________
Question 9 [15]
The International Standard Book Number (ISBN) is a unique numeric book identifier which is printed on
every book. The ISBN is based upon a 10-digit code. The ISBN is legal if:
Write a program to :
(i) Input the ISBN code as a 10-digit integer.
(ii) If the ISBN is not a 10-digit integer, output the message, “Illegal ISBN” and terminate the program.
(iii) If the number is 10-digit, extract the digits of the number and compute the sum as explained above.
If the sum is divisible by 11, output the message, “Legal ISBN”. If the sum is not divisible by 11, output the
message, “Illegal ISBN”.
[Note: int data type can store upto 9 digit numbers, so go for higher integer data type ]
Question 10 [15]
Write a program to input 35 students marks into an array. Find and display the highest score and the lowest
score.