0% found this document useful (0 votes)
61 views9 pages

26 - Grade 10 UT2 Revision Worksheet - CA 2

This document is a revision worksheet for a Computer Application unit test for Grade X, covering various programming concepts and Java-related questions. It includes multiple-choice questions, programming exercises, and explanations of Java syntax and logic. The worksheet is divided into two sections, with Section A focusing on direct questions and Section B requiring more detailed programming tasks.

Uploaded by

welcome21home20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views9 pages

26 - Grade 10 UT2 Revision Worksheet - CA 2

This document is a revision worksheet for a Computer Application unit test for Grade X, covering various programming concepts and Java-related questions. It includes multiple-choice questions, programming exercises, and explanations of Java syntax and logic. The worksheet is divided into two sections, with Section A focusing on direct questions and Section B requiring more detailed programming tasks.

Uploaded by

welcome21home20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Computer Application

Unit Test 2 Revision Worksheet ,2025-26


GRADE:X
________________________________________________________________________
SECTION A
Attempt all questions from this Section

Question 1
Choose the correct answers to the questions from the given options.
(Do not copy the question, write the correct answer only.)

i) The keyword used to call package in the program:


(a) extends
(b) export
(c) import
(d) package

ii) What value will [Link] ([Link] (15.3)) return?


(a) 16.0
(b) 16
(c) 4.0
(d) 5.0

iii) The Scanner class method used to accept words with space:
(a) next()
(b) nextLine()
(c) Next()

ICSE This Paper consists of 4 printed pages Turn over


(d) nextString()

iv) The access modifier that gives most accessibility is:


(a) private
(b) public
(c) protected
(d) package

v) int x = (int) 32.8; is an example of __________ typecasting.


(a) implicit
(b) automatic
(c) explicit
(d) coercion
vi) Consider the following program segment and select the output of the same
when n = 10 :
switch(n)
{
case 10 : [Link](n*2);
case 4 : [Link](n*4);
break;
default : [Link](n);
}
(a) 20
40
(b) 10 4
(c) 20, 40
(d) 10
10

vii) Which of these cannot be used for a variable name in Java?


a) identifier & keyword
b) identifier
c) keyword
d) none of the mentioned

viii) What does the expression float a = 35 / 0 return?


a. 0
b. Not a Number
c. Infinity
d. Run time exception

ix) Which operator cannot be used with if-else statement?

ICSE 2
1. <=
2. ||
3. &&
4. ?:

x) Name the typ of error, if any in the following statement:


[Link]("HELLO")
(a) logical
(b) no error
(c) runtime
(d) syntax

Question 2:
i) Write a Java expression for the following:
|a+b| / √a2 – b2
[Link](a+b)/[Link](a*a-b*b)
ii) Evaluate the following if the value of x=7, y=5
x+=x++ + x + ++y
28
iii) Give the output of the following program segment and mention how many times the loop will
execute:
int k;
for ( k = 8 ; k < = 20 ; k + = 7 )
if ( k% 6==0 )
continue;
[Link] ( k );

22

iv) Give the output of the following:


(a) [Link](4.2 ) + [Link] (7.9)
11.0

v) Write the statements to access the scanner class in JAVA.


[Link].*;

vi) What is the use of import statement in Java?


Answer:
An import statement tells the compiler the path of a class or the entire package.
ICSE 3 Turn over
vii) Write the return data type of the following functions:
(i) [Link]()
(ii) [Link]( )
Answer : Double

viii) Rewrite the following program segment using logical AND operators:
if ( x > 5 )
if ( x > y )
[Link] (x+y);
Answer
If((x>5 ) && (x>y))
[Link] (x+y);

ix) int res = 'E';


What is the value of res?
Ans=69

x) State the difference between while and do while loop


The main difference between the two loops is that the while loop checks the condition
before the execution of the statement(s) whereas the do-while loop ensures that the
statement(s) are executed at least once before evaluating the condition. While loop is entry-
controlled and Do-while is exit controlled

SECTION B
Attempt any Three questions from this Section.

Question 3:
Design a class to overload a function polygon() as follows:

void polygon(int n, char ch) — with one integer and one character type argument to draw a filled
square of side n using the character stored in ch.
void polygon(int x, int y) — with two integer arguments that draws a filled rectangle of length x
and breadth y, using the symbol '@'.
void polygon() — with no argument that draws a filled triangle shown below:
Example:

Input value of n=2, ch = 'O'

ICSE 4
Output:
OO
OO
Input value of x = 2, y = 5
Output:
@@@@@
@@@@@
Output:
*
**
***
Answer

public class Polygon


{
public void polygon(int n, char ch) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
[Link](ch);
}
[Link]();
}
}

public void polygon(int x, int y) {


for (int i = 1; i <= x; i++) {
for (int j = 1; j <= y; j++) {
[Link]('@');
}
[Link]();
}
ICSE 3 Turn over
}

public void polygon() {


for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= i; j++) {
[Link]('*');
}
[Link]();
}
}

public static void main(String args[]) {


Polygon obj = new Polygon();
[Link](2, 'o');
[Link]();
[Link](2, 5);
[Link]();
[Link]();
}
}
Question 4:
Write a java program to accept a number from the user and check if it is an EvenPal number or
not .
(A number is said to be EvenPal number when number is palindrome number(a number is said to
be palindrome number if it is equal to its reverse) and sum of its digits is an even number)
Example : 121 -------- is a palindrome number
Sum of its digit 1+2+1 = 4 which is an even number.

Answer:
import [Link].*;
public class Evenpal
{

public static void main(String args[])


{

ICSE 6
int n,rev=0,sum=0,d,n1;
Scanner ob=new Scanner([Link]);
[Link]("Enter the number:");
n = [Link]();
n1=n;
while(n!=0)
{
d=n%10;
rev=rev*10+d;
sum=sum+d;
n=n/10;
}

if((n1==rev) && (sum%2==0))


{
[Link]("Even pal");
}
else
[Link]("Not Even pal");

}
}
Question 5:
Write a java program To find and display the sum of the series given below:
s = 𝑥 1 − 𝑥 2 + 𝑥 3 − 𝑥 4 + 𝑥 5 . . . . . . . . . . . . . . . .. − 𝑥 20 (where x = 2)

Answer
import [Link];

public class SeriesMenu


{
public static void main(String args[]) {
Scanner in = new Scanner([Link]);
[Link]("1. Sum of the series");
int sum = 0;
for (int i = 1; i <= 20; i++)
{
int term = (int)[Link](2, i);
if (i % 2 == 0)
sum - = term;
ICSE 3 Turn over
else
sum + = term;
}
[Link]("Sum=" + sum);

Question 6:
A Pre-Paid taxi charges from the passenger as per the tariff given below:

Write a program to input the distance covered and calculate the amount paid by the passenger.
The program displays the printed bill with the details given below:
Taxi No. :
Distance covered :
Amount :

Distance Rate

Up to 5 km ₹ 100

For the next 10 km ₹ 10/km

For the next 10 km ₹ 8/km

More than 25 km ₹ 5/km

Answer:

import [Link];

public class PrePaidTaxi


{
public static void main(String args[]) {
Scanner in = new Scanner([Link]);

[Link]("Enter Taxi Number: ");

ICSE 8
String taxiNo = [Link]();
[Link]("Enter distance travelled: ");
int dist = [Link]();

int fare = 0;
if (dist <= 5)
fare = 100;
else if (dist <= 15)
fare = 100 + (dist - 5) * 10;
else if (dist <= 25)
fare = 100 + 100 + (dist - 15) * 8;
else
fare = 100 + 100 + 80 + (dist - 25) * 5;

[Link]("Taxi No: " + taxiNo);


[Link]("Distance covered: " + dist);
[Link]("Amount: " + fare);

}
}

ICSE 3 Turn over

You might also like