You are on page 1of 7

ICSE 10th Computer Applications

Sample Paper 10 Page 1

Sample Paper 10
ICSE Class X 2023-24
COMPUTER APPLICATIONS
Time: 2 Hours Max. Marks: 100
General Instructions:
1. Answers to this Paper must be written on the paper provided separately.
2. You will not be allowed to write during the first 15 minutes.
3. This time is to be spent in reading the question paper.
4. The time given at the head of this Paper is the time allowed for writing the answers.
5. This Paper is divided into two Sections.
6. Attempt all questions from Section A and any four questions from Section B.
7. The intended marks for questions or parts of questions are given in brackets [ ].

SECTION - A
Attempt all questions from this part.

QUESTION 1.
Choose the correct answer and write the correct option. [20]
(Do not copy the question, write the correct answers only.)

(i) Identify the output of the following code


String P = “20”, Q = “19”;
int a = Integer.parseInt(P);
int b = Integer.valueOf(Q);
System.out.println(a + “ ” + b);
(a) 2019 (b) 39
(c) 20 (d) 19

(ii) The statement (1 > 0) | | (1< 0) evaluates to


(a) 0 (b) 1
(b) false (d) true

(iii) Errors occur in a program when


(a) Syntax of the programming language is not followed
(b) the program does not run properly or does not execute at all
(c) The program produces an incorrect result
(d) All of the above
ICSE 10th Computer Applications Sample Paper 10 Page 2

(iv) Give the output of Math.sqrt (x); when x = 9.0


(a) 3 (b) 3.0
(c) 3.00 (d) All of these

(v) In_____search, the algorithm uses the middle value of the array for the search operation.
(a) binary (b) linear
(c) bubble (d) selection

(vi) Object that share the same attributes and behaviour are grouped together into a/an
(a) interface (b) instance
(c) alias (d) class

(vii) The parameters that are passed to the method when it is invoked are called
(a) formal parameters (b) actual parameters
(c) informal parameters (d) void parameters

(viii) Polymorphism is broadly used in implementing_____.


(a) inheritance (b) encapsulation
(c) abstraction (d) literals

(ix) Consider the following code snippet


if (c > d)
x = c;
else
x = d;
Choose the correct option if the code mentioned above is rewritten using the ternary
operator.
(a) x= (c> d)?c : d; (b) x= (c> d)?d : c;
(c) x= (c> d)?c : c; (d) x= (c> d)? d: d;

(x) Give the output of the following


switch(x)
{
case ‘M’ :
System.out.print (“Microsoft
Teams”);
break;
case ‘G’:
System. out.print (“Google Meet”);
default:
System.out.print (“Any Software”);
break;
case ‘W’ :
System.out.print (“Web Ex”);
break;
ICSE 10th Computer Applications Sample Paper 10 Page 3

}
when x = ‘g’
(a) Google Meet (b) Any Software
(c) Google Meet (d) Web Ex
Any Software

(xi) Given array int Z [ ] = {15, 16, 17}; it will occupy _____ bytes in memory.
(a) 3 (b) 12
(c) 24 (d) 64

(xii) A single dimensional array contains N elements What will be the last subscript?
(a) N (b) N – 1
(c) N – 2 (d) N + 1

(xiii) It can have the same access specifiers used for variables and methods.
(a) Method (b) Class
(c) Constructor (d) Object

(xiv) It is a Java program that extends the capabilities of a server and makes web pages dynamic
in nature.
(a) Java applet (b) Java servlet
(c) Package (d) Java Archive

(xv) What will be the output of following code?


String c = “Hello i love java”;
boolean var;
var = c.startsWith (“hello”);
System.out.println (var);
(a) true (b) false
(c) 0 (d) 1

(xvi) Which clause is optional in the switch statement?


(a) default (b) case
(c) switch (d) None of these

(xvii) Assertion (A) next() can read the input only till the space.
Reason (R) next() only gets to the line break.
(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.
ICSE 10th Computer Applications Sample Paper 10 Page 4

(xviii) Read the following text and choose the correct answer:
The Java compiler breaks the line of code into text (words) is called Java tokens. These
are the smallest element of the Java program. The Java compiler identified these words as
tokens. These tokens are separated by the delimiters.
Java tokens help the compiler. Which of the following is a type of Java token?
(a) Identifiers (b) Keywords
(c) Operators (d) All of these

(xix) Assertion (A) Identifier is a name given to a package, class, interface, method or variable.
Reason (R) Identifier allows a programmer to refer to the item from other places in the
program.
(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.

(xx) A string function which removes the blank spaces provided in the prefix and suffix of a
string.
(a) String.trim() (b) String.ltrim()
(c) String.rtrim (d) String.strim

QUESTION 2.

(i) Write code fragment to obtain a temperature value in degree fahrenheit and display it in
celsius. [2]

(ii) The following code has some error(s). Rewrite the correct code and underlining all the
corrections made : [2]
int i=0
do()
{
system.out.println(“i is: ”+i) i++;
}
while i<5

(iii) What will be displayed after the following code is executed? [2]
int m=5;
if(m<10)
{
System.out.println(“m=”+m);
m++;
ICSE 10th Computer Applications Sample Paper 10 Page 5

System.out.println(“++m=”+(++m));
}
else
{
System.out.println(“m”);
m++;
System.out.println(“m”);
}

(iv) Distinguish between compile-time polymorphism and run-time polymorphism. [2]

(v) Manju is studying in Computer class. She got a code to rewrite the following code into
switch case. You also do the same. [2]
if(choice==1)
System.out.print(“First seat”);
else if(choice==2)
System.out.print(“Second seat”);
else if(choice==3)
System.out.print(“Third seat”);
else
System.out.print(“No seat”);

(vi) Given the following code fragment: [2]


int a=15;
System.out.println(a++);
System.out.println(a);
What is the effect of replacing a++ with ++a?
(vii) Find the output of the following Java code snippet : [2]
String city=“Banglore”;
int t=city.length(), CT;
CT=200-t;
System.out.println(Integer.toStri
ng(t));
System.out.println(Integer.toStri
ng(CT));

(viii) Write a statement for each of the following. [2]


(a) Store a number 275 as a string
(b) Convert the string to a numeric value

(ix) Write the Java statement for the following mathematical expression: [2]
3
z = 5x + 2yx + y
ICSE 10th Computer Applications Sample Paper 10 Page 6

(x) Predict the output of the following code. [2]


String str=“0123456789”;
System.out.println(str.substring
(4));

SECTION - B
Attempt any four questions from this section.

QUESTION 3.
Define a class to perform binary search on a list of integers given below, to search for an element
input by the user, if it is found display the element along with its position, otherwise display the
message “Search element not found”. [15]
2, 5, 7, 10, 15, 20, 29, 30, 46, 50

QUESTION 4.
Design a class HotelBooking with the following description : [15]

Class name HotelBooking


Instance variables/Data members
String name To store the name of the customer
String type To store the type of room that customer wants
d o u b l e To store customer’s mobile number
mobno
int amt To store basic amount of room
int totalamt To store the amount to be paid after updating the original amount
Member functions/Methods
void accept() To take input for name, type, mobile number and amount
v o i d To update the amount as per the type selected
update() (extra amount to be added in the amount as follows)
Type of Amount
room
Full_AC 4000
Partial_AC 3000
Cooler 2000
Normal 1000
ICSE 10th Computer Applications Sample Paper 10 Page 7

void display() To display all details of a customer such as name, type, total
amount and mobile number.

Also, define a main() method to create an object of the class and call the above member
methods.

QUESTION 5.
Write a Java program to print the following pattern using switch case. [15]
1
1 2 *
1 2 3 * *
(i) 1 2 3 4 (ii) * * *
1 2 3 * * * *
1 2 * * * * *
1

QUESTION 6.
Write a program to input a number and check whether the number is an automorphic number
or not.
An automorphic number is a number whose square “ends” in the same digits as the number
itself.
e.g. 52 = 25, 62 = 36, 762 = 5776 [15]

QUESTION 7.
Write a program to enter a sentence from the keyboard and count the number of times a
particular word occurs in it. Display the frequency of the search word. [15]
e.g.
Input : Enter the sentence :
Hello.. this is wow world
Enter the word :
wow
Output : Searched word occurs 1 times

QUESTION 8.
Write a Java program for linear search to check, if an element is present in the given list. If it
is found then we print the location at which it occurs, otherwise the list does not contain the
element we are searching. [15]
******

You might also like