Code is copied!
CLASS 10 COMPUTER SCIENCE SPECIMEN PAPER 2022-2023
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)
Wrapping up of data and methods together as one unit is termed as:
- Inheritance
- Polymorphism
- Encapsulation
- Abstraction
(ii)
The datatype which is specified that the method does not return a value is:
- Void
- void
- VOID
- boolean
(vi)
The correct if statement for the following ternary operation statement is:
System.out.println(n%2 == 0? “true”:” false”);
-
if(n%2==0)
return true;
else
return false;
-
if(n%2==0)
return “true”;
else
return “false”;
-
if(n%2==0)
System.out.printIn(“true”);
else
System.out.println(“false”);
-
if(n%2==0)
return false;
else
return false;
return true;
else return false;
return “true”;
else
return “false”;
System.out.printIn(“true”);
else
System.out.println(“false”);
return false;
else
return false;
(viii)
The number of bytes occupied by the constant 45 are:
- Four bytes
- two bytes
- Eight bytes
- one byte
(ix)
do.....while loop is an
- entry controlled loop
- infinite loop
- exit controlled loop
- Finite loop
(x)
for(k=1;k<=2;k++)
{ for(m=1;m<=4;m++)
{ System.out.println(m*2);
}
}
How many times the inner loop is executed?
- 4 times
- 8 times
- 2 times
- 16 times
(xi)
A method with the same name as of the class and with arguments and no return
data type is termed as:
- parameterized constructor
- default constructor
- Non -parameterized constructor
- wrapper class method
(xiii)
The style of expressing single line comment is:
- /* comment*/
- * comment
- // comment
- /* comment
(xiv)
The method to check if a character is an alphabet or not is:
- isLetter(char)
- isAlpha(char)
- isUppercase(char)
- isLowercase(char)
(xvi)
The method to convert a string to upper case is:
- toUpperCase(char)
- toUPPERCASE(String)
- toUpperCase(String)
- touppercase(String)
(xvii)
The output of the method “DETERMINATION” substring(2, 6) is:
- “TERM”
- term
- “Term”
- “TERMI”
(xix)
The element in x[4] of the array {3, 5, 7, 12, 16, 18, 20, 35, 42, 89} is:
- 16
- 12
- 7
- 18
(xx)
Name the type of error that occurs for the following statement:
System.out.printIn(Math.sqrt(24 - 25));
- Syntax error
- runtime error
- logical error
- no error
(iv)
Rewrite the following while loop using for loop:
int x = 5;
while (x <= 5)
{
x++;
}
System.out.println(x);
(v)
How many times the following loop will gets executed? What is the output of
the same?
int counter=1;
do
{
System.out.printIn(counter);
} while ( counter ++ < 5 );
(ix)
Consider the following program and answer the questions given below:
class sample
{ int a, b;
sample(int x, int y)
{ a=x,b=y;
}
void calculate()
{ int Z;
Z=atb;
System.out.println(z);
}
}
(a) Name the global variables.
(b) What are the method variables?
(x)
Consider the following array and answer the questions given below:
int x [ ] = {23, 45, 67, 12, 45, 89, 24, 12, 9, 7}
(a) What is the size of the array?
(b) What is the position of 89?
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.
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: employee
Member variables:
eno — employee number
ename — name of the employee
age — age of the employee
basic — basic salary
[Declare the variables using appropriate data types]
Member methods:
void accept() — accept the details using scanner class
void calculate ()— to calculate the net salary as per the given specifications:
net = basic + hra + da — pf
hra = 18.5% of basic
da = 17.45% of basic
pf = 8.10% of basic
if the age of the employee is above 50 he/she gets an additional allowance of Rs.5000.
void print() — to print the details as per the following format
eno ename age basic net
void main() — to create an object of the class and invoke the methods
Question 4
Define a class to overload the method print as follows:
void print () — to print the format
1
2 3
4 5 6
7 8 9 10
boolean print (int n) — to check whether the number is a Dudeney number ,a number is dudeney if the cube of the sum of the digits is equal to the number itself.
Eg : 512 = (5+1+2)3 =(8)3 = 512
void print (int a, char ch) — if ch = s or S print the square of the number else if ch =c or C print the cube of the number.
Define a class to accept 10 integers and arrange them in descending order using bubble sort. Print the original array and the sorted array.
Define a class to accept values into a double array of size 20 and print the range of the array, range is the difference between the largest and the smallest elements of the array.
Define a class to accept a string and print the same in reverse, also print the number of vowels in the string.
Eg :S =“BEAUTIFUL”
Output — “LUFITUAEB”
No. of vowels = 5
Eg :S =“BEAUTIFUL”
Output — “LUFITUAEB”
No. of vowels = 5