CLASS 10 COMPUTER SCIENCE SPECIMEN QUESTION PAPER 2025
Maximum Marks:100
Time allowed: Two hours
Answers to this Paper must be written on the paper provided separately.
You will not be allowed to write during the first 15 minutes.
This time is to be spent in reading the question paper.
The time given at the head of this Paper is the time allowed for writing the answers.
This Paper is divided into two Sections.
Attempt all questions from Section A and any four questions from Section B.
Answers to this Paper must be written on the paper provided separately.
The intended marks for questions or parts of questions are given in brackets[] .
SECTION A
(Attempt all questions from this Section.)
Question 1
(i)
Name the given structure:
(a) One dimensional array
(b) Two Dimensional array with 4 rows and 5 columns
(c) Three dimensional array
(d) Two Dimensional array with 5 rows and 4 columns
View Solution
(ii)
"Java compiled code (byte code) can run on all operating systems"
— Name the feature.
(a) Robust and Secure
(b) Object Oriented
(c) Platform Independent
(d) Multithreaded
View Solution
(iv)
Identify the operator that gets the highest precedence while
evaluating the given expression:
a+b%c*d-e
(a) +
(b) %
(c) -
(d) *
View Solution
(v)
Which of the following is a valid java keyword?
(a) If
(b) BOOLEAN
(c) static
(d) Switch
View Solution
(vi)
The output of the following code is:
System.out.println(Math.ceil(6.4)
+Math.floor(-1-2));
(a) 3.0
(b) 4
(c) 3
(d) 4.0
View Solution
(vii)
Which of the following returns a String?
(a) length()
(b) charAt(int)
(c) replace(char, char)
(d) indexOf(String)
View Solution
(viii)
Which of the following is not true with regards to a switch
statement?
(a) checks for an equality between the input and the case labels
(b) supports floating point constants
(c) break is used to exit from the switch block
(d) case labels are unique
View Solution
(ix)
Consider the array given below:
char ch[]={'A','E','I','O','U'};
Write the output of the following statements:
System.out.println(ch[0]*2);:
(a) 65
(b) 130
(c) 'A'
(d) 0
View Solution
(x)
To execute a loop 10 times, which of the following is correct?
(a) for (int i=11;i<=30;i+=2)
(b) for (int i=11;i<=30;i+=3)
(c) for (int i=11;i< 20;i++)
(d) for (int i=11;i<=21;i++)
View Solution
(xi)
A single dimensional array has 50 elements, which of the following
is the correct statement to initialize the last element to 100.
(a) x[51]=100
(b) x[48]=100
(c) x[49]=100
(d) x[50]=100
View Solution
(xii)
Method prototype for the method compute which accepts two
integer arguments and returns true/false.
(a) void compute (int a, int b)
(b) boolean compute (int a, int b)
(c) Boolean compute (int a,b)
(d) int compute (int a, int b)
View Solution
(xiii)
The statement that brings the control back to the calling method is:
(a) break
(b) System.exit(0)
(c) continue
(d) return
View Solution
(xv)
The method to convert a lowercase character to uppercase is:
(a) String.toUpperCase()
(b) Character.isUppercase (char)
(c) Character.toUpperCase(char)
(d) toUpperCase()
View Solution
(xvi)
Assertion (A): Integer class can be used in the program without
calling a package.
Reason (R): It belongs to the default package java.lang.
(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
View Solution
(xvii)
A student executes the following code to increase the value of a
variable 'x' by 2.
He has written the following statement, which is incorrect.
x=+2;
What will be the correct statement?
A. x+=2;
B. x=2;
C. x=x+2;
(a) Only A
(b) Only C
(c) All the three
(d) Both A and C
View Solution
(xviii)
The statement used to find the total number of Strings present in
the string array String s[] is:
(a) s.length
(b) s.length()
(c) length(s)
(d) len(s)
View Solution
(xix)
Consider the following program segment in which the statements
are jumbled, choose the correct order of statements to swap two
variables using the third variable.
void swap(int a, int b)
{
a=b →(1)
b=t →(2)
int t=0; →(3)
t=a; →(4)
}
(a) (1) (2) (3) (4)
(b) (3) (4) (1) (2)
(c) (1) (3) (4) (2)
(d) (2) (1) (4) (3)
View Solution
(xx)
Assertion(A): An argument is a value that is passed to a method
when it is called.
Reason(R): Variables which are declared in a method
prototype to receive values are called actual
parameters
(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
View Solution
Question 2
(i)
Rewrite the following code using single if statement.
if (code='g")
System.out.println ("GREEN ");
else if (code=="G ")
System.out.println ("GREEN ");
View Solution
(ii)
Evaluate the given expression when the value of a=2 and b=3
b*=a++ - ++b + ++a;
System.out.println ("a= "+a);
System.out.println ("b="+b);
View Solution
(iii)
A student executes the following program segment and gets an
error. Identify the statement which has an error, correct the same
to get the output as WIN.
boolean x = true;
switch(x)
{
case 1: System.out.println("WIN");
break;
case 2: System.out.println("LOOSE");
}
View Solution
(v)
How many times will the following loop execute? Write the
output of the code:
int x=10;
while (true)
{
System.out.println (x++ * 2);
if (x%3==0)
break;
}
View Solution
(vi)
Write the output of the following String methods:
String x= "Galaxy ", y= "Games ";
(a) System.out.println (x.charAt(0)==y.charAt(0));
(b) System.out.println (x.compareTo(y));
View Solution
(vii)
Predict the output of the following code snippet:
char ch='B';
char chr= Character.toLowerCase(ch);
int n=(int) chr-10;
System.out.println((char)n+"\t"+chr);
View Solution
(viii)
A student is trying to convert the string present in x to a numerical
value, so that he can find the square root of the converted value,
However the code has an error. Name the error (syntax / logical /
runtime). Correct the code so that it compiles and runs correctly.
String x="25";
int y=Double.parseDouble (x);
double r=Math.sqrt (y);
System.out.println (r);
View Solution
(ix)
Consider the following program segment and answer the questions 21
below:
class calculate
{
int a; double b;
calculate()
{
a=0;
b=0.0;
}
calculate(int x, double y)
{
a=x;
b=y;
}
void sum()
{
System.out.println(a*b);
}}
System.out.println(a*b);
Name the type of constructors used in the above program segment?
View Solution
(x)
Consider the following program segment and answer the
questions given below:
int x[][]={{2,4,5,6}, {5,7,8,1}, {34, 1,10, 9}};
(a) What is the position of 34?
(b) What is the result of x[2][3] + x[1][2]?
View Solution
SECTION B
(Answer any four questions from this Section.)
The answers in this section should consist of the programs in either BlueJ environment or any
program environment with java as the base.
Each program should be written using variable description / mnemonic codes so that the logic of the
program is clearly depicted.
Flowcharts and algorithms are not required.
Question 3
Define a class with the following specifications:
Class name: Bank
Member variables:
double p — stores the principal amount
double n - stores the time period in years
double r — stores the rate of interest
double a — stores the amount
Member methods:
void accept () — input values for p and n using Scanner class methods
only.
void calculate () — calculate the amount based on the following conditions:
Time in (Years) Rate %
Upto ½ 9
> ½ to 1 year 10
> 1 to 3 years 11
> 3 years 12
void display () — display the details in the given format.
Principal Time Rate Amount
XXX XXX XXX XXX
Write the main method to create an object and call the above methods.
View Solution
Question 4
Define a class to search for a value input by the user from the list of values
given below. If it is found display the message "Search successful", otherwise
display the message "Search element not found” using Binary search
technique.
5.6,11.5,20.8,35.4,43.1, 52.4, 66.6, 78.9, 80.0, 95.5.
View Solution
Question 5
Define a class to accept a string and convert the same to uppercase, create
and display the new string by replacing each vowel by immediate next
character and every consonant by the previous character. The other characters
remain the same.
Example: Input : #IMAGINATION@2024
Output : #JLBFIMBSIPM@2024
View Solution
Question 6
Define a class to accept values into 4x4 array and find and display the sum of
each row.
Example:
A[][]={1,2,3,4},{5,6,7,8},{1,3,5,7},{2,5,3,1}}
Output:
sum of row 1 =10 (1+2+3+4)
sum of row 2= 26 (5+6+7+8)
sum of row 3=16 (1+3+5+7)
sum of row 4= 11 (2+5+3+1)
View Solution
Question 7
Define a class to accept a number and check whether it is a SUPERSPY
number or not. A number is called SUPERSPY if the sum of the digits equals
the number of the digits.
Example l:
Input: 1021
output: SUPERSPY number [SUM OF THE DIGITS = 1+0+2+1 =4,
NUMBER OF DIGITS =4 ]
Example 2:
Input: 125
output: Not an SUPERSPY number [1+2+5 is not equal to 3]
View Solution
Question 8
Define a class to overload the method display() as follows:
void display(): To print the following format using nested loop.
12121
12121
12121
void display (int n, int m) : To print the quotient of the division of m and n if
m is greater than n otherwise print the sum of twice n and thrice m.
double display (double a, double b, double c) — to print the value of z where
z=pxq
p=(a+b)/c
q=a+b+c
View Solution
(i)
Name the given structure:
(a) One dimensional array
(b) Two Dimensional array with 4 rows and 5 columns
(c) Three dimensional array
(d) Two Dimensional array with 5 rows and 4 columns
View Solution
(ii)
"Java compiled code (byte code) can run on all operating systems"
— Name the feature.
(a) Robust and Secure
(b) Object Oriented
(c) Platform Independent
(d) Multithreaded
View Solution
(iv)
Identify the operator that gets the highest precedence while
evaluating the given expression:
a+b%c*d-e
(a) +
(b) %
(c) -
(d) *
View Solution
(v)
Which of the following is a valid java keyword?
(a) If
(b) BOOLEAN
(c) static
(d) Switch
View Solution
(vi)
The output of the following code is:
System.out.println(Math.ceil(6.4)
+Math.floor(-1-2));
(a) 3.0
(b) 4
(c) 3
(d) 4.0
View Solution
(vii)
Which of the following returns a String?
(a) length()
(b) charAt(int)
(c) replace(char, char)
(d) indexOf(String)
View Solution
(viii)
Which of the following is not true with regards to a switch
statement?
(a) checks for an equality between the input and the case labels
(b) supports floating point constants
(c) break is used to exit from the switch block
(d) case labels are unique
View Solution
(ix)
Consider the array given below:
char ch[]={'A','E','I','O','U'};
Write the output of the following statements:
System.out.println(ch[0]*2);:
(a) 65
(b) 130
(c) 'A'
(d) 0
View Solution
(x)
To execute a loop 10 times, which of the following is correct?
(a) for (int i=11;i<=30;i+=2)
(b) for (int i=11;i<=30;i+=3)
(c) for (int i=11;i< 20;i++)
(d) for (int i=11;i<=21;i++)
View Solution
(xi)
A single dimensional array has 50 elements, which of the following
is the correct statement to initialize the last element to 100.
(a) x[51]=100
(b) x[48]=100
(c) x[49]=100
(d) x[50]=100
View Solution
(xii)
Method prototype for the method compute which accepts two
integer arguments and returns true/false.
(a) void compute (int a, int b)
(b) boolean compute (int a, int b)
(c) Boolean compute (int a,b)
(d) int compute (int a, int b)
View Solution
(xiii)
The statement that brings the control back to the calling method is:
(a) break
(b) System.exit(0)
(c) continue
(d) return
View Solution
(xv)
The method to convert a lowercase character to uppercase is:
(a) String.toUpperCase()
(b) Character.isUppercase (char)
(c) Character.toUpperCase(char)
(d) toUpperCase()
View Solution
(xvi)
Assertion (A): Integer class can be used in the program without
calling a package.
Reason (R): It belongs to the default package java.lang.
(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
View Solution
(xvii)
A student executes the following code to increase the value of a
variable 'x' by 2.
He has written the following statement, which is incorrect.
x=+2;
What will be the correct statement?
A. x+=2;
B. x=2;
C. x=x+2;
(a) Only A
(b) Only C
(c) All the three
(d) Both A and C
View Solution
(xviii)
The statement used to find the total number of Strings present in
the string array String s[] is:
(a) s.length
(b) s.length()
(c) length(s)
(d) len(s)
View Solution
(xix)
Consider the following program segment in which the statements
are jumbled, choose the correct order of statements to swap two
variables using the third variable.
void swap(int a, int b)
{
a=b →(1)
b=t →(2)
int t=0; →(3)
t=a; →(4)
}
(a) (1) (2) (3) (4)
(b) (3) (4) (1) (2)
(c) (1) (3) (4) (2)
(d) (2) (1) (4) (3)
View Solution
(xx)
Assertion(A): An argument is a value that is passed to a method
when it is called.
Reason(R): Variables which are declared in a method
prototype to receive values are called actual
parameters
(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
View Solution
(i)
Rewrite the following code using single if statement.
if (code='g")
System.out.println ("GREEN ");
else if (code=="G ")
System.out.println ("GREEN ");
View Solution
(ii)
Evaluate the given expression when the value of a=2 and b=3
b*=a++ - ++b + ++a;
System.out.println ("a= "+a);
System.out.println ("b="+b);
View Solution
(iii)
A student executes the following program segment and gets an
error. Identify the statement which has an error, correct the same
to get the output as WIN.
boolean x = true;
switch(x)
{
case 1: System.out.println("WIN");
break;
case 2: System.out.println("LOOSE");
}
View Solution
(v)
How many times will the following loop execute? Write the
output of the code:
int x=10;
while (true)
{
System.out.println (x++ * 2);
if (x%3==0)
break;
}
View Solution
(vi)
Write the output of the following String methods:
String x= "Galaxy ", y= "Games ";
(a) System.out.println (x.charAt(0)==y.charAt(0));
(b) System.out.println (x.compareTo(y));
View Solution
(vii)
Predict the output of the following code snippet:
char ch='B';
char chr= Character.toLowerCase(ch);
int n=(int) chr-10;
System.out.println((char)n+"\t"+chr);
View Solution
(viii)
A student is trying to convert the string present in x to a numerical
value, so that he can find the square root of the converted value,
However the code has an error. Name the error (syntax / logical /
runtime). Correct the code so that it compiles and runs correctly.
String x="25";
int y=Double.parseDouble (x);
double r=Math.sqrt (y);
System.out.println (r);
View Solution
(ix)
Consider the following program segment and answer the questions 21
below:
class calculate
{
int a; double b;
calculate()
{
a=0;
b=0.0;
}
calculate(int x, double y)
{
a=x;
b=y;
}
void sum()
{
System.out.println(a*b);
}}
System.out.println(a*b);
Name the type of constructors used in the above program segment?
View Solution
(x)
Consider the following program segment and answer the
questions given below:
int x[][]={{2,4,5,6}, {5,7,8,1}, {34, 1,10, 9}};
(a) What is the position of 34?
(b) What is the result of x[2][3] + x[1][2]?
View Solution
(Answer any four questions from this Section.)
The answers in this section should consist of the programs in either BlueJ environment or any
program environment with java as the base.
Each program should be written using variable description / mnemonic codes so that the logic of the
program is clearly depicted.
Flowcharts and algorithms are not required.
Define a class with the following specifications:
Class name: Bank
Member variables:
double p — stores the principal amount
double n - stores the time period in years
double r — stores the rate of interest
double a — stores the amount
Member methods:
void accept () — input values for p and n using Scanner class methods
only.
void calculate () — calculate the amount based on the following conditions:
Time in (Years) Rate %
Upto ½ 9
> ½ to 1 year 10
> 1 to 3 years 11
> 3 years 12
void display () — display the details in the given format.
Principal Time Rate Amount
XXX XXX XXX XXX
Write the main method to create an object and call the above methods.
View Solution
Define a class to search for a value input by the user from the list of values
given below. If it is found display the message "Search successful", otherwise
display the message "Search element not found” using Binary search
technique.
5.6,11.5,20.8,35.4,43.1, 52.4, 66.6, 78.9, 80.0, 95.5.
View Solution
Define a class to accept a string and convert the same to uppercase, create
and display the new string by replacing each vowel by immediate next
character and every consonant by the previous character. The other characters
remain the same.
Example: Input : #IMAGINATION@2024
Output : #JLBFIMBSIPM@2024
View Solution
Define a class to accept values into 4x4 array and find and display the sum of
each row.
Example:
A[][]={1,2,3,4},{5,6,7,8},{1,3,5,7},{2,5,3,1}}
Output:
sum of row 1 =10 (1+2+3+4)
sum of row 2= 26 (5+6+7+8)
sum of row 3=16 (1+3+5+7)
sum of row 4= 11 (2+5+3+1)
View Solution
Define a class to accept a number and check whether it is a SUPERSPY
number or not. A number is called SUPERSPY if the sum of the digits equals
the number of the digits.
Example l:
Input: 1021
output: SUPERSPY number [SUM OF THE DIGITS = 1+0+2+1 =4,
NUMBER OF DIGITS =4 ]
Example 2:
Input: 125
output: Not an SUPERSPY number [1+2+5 is not equal to 3]
View Solution
Define a class to overload the method display() as follows:
void display(): To print the following format using nested loop.
12121
12121
12121
void display (int n, int m) : To print the quotient of the division of m and n if
m is greater than n otherwise print the sum of twice n and thrice m.
double display (double a, double b, double c) — to print the value of z where
z=pxq
p=(a+b)/c
q=a+b+c
View Solution