KARNATAKA ICSE SCHOOLS ASSOCIATION
ICSE STD. X
Preparatory Examination 2024
Subject: Computer Applications
Maximum Marks: 100
Time Allowed: 2 hours Date: 24.01.2024
Maximum Marks: 100
Time
Ansuers tothis Paper must beallowed:
writen
Tirohours
on
You willnot be allowed to wTite the paper provided separately.
Thistime is to bc spent in during the first 15 mnutes.
The te given at the head ol has rcading the qucstion paper.
Paper is the tine allowed for writing the answers.
This Paper is div7ded into vo
Attempt all questiOns from Secion A and any fourSections.
questions from SectionB.
The intended marks for questions or parts oft
questions are given in brackets/|
SECTION A
(Attempt all questions from this Section.)
Question 1
[10]
Choose the correct answers to the questions from the given options.
(Do not copy the question, write the correct answers only.)
i. When a class serves as base class for many derived classes, the situation
is called
a. Polymorphism b. Encapsulation
e Inheritance d. Abstraction
ii. The expression which uses the && operator is known as
aRelational b. Logical c. Arithmetic d. Assignment
iii. iii. Precedence of shorthand operator is than Unary operator
Higher b. Lower c. Equal d. Not related
iv. When the object of a wrapper class is assigned to primitive type
variable,
the object is automatically converted to the primitive type is called as
gUnboxing b. Boxing c. Implicit Conversion d. Inheritance
v. How many bytes are allocated for the array al] if int a [l = new int (41:
a. 40 bytes b. 16 bytes c. 20 bytes d. 32 bytes
vi. The wrapper class of char type is
a. character b. Chracter Character d. Char
Page 1of 6
KARNATAKA ICSE ASSOCIATION
ICSE STD. X Preparatory Examination 2024SCHOOLS
Subject: Computer Applications Date: 24.01.2024
Maximum Marks: 100
Time Allowed: 2 hours
vii. The output of 1.ceil(Math. min(-4.3,-7.8);is
g7.0 System.out.print( Math.
b. -8.0 C. 7 d.6
vi, Which of the following is not a token?
Byte code b. identifiers d. operators
c. literals
ix. Name the type of error in the following statement
System.out.println(10/0);
a. Syntax error b. Logical error
Runtime error d. No error
X. The size of the array al ]={3,8,2, 1,12, 11,13} is
a. 6 C. 9 d. 8
b7
xi. The output of the given statements is
String a = "Success", b = "Happiness";
boolean h= a.substring(4).equals(b.substring(6));
a. esS b. ness E. true dfalse
xii. compiles the Java source code into byte code
a. Virtual machine bjava interpreter
C. JVM compiler d. object code
xiii. The java statement to access the 5th character in the string str is:
a. str.indexOf(i) A. str.charAt(4)
C.str.substring(5) d. str.length)
xiv. A method prototype which has function name display() which takes two
characters as input and an integer number as a return type is
a. void display(int a ,int b) b. int display (int a ,int b)
e fnt display(char a ,char b) d. char display(int a ,int b)
xv. The method compareTo) returns when two strings are equal
and in lowercase :
b. 0 C. 1 d. false
xiv. Which of the following is a valid String constant?
a. true b. false' C. false A."true"
xvii. The output of the following snippet is
System.out.print("Output is ");
for(int m=5;m<=50;m+=5)
if(m%6==0)
KARNATAKA ICSE SCHOOLS ASSOCIATION
ICSE STD. X
Preparatory Examination 2024
Subject: Computer Applications
Maximum Marks: 100 Time Allowed: 2 hours Date: 24.01,2024
else
if(m%3=-0)
System.out.println(m);
a. Output is 15 b. 16 35
c. Output is 15
45
d, 45 15
Xvii. ASsertion (A): A loop that in which there is no
statement associated in
its body is called as an infinite loop.
Reason(R): In the infinite loop the test condition will always be true.
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
xix. Read the following text and choose the correct answer
Aconstructor is a special member function used to initialise the data
members whenever an object is created for the class. The different types of
Constructors are
Default constructor
Parameterised constructor
How do we invoke a constructor in the program?
a. We should create a separate method with the return type as void
bWhen an object is created the constructor is invoked
c. The method call should be initialsed to a data type.
d. Apure function needs to be created to call the constructor
XX. Assertion (A): When you pass an object as an argument to a function, it
is called as pass by reference.
Reason(R):The_reference of an object is passed as parameter and not the
value of the argument.
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)
E. Assertion (A) is true and Reason (R) is false
d. Assertion (A) is false and Reason (R) is true
Page 3 of 6
KARNATAKA ICSE SCHOOLS ASSOCIATION
ICSE STD. X Preparatory Examination 2024
Subject: Computer Applications
Maximum Marks: 100 Time Allowed: 2 hours Date: 24.01.2024
hJ, 2) ,
Question 2 CHath powla+
Malh c
i. Write the java expression for/(a+ b)? (2]
i.Evaluate the expression when the value of p=5 (2]
p*=++p + --p/++p +p;
ii. The following code segment should add the fifth and eight elements of the
array and displays the answer as 56. However, the code has errors. Fix the
code so that it compiles and runs correctly. (2]
int sl]-(2,22,3,32,4,42:5,52};
ifs|3]%2==0)
int sum=s[5]+s[7] ;
System.out.println(sum);
iv. John executes the following line of the program
will be a floating-point value, but he expects to get
and the answer displayed
the answer as 0. Name
the error and how can the given statement be
modified.
System.out.println(Math.sqrt(2)/10); math s t f. lo
[2]
v. How many times will the loop be
int a=12010;int d; executed? What will be the output? [2]
2
while(a>0)
d=a%100;
ift+d/3==0)
break;
a
(26
else
a=a/ 1000;
System.out.println(d);
vi. What will be the
a. output of the following string methods?
System.out.println("All the
Best".length)/2); s
b. System.out.printin("Acquatic".equalslgnoreCase("ACQUATIC"); [2]
vii, Differentiate between actual and formal
vii. Predict the output of the
parameters. [2]
String s="123.45"; following: 91
int x=Integer.parselnt(s.substring(0,3); (2]
float y-Float.parseFloat(s.substring(3);
ASSOCIATION
KARNATAKAICSE SCHOOLS
Preparatory Examination 2024
ICSE STD. XSubject: Computer Applications
Date: 24.01.2024
Maximum Marks: 100
Time Allowed: 2 hours
)
pow(at bJ, 2
(Math
Question 2 Melh end [21
for/(a + b)2
i. Write the java expression
value of p=5
[2]
ii. Evaluate the expression when the
p*=++p t --p/++p tp;
the
code segment should add the fifth and eight elements of
iii. The following 56. However, the code has
errors. Fix the
as
array and displays the answer [2]
code so that it compiles and runs correctly.
int sl]=(2,22,3,32,4,42;5,52};
if(s|3]%2=-0)
int sum=s[5]+s[7];
System.out.println(sum);
program and the answer displayed
iv. John executes the following line of the
to get the ansSwer as 0. Name
will be a floating-point value, but he expects modified.
statement be
the error and how can the given [2]
System.out.println(Math. sqrt(2) /10);
math. sqt . |o
will be the output? [2]
v. How many times will the loop be executed? What 2
int a= 12010:int d:
while(a>0)
d=a%100;
if(++d/3==0)
break;
else 2090
a=a/1000;
System.out.printin(d);
vi. What will be the output of the following string methods? [2]
a. System.out.printin("All the Best".length()/2); s
b. System.out.println("Acquatic".equalslgnore Case("ACQUATIC");
vii. Differentiate between actual and formal parameters. S -9 o
[2]
q1
viii. Predict the output of the following: (2]
String s="123.45";
int x=Integer.parselnt(s.substring(0,3);
loat y-Float.parseFloat(s.substring(3));
System.out.printin(xty);
KARNATAKAICSE SCHOOLS ASSOCIATION
ICSE STD. X
Preparatory Examination 2024
Subject: Computer Applications
Maximum Marks: 100
Time Allowed: 2 hours Date: 24.01.2024
ix. Name the following:
a. The return type of
b. Aprinciple of OOP,compareTo function
which allows a method to be used for
purposes. multiple
m
x. Give the output of the following
code-snippet:
double zl]=98:4.3,23.Q.4'5; (2]
System.out.printin(Math.pow(z|1]+z[3),2):
System.out.printin(z. length);
SECTION B
(Answer any four questions from this Section,)
Theanswvers in this section should consisl of theprograns in either Blue/ environment or any
progran envioment with javaas the base.
Each program should be vritten using variable description /mnemonic codes so that the logic
of the program is clearly depicted.
Flowcharts and algorithms are not required
Question 3 [15]
Design a class named Bill, which will contain the following members:
Data Members:
units,amt of int data type.
Member Functions: 2 o ).S
Parameterised constructor to initialise units.
void showl) to display the contents of units andamt.
void compute(int u ):calculate the electricity bill with the help of the below 201:S
mentioned charges: Zos.o
1to 100 units - Rs.10/unit
100to 200 units - Rs.15/unit
200 to 300units - Rs.20/unit
above 300 units Rs.25/unit
In the main() create an object and initialise u with any value and calculate
amt by invoking the compute()function and display the contents of Uan
amt using show() function.
KARNATAKA ICSE SCHOOLS ASSOCIATION
ICSE STD. X Preparatory Examination 2024
Subject: Computer Applications
Maximum Marks: 100 Time Allowed: 2 hours Date: 24.01.2024
Question 4 [15]
Write a program to input height of 10 Students in feet ( like 5.8, 6.1, ...] in
a single dimensional array. Sort the heights in ascending order, using
bubble sort technique and display the sorted array.
Question 5 [15]
into uppercase. Replace all
Write a program toaccept a string and convert it
display the new string.
the vowels in the string with the character #' and
[15]
Question 6
the following tasks:
Write a program to overload the function display() for
function void patern (char ch,int
1) To display the following pattern using the character to be printed.
n) wheren is the number of lines and ch is the
7***k
ii) To display the sum of the following series
S=a' + at + ao + ....+n terms
[15]
Question 7 number or
and check if it's a Peterson
Write a program to accept a number
not.
A number is said to be Peterson if
the sum of factorials of each digit is
number itself.
equal to the sum of the
For example:
Input:Enter a number=145
Output=1!+4!+5!=145
Question 8
(15]
array and find the sum of all the
Define a class to accept values into a 3x3
odd numbers in the array.
Example:
{5,3, 2), {4, 2, 5};
Input: Al-{4,5, 6},numbers=5+5+3+5=18
Output: Sum of odd