computer paper class 10 icse
computer paper class 10 icse
Choose the correct answers to the questions from the given options. (Do not copy the
question, Write the correct answer only.)
(i) Name the feature of Java depicted in the following picture.
(xi) What will be the data type of variable s in the following statement?
Page 2 of 9
(xiv) How many times will the following loop be executed and what will be the output?
int i;
for ( i=5 ; i>10 ; i++ )
System.out.print(i);
System.out.println(i * 4);
a) 5 times, o/p 5678940
b) 0 times, o/p 20
c) 1 time, o/p 524
d) 5 times, o/p 5678910
(xv) Assertion (A): To call abs() method no object or class name is required.
(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 false and Reason (R) is true
(xvi) Go through the following text and choose the correct answer:
Selection statements help in selecting one alternative out of more than one option.
They are also called decision-making statements as the computer needs to take a
decision while executing these statements as per the conditions provided. The output of
the program depends upon the statement selected by the computer based on the validity
of the condition.
(xvii) Assertion (A): An array variable is also known as subscripted variable. Reason
Page 3 of 9
(R): In arrays, every element is represented with the help of its individual index.
(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
Question 2 [10X2=20]
(i) Write a Java statement for the following mathematical expression:
a2 +b2 x (a+b)8
|a + b|
a = – –a + a++ * a– – ;
(iii) Identify the syntax error in the following code fragment and rewrite its rectified
form:
for(int i=2; i++;)
{
Page 4 of 9
System.out.println(i);
(v) Write down the return data type of nextLong() and Math.random() methods.
(vi) Study the following iterative structure and answer the questions with working:
int k = 3;
while(++k<=10)
if((k+5) % 5==0)
break;
System.out.println(k+5);
(a) “ARTIFICIAL”.endsWith(“AL”);
(b) “Java_Basics”.trim().length();
int b[ ]={ 0, 3, 7, 3 };
Place all the elements of array b and a in another array c one after the other and answer
the questions:
A public library issues books, which a student can use for 7 days without any fine, while
returning the book a fine will be charged only for excess days, if returned after specified
days. Design a class Library with the following specifications:
Page 6 of 9
fine_amount - to store the amount to be paid as fine.
Member methods:
void input() - to input the name of the book and the number of days taken to return the
book.
void computeFine() - to compute the extra days taken to return the book and calculate the
fine amount only for extra days as per the given slabs:
Up to 5 days 5
6 to 15 days 10
Above 15 days 20
void display() - to display the name of the book, extra days taken to return and the fine
amount.
Now define a main() method to create an object and invoke the above member methods for
obtaining the desired output.
Question 4
Write a program to accept a word and convert its all characters into lower case form. Now
count and display the total number of consonants in it. [15]
Question 5
Write a program to accept some integers in an array of size 15. Now arrange those elements
in descending order using the technique of Bubble Sort. Display the sorted array with a
proper message. [15]
Question 6
Design a class to overload a method show() as follows: [15]
Page 7 of 9
12345
2345
345
45
5
void show(int r) : – to accept a two digit number and check whether it is special 2 digit number
or not. A special two digit number is such that when the sum of its digits is added to the product
of its digits the result is a equal to the original two digit number. Example: consider the number
59. Sum of digits = 5 + 9 = 14 and Product of its digits = 5 x 9 = 45
Sum of the sum of digits and product of digits = 14 + 45 =59
Question 7
An array is referred to as a ‘Special array’ if it has equal number of 0s and 1s in it. Write a
program to accept some positive integers in a DDA (double dimensional array) of size 4x4
and check whether it is a special array or not. Display an error message if the array does not
contain any ‘zero’ and ‘one’. [15]
Example:
n[ ][ ] = { { 1,3,1,0 }, { 2,4,5,6 }, { 2,0,8,0 }, { 1,7,5,9 } } ;
Total number of 0s = 3
Total number of 1s = 3
Question 8
An ‘EMRIP’ number is a natural number that must satisfy the criteria as follows: [15]
Write a program to accept a natural number from the user and check if it is an EMRIP
number or not. Example:
Input number: 13
Page 8 of 9
• It is a Prime number
• It’s not equal to its reversal i.e. it’s not a Palindrome number
Question 9
Define a class Anagram which will check that entered string is anagram or not
An anagram is a string , which contains the same characters but different order.
Question 10
Write a program in java to read two strings and append them together and return the result.
If the strings are different lengths, remove characters from beginning of longer string and make
Page 9 of 9