Grade 10 Computer Applications Assessment
Grade 10 Computer Applications Assessment
PRELIMINARY ASSESSMENT
COMPUTER APPLICATIONS
Grade : 10 Max. Marks : 100
Date : 14.01.2025 No. of Questions : 08
Duration : 2 hours No. of Printed side : 09
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.
The intended marks for questions or parts of questions are given in brackets[ ].
________________________________________________________________________________
SECTION A
(Attempt all questions from this Section)
Question 1 [20]
Choose the correct answers to the questions from the given options.
(Do not copy the question, write the correct answer only.)
(i)
1
(iii) The method that does not have any parameters:
(a) floor()
(b) random()
(c) round()
(d) min()
(a) Program written in Java is the source code with .java as its file name
extension.
(b) Java byte code is also called an object code.
(c) Java byte code is the code obtained after the compilation process.
(d) JVM is the interpreter which converts Java byte code into machine
language.
(v) [Link]("click".lastIndexOf('c')+"arch".indexOf('C'));
will print:
(a) 3
(b) 2
(c) 5
(d) 0
(a) true
(b) false
(c) error
(d) 2
2
(ix) Choose the correct option about method overloading in Java:
(a) overloaded methods must have same name and different signatures.
(b) overloaded methods must be defined in a certain order.
(c) overloaded methods must be void.
(d) Method overloading implements encapsulation feature.
(xi) Accepting a character value from user and assigning it to variable x using the
Scanner class object named sc:
(a) char x= [Link](0);
(b) char x= [Link]().(0);
(c) char x=[Link]().substring(0,1);
(d) char x=[Link]().charAt(0);
(xiii) The loop which checks the condition at the end of every iteration:
(a) exit-controlled loop
(b) entry-controlled loop
(c) time delay loop
(d) infinite loop
3
(xvi) String z="16.5";
double r=[Link](z);
[Link](z+5);
[Link](r+5);
(a) 16.55
21.5
(b) 21
21
(c) 17
21.5
(d) 1655
215
4
(xviii) When an object of a Wrapper class is converted to its corresponding
primitive data type, it is called as:
(a) Boxing
(b) Unboxing
(c) Explicit conversion
(d) Implicit conversion
(xix) The resultant values of individual brackets and the final answer, if a=1:
(a++ < a++) && ([Link](3,a)==3)
(a) true && false, false
(b) false && false, false
(c) false && true, false
(d) true && true, true
Question 2 [20]
(i) Rewrite the following code using the ternary operator and the resultant
value of ans variable : [2]
double r=9.2,s=9.8,ans;
if([Link](r)>s)
ans =r;
else
ans=s;
(ii) Given that, x=3 and y=4 evaluate the following expression to find x:
x *= x-y++ + x/y; [2]
5
(iii) Read the following code snippet and answer the questions below: [2]
String s="Achieve ";
int a=[Link]('e');
switch(a)
{
case 2: [Link]([Link]("Confidence"));break;
case 4: [Link]([Link]("Success"));break;
case 0: [Link]([Link]("Growth"));break;
case 8: [Link]([Link]("Power"));break;
case 6: [Link]([Link]("Goals"));break;
}
(iv) Write the difference between private and protected access specifiers. [2]
(vii) Read the code and fill the blanks numbered 1 to 4 with the correct answers
to help Lavanya finding the reverse of the number: [2]
int revnum(int x)
{
int a,b=0;
while(x>0)
{
a=x 110;
b=b*2+a;
3 /=10;
}
return 4;
}
6
(viii) A student is trying to print the alphabets ‘A’ to ‘E’ using the following code.
However, the code has an error. Name the error(syntax/logical/runtime).
Rewrite the corrected code. [2]
int i;
for(i=65;i<=69;i++)
[Link](i);
3
√𝑥+𝑦
(x) Write the Java expression for 2 [2]
√𝑦
SECTION B
(Answer any four questions from this Section)
The answers in this Section should consist of the Programs in either Blue J
environment or any program environment with Java as the base.
Each program should be written using Variable descriptions/Mnemonic Codes so
that the logic of the program is clearly depicted.
Flow-Charts and Algorithms are not required.
Question 3 [15]
Member variables:
7
Member methods:
ParkHub() : default constructor
void accept() : accept the required details of the vehicle owner using
Scanner class
void charges() : to calculate the charges to be paid for parking the vehicle
as per given in the following table:
Question 4 [15]
Define a class to accept the names of students in an array of size 20. Arrange the
names in the ascending order using selection sort technique. Display the original
array and the sorted array with the appropriate messages.
Question 5 [15]
Define a class to accept a number. Find and print the number and the difference
between its largest digit and smallest digit along with an appropriate message.
Example:
Input: 41653
Output: 5 i.e 6-1=5
Question 6 [15]
Define a class to accept integer values into a double dimensional array of size
4×4. Print the array elements in a matrix(tabular) format. Further, print the sum
of the odd numbers from each row.
Example:
a [ ][ ]={ {1,4,7,9}, { 2,6,8,1}, { 3,7,2,5}, {6,8,1,4}};
Output:
Elements in a matrix form:
1 4 7 9
2 6 8 1
3 7 2 5
6 8 3 4
8
Sum of odd numbers in row 1: 17
Sum of odd numbers in row 2: 1
Sum of odd numbers in row 3: 15
Sum of odd numbers in row 4: 11
Question 7 [15]
Define a class to accept the names of five employees and their organizations in
two single dimensional arrays of type string. Create the third string array
which contains the email id of the employee generated by adding in the order
the name of the employee, character ‘@’, organization of the employee and the
string “.in”. The email id must contain all lowercase letters.
For e.g.
Name of the employee: John
Name of the organization: KPS
email-Id: john@[Link]
Print all the three arrays with the appropriate messages.
Question 8 [15]
void number(int x, int y):To find the square root of the greater of the two
numbers using the appropriate functions of Math
class.
void number():To print the following number pattern using nested loop:
12345
1234
123
12
1
_____________________________________________________________________________
9
Bombay Scottish School, Mahim
PRELIMINARY ASSESSMENT
COMPUTER APPLICATIONS
Date:14.01.2025
SECTION A
(Attempt all questions from this Section)
Answer 1 [20]
Choose the correct answers to the questions from the given options.
(Do not copy the question, write the correct answer only.)
(i)
(a) Math
(b) util
(c) Scanner
(d) String
(iv) Which of the following is incorrect in the context of Java compilation process?
(a) Program written in Java is the source code with .java as its file name
extension.
(b) Java byte code is also called an object code.
(c) Java byte code is the code obtained after the compilation process.
(d) JVM is the interpreter which converts Java byte code into machine language.
(v) [Link]("click".lastIndexOf('c')+"arch".indexOf('C'));
will print:
(a) 3
(b) 2
(c) 5
(d) 0
(xi) Accepting a character value from user and assigning it to variable x using the
Scanner class object named sc:
3
(a) char x= [Link](0);
(b) char x= [Link]().(0);
(c) char x=[Link]().substring(0,1);
(d) char x=[Link]().charAt(0);
(a) primitive
(b) composite
(c) reference
(d) non primitive
(xiii) The loop which checks the condition at the end of every iteration:
(a) exit-controlled loop
(b) entry-controlled loop
(c) time delay loop
(d) infinite loop
(a) true
(b) false
(c) 2
(d) 0
4
[Link](z+5);
[Link](r+5);
(a) 16.55
21.5
(b) 21
21
(c) 17
21.5
(d) 1655
215
(a) Boxing
(b) Unboxing
(c) Explicit conversion
(d) Implicit conversion
(xix) The resultant values of individual brackets and the final answer, if a=1:
(a++ < a++) && ([Link](3,a)==3)
(a) true && false, false
(b) false && false, false
(c) false && true, false
(d) true && true, true
Reason(R): In Binary search, the value to be searched for is compared with the mid
value of the array.
Answer 2 [20]
(i) Rewrite the following code using the ternary operator and the resultant value of ans
variable : [2]
double r=9.2,s=9.8,ans;
if([Link](r)>s)
ans =r;
else
ans=s;
double r=9.2,s=9.8,ans;
6
ans=[Link](r)>s?r:s;
ans variable value is 9.2
(ii) Given that, x=3 and y=4 evaluate the following expression to find x:
x *= x-y++ + x/y; [2]
x = -3
(iii) Read the following code snippet and answer the questions below: [2]
String s="Achieve ";
int a=[Link]('e');
switch(a)
{
case 2: [Link]([Link]("Confidence"));break;
case 4: [Link]([Link]("Success"));break;
case 0: [Link]([Link]("Growth"));break;
case 8: [Link]([Link]("Power"));break;
case 6: [Link]([Link]("Goals"));break;
}
(iv) Write the difference between private and protected access specifiers. [2]
Private access is limited to the class only, the methods and variables declared
as private cannot be accessed from outside the class. Protected access is within
the package and outside the package through the child class.
(vii) Read the code and fill the blanks numbered 1 to 4 with the correct answers to help
Lavanya finding the reverse of the number: [2]
int revnum(int x)
{
int a,b=0;
while(x>0)
{
a=x 110;
b=b*2+a;
3 /=10;
}
return 4;
}
1= %
2 =10
3= x
4= b;
(viii) A student is trying to print the alphabets ‘A’ to ‘E’ using the following code. However,
the code has an error. Name the error(syntax/logical/runtime). Rewrite the corrected
code. [2]
Logical error
int i;
for(i=65;i<=69;i++)
[Link]((char)i);
8
SECTION B
(Answer any four questions from this Section)
The answers in this Section should consist of the Programs in either Blue J
environment or any program environment with Java as the base.
Each program should be written using Variable descriptions/Mnemonic Codes so
that the logic of the program is clearly depicted.
Flow-Charts and Algorithms are not required.
Answer 3 [15]
Member variables:
Member methods:
ParkHub() : default constructor
void accept() : accept the required details of the vehicle owner using
Scanner class
void charges() : to calculate the charges to be paid for parking the vehicle
as per given in the following table:
Write the main method to create an object of the class and invoke the other
methods.
import [Link].*;
class ParkHub
{
String name;
int regno;
9
int hrs;
double charges;
ParkHub()
{
name="";
regno=0;
hrs=0;
}
void accept()
{ Scanner sc = new Scanner([Link]);
[Link]("Enter the name of the vehicle owner..");
name=[Link]();
[Link]("Enter the registration number of the vehicle owner..");
regno=[Link]();
[Link]("Enter the number of hours the vehicle is parked...");
hrs=[Link]();
}//method ends
void charges()
{
if(hrs<=5)
charges=5*hrs;
else if(hrs>5 && hrs<=10)
charges=5*5+(hrs-5)*4.5;
else if(hrs>10)
charges=5*5+5*4.5+(hrs-10)*3.5;
}//method ends
void disp()
{
[Link]("Name:"+name);
[Link]("Registration number:"+regno);
[Link]("Number of hours vehicle parked:"+hrs);
[Link]("Charges for parking:"+charges);
}//method ends
public static void main()
{
ParkHub obj = new ParkHub();
[Link]();
[Link]();
[Link]();
}//method ends
}//class ends
[member var.-2,methods-8,object cr. Method invoke-3,VDT-2]
10
Answer 4 [15]
Define a class to accept the names of students in an array of size 20. Arrange the
names in the ascending order using Selection sort technique. Display the original
array and the sorted array with the appropriate messages.
import [Link].*;
class SortNames
for(int i=0;i<[Link];i++)
name[i]=[Link]();
for(int i=0;i<[Link];i++)
[Link](name[i]);
for(int i=0;i<[Link];i++)
for(int j=i+1;j<[Link];j++)
if(name[j].compareToIgnoreCase(min)<0)
{sel=j;min=name[j];}
11
name[sel]=name[i];name[i]=min;
[Link]("Sorted array");
for(int i=0;i<[Link];i++)
}//class ends
Answer 5 [15]
Define a class to accept a number. Find and print the number and the difference
between its largest digit and smallest digit along with an appropriate message.
Example:
Input: 41653
Output: 5 i.e 6-1=5
import [Link].*;
class LdiffS
{
public static void main()
{
Scanner sc=new Scanner([Link]);
[Link]("Enter a number..");
int n=[Link]();
int n1=n;
int l=0,s=9;
while(n1>0)
{
int r=n1%10;
if(r>l)
12
l=r;
if(r<s)
s=r;
n1 /=10;
}
[Link]("Difference between largest and smallest digit of the
number "+n+"("+l+"-"+s+")= "+(l-s));}}
[input-1,variables-3, greater-smaller -6,output-3,VDT-2]
Answer 6 [15]
Define a class to accept integer values into a double dimensional array of size 4×4. Print
the array elements in a matrix(tabular) format. Further, print the sum of the odd
numbers from each row.
Example:
a [ ][ ]={ {1,4,7,9}, { 2,6,8,1}, { 3,7,2,5}, {6,8,1,4}};
Output:
Elements in a matrix form:
1 4 7 9
2 6 8 1
3 7 2 5
6 8 3 4
import [Link].*;
class TwoDarray
{
public static void main()
{
Scanner sc=new Scanner([Link]);
int a[][]=new int[4][4];
[Link]("Enter the numbers in a 4X4 matrix...");
for(int i=0;i<[Link];i++)
for(int j=0;j<a[0].length;j++)
a[i][j]=[Link]();
//printing the array
13
[Link]("Elements of the array in matrix form\n");
for(int i=0;i<[Link];i++)
{
for(int j=0;j<a[0].length;j++)
[Link](a[i][j]+" ");
[Link]();
}//loop ends
[Link]("\n");
for(int i=0;i<[Link];i++)
{ int sum=0;
for(int j=0;j<a[0].length;j++)
if(a[i][j]%2!=0)
sum +=a[i][j];
[Link]("Sum of odd numbers in row "+(i+1)+" "+sum);
}
}//main ends
}//class ends
[array dceclaration-2,input-3,calculation-5,output-3,VDT-2
Answer 7 [15]
Define a class to accept the names of five employees and their organizations in
two single dimensional arrays of type string. Create the third string array
which contains the email id of the employee generated by adding in the order
the name of the employee, character ‘@’, organization of the employee and the
string “.in”. The email id must contain all lowercase letters.
For e.g.
Name of the employee: John
Name of the organization: KPS
email-Id: john@[Link]
Print all the three arrays with the appropriate messages.
import [Link].*;
class emailId
{
public static void main()
{
Scanner sc=new Scanner([Link]);
String n[]=new String[5];
String or[]=new String[5];
String emid[] = new String[5];
[Link]("Enter the names of five employees");
for(int i=0;i<[Link];i++)
n[i]=[Link]();
14
[Link]("Enter their organizations");
for(int i=0;i<[Link];i++)
or[i]=[Link]();
[Link]("Emails Ids generated for all employees:");
for(int i=0;i<[Link];i++)
{
emid[i]=n[i].toLowerCase()+"@"+or[i].toLowerCase()+".in";
[Link](emid[i]);
}//loop ends
}//method ends
}//class ends
Answer 8 [15]
void number(int x, int y):To find the square root of the greater of the two
numbers using the appropriate functions of Math
class.
void number():To print the following number pattern using nested loop:
12345
1234
123
12
1
import [Link].*;
class NumOverload
{
void number(int n)
{
int a=0,b=1,c;
[Link]("\n"+a+",");
[Link](b+",");
for(int i=3;i<=n;i++)
{
c=a+b;
[Link](c+",");
a=b;b=c;
15
}
}//method ends
void number(int x,int y)
{
[Link]("\n"+[Link]([Link](x,y)));
}//method ends
void number()
{[Link]("\n\n"+"Number pattern:");
for(int i=5;i>=1;i--)
{for(int j=1;j<=i;j++)
[Link](j);
[Link]();
}
}//method ends
public static void main()
{
NumOverload obj = new NumOverload();
Scanner sc=new Scanner([Link]);
[Link]("\nEnter the number of terms of Fibonacci series to be
printed....");
int a=[Link]();
[Link](a);
[Link]("\n"+"Enter two numbers to find the square root of the
greater....");
int b=[Link]();
int c=[Link]();
[Link](b,c);
[Link]();
}//method ends
}//class ends
16
_____________________________________________________________________________
17