Class 10

Computer Applications Specimen Paper 2020 Solved

Section A (40 Marks)

Question 1
a) Define encapsulation.
Encapsulation refers to wrapping up of the characteristics, state and behavior of an entity in a single unit.
b) Explain the purpose of using a ‘new’ keyword in a Java program.
The ‘new’ keyword instantiates a class by allocating memory for a new object.
c) What are literals?
Literals are data items that are fixed data values.
d) Mention the types of access specifiers.
public, private, protected and friendly.
e) What is constructor overloading?
The process of creating multiple constructors for a class that differ only on constructor signature is called constructor overloading.

Question 2
a) Differentiate between boxing and unboxing.
The process of converting a primitive data type value to its corresponding wrapper class is called boxing. For example, conversion from int to Integer.
The process of converting an object of wrapper class to its corresponding primitive data type value is called unboxing. For example, conversion from Integer to int.
b) Rewrite the following condition without using logical operators:

if(a > b || a > c)
if(a > b)
else if(a > c)

c) Rewrite the following loop using for loop:


d) Write the prototype of a function search which takes two arguments (a string and a character) and returns an integer value.
int search(String s, char ch)
e) Differentiate between = and == operators.
The = operator is an assignment operator.
The == operator is a relational operator.

Question 3
a) State the number of bytes and bits occupied by a character array of 10 elements.
20 bytes or 160 bits.
b) Differentiate between binary search and linear search techniques.
Binary search can only work on sorted list of data.
Linear search can work on both sorted as well as unsorted list of data.
c) What is the output of the following:
String a = "Java is a programming language\ndeveloped by\t\'James Gosling\'";

Java is a programming language
developed by    'James Gosling'

d) Differentiate between break and System.exit(0).
The break keyword is used to terminate a loop or a switch statement.
System.exit(0) is used to terminate a program.
e) Write a statement in Java for:

Math.sqrt((Math.pow(a + b), 3) / Math.abs(a - b))
f) What is the value of m after evaluating the following expression:
m -= 9 % ++n + ++n / 2; when int m = 10, n = 6;
m = m – (9 % ++n + ++n / 2)
= 10 – (9 % 7 + 8 / 2)
= 10 – (2 + 4)
= 10 – 6
= 4.
g) Predict the output of the following:
(i) Math.pow(25, 0.5) + Math.ceil(4.2)
= 5.0 + 5.0
= 10.0
(ii) Math.round(14.7) + Math.floor(7.9)
15 + 7.0
= 22.0
h) Give the output of the following Java statements:
(i) "TRANSPARENT".toLowerCase()
i) Write a Java statement for each to perform the following tasks:
(i) Find and display the position of the last space in a string str.
System.out.println(str.lastIndexOf(' '));
(ii) Extract the second character of the string str.
char ch = str.charAt(1);
j) State the types of errors if any in the following statements:
(i) switch(n > 2)
Syntax error
(ii) System.out.println(100 / 0);
Run-time error

Section B (60 Marks)

Question 4
Anshul Transport Company charges for the parcels of its customers as per the following specifications given below:
Class name: ATransport
Member variables:
String name: to store the name of the customer.
int w: to store the weight of the parcel in kg.
int charge: to store the charge of the parcel.
Member functions:
void accept(): to accept the name of the customer, weight of the parcel from the user (using Scanner class)
void calculate(): to calculate the charge as per the weight of the parcel as per the following criteria:

Weight in Kg Charge per Kg
Up to 10 kg Rs. 25 per kg
Next 20 kg Rs. 20 per kg
Above 30 kg Rs. 10 per kg

A surcharge of 5% is charged on the bill.
void print(): to print the name of the customer, weight of the parcel, total bill inclusive of surcharge in a tabular form in the following format:

Name    Weight    Bill Amount
____    _____    ________

Define the class with the above mentioned specifications, create a main() method, create an object and invoke the member methods.

import java.util.*;
class ATransport{
    String name;
    int w;
    int charge;
    public void accept(){
        Scanner sc = new Scanner(;
        System.out.print("Name: ");
        name = sc.nextLine();
        System.out.print("Weight of the parcel in kg: ");
        w = sc.nextInt();
    public void calculate(){
        if(w <= 10)
            charge = w * 25;
        else if(w <= 30)
            charge = 250 + (w - 10) * 20;
            charge = 450 + (w - 30) * 10;
        charge += (int)(5.0 / 100 * charge);
    public void print(){
        System.out.println("Name\tWeight\tBill Amount");
        System.out.println(name + "\t" + w + "\t" + charge);
    public static void main(String args[]){
        ATransport obj = new ATransport();

Question 5
Write a program to input name and percentage of 35 students of class X in two separate one-dimensional arrays. Arrange students’ details according to their percentage in descending order using selection sort method. Display the names and percentages of first ten toppers of the class.

class Toppers{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(;
        int p[] = new int[35];
        String n[] = new String[35];
        for(int i = 0; i < p.length; i++){
            System.out.print("Name: ");
            n[i] = br.readLine();
            System.out.print("Percentage: ");
            p[i] = Integer.parseInt(br.readLine());
        for(int i = 0; i < p.length; i++){
            int large = p[i];
            int pos = i;
            for(int j = i + 1; j < p.length; j++){ 
                if(p[j] > large){
                    large = p[j];
                    pos = j;
            int temp = p[i];
            p[i] = large;
            p[pos] = temp;
            String t = n[i];
            n[i] = n[pos];
            n[pos] = t;
        System.out.println("Names and Percentages of First 10 Toppers:");
        for(int i = 0; i < 10; i++)
            System.out.println(n[i] + " - " + p[i]);

Question 6
Design a class to overload a function sum() as follows:
(i) int sum(int a, int b) to calculate and return the sum of all the even numbers in the range a to b.
Sample Input:
a = 14
b = 16
Sample Output:
Sum = 70
(ii) double sum(double n) to calculate and return the product of the following series:
Product = 1.0 × 1.2 × 1.4 × … × N
(iii) int sum(int n) to calculate and return the sum of only odd digits of the number N.
Sample Input:
N = 43961
Sample Output:
Sum = 13
Write the main() method to create an object and invoke the above methods.

class Overload{
    public int sum(int a, int b){
        int s = 0;
        for(int i = a; i <= b; i++){
            if(i % 2 == 0)
                s += i;
        return s;
    public double sum(double n){
        double p = 1.0;
        for(double i = 1.0; i <= n; i += 0.2)
            p *= i;
        return p;
    public int sum(int n){
        int s = 0;
        for(int i = n; i != 0; i /= 10){
            if((i % 10) % 2 == 1)
                s += i % 10;
        return s;
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(;
        Overload obj = new Overload();
        System.out.print("a = ");
        int a = Integer.parseInt(br.readLine());
        System.out.print("b = ");
        int b = Integer.parseInt(br.readLine());
        int result = obj.sum(a, b);
        System.out.println("Sum of the range: " + result);
        System.out.print("n = ");
        double n = Double.parseDouble(br.readLine());
        double product = obj.sum(n);
        System.out.println("Product: " + product);
        System.out.print("n = ");
        int num = Integer.parseInt(br.readLine());
        result = obj.sum(num);
        System.out.println("Sum of odd digits: " + result);        

Question 7
Using the switch statement, write a menu-driven program to perform the following operations:
(i) To print the value of z where z = (x3 + 0.5x) / y where x ranges from -10 to 10 with an increment of 2 and y remains constant as 5.5.
(ii) To print the Floyd’s Triangle with N rows.
If N = 5

2    3
4    5    6
7    8    9    10
11   12   13   14   15
class Menu{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(;
        System.out.println("1. Print the value of z");
        System.out.println("2. Floyd's Triangle with N rows");
        System.out.print("Enter your choice: ");
        int choice = Integer.parseInt(br.readLine());
            case 1:
            System.out.print("y = ");
            double y = Double.parseDouble(br.readLine());
            for(int x = -10; x <= 10; x += 2){
                double z = (Math.pow(x, 3) + 0.5 * x) / y;
                System.out.print(z + "\t");
            case 2:
            int num = 1;
            System.out.print("N = ");
            int n = Integer.parseInt(br.readLine());
            for(int i = 1; i <= n; i++){
                for(int j = 1; j <= i; j++){
                    System.out.print(num + "\t");
            System.out.println("Invalid choice!");

Question 8
Write a program to input and store integer elements in a double-dimensional array of size 4 × 4 and find the sum of all the elements.

7 3 4 5
5 4 6 1
6 9 4 2
3 2 7 5

Sum = 73
class Sum{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(;
        int a[][] = new int[4][4];
        int sum = 0;
        System.out.println("Enter 16 integers:");
        for(int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){
                a[i][j] = Integer.parseInt(br.readLine());
                sum += a[i][j];
        System.out.println("Sum = " + sum);

Question 9
Write a program to input a string and convert it into uppercase and print the pair of vowels and number of pair of vowels occurring in the string.
Pair of vowels: EA, AU, EA, AU, IE
No. of pair of vowels: 5

class Pairs{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(;
        System.out.println("Enter the string:");
        String s = br.readLine().toUpperCase();
        int count = 0;
        System.out.print("Pair of vowels: ");
        for(int i = 0; i < s.length() - 1; i++){
            if(s.length() < 2)
            char ch1 = s.charAt(i);
            char ch2 = s.charAt(i + 1);
            if(isVowel(ch1) && isVowel(ch2)){
                System.out.print(ch1 + "" + ch2 + " ");
        System.out.println("\nNo. of pair of vowels: " + count);
    public static boolean isVowel(char ch){
            case 'A':
            case 'E':
            case 'I':
            case 'O':
            case 'U':
            return true;
            return false;

30 replies on “Computer Applications Specimen Paper 2020 Solved”

Thank you Neha! This comment means a lot to me. Please share this website with your friends too.

in question 9, shudnt you put i++; in the condition to check if there are a pair of vowels?, because otherwise if there are three consecutive vowels, then its gonna count it as 2 pairs of vowels.

In the question, and in the example, it isn’t mentioned that we need to consider words with three consecutive vowels separately. So it is optional.

Sir i sent you the paper sorry by chance i sent it to you two time wid two different both are u read one.and plz give me that papers full solvings.

Hlo sir can u give me the solving of real specimen paper of class 10 computer paper.2020.I need the solving the paper which is realeased by the cicse board .plz help me as soon as possible.and plz only the solving of paper whice is recently released by boards.plzzzz.

This is not the one.This i hav solved.I need the solving of the paper which is released by cicse board official website. Plz help.

Wait i will ask those progam doubts one by one.
Write a program to calculate the sum of all the prime numbers between the range 1 and 100.plz can u give solving of this programs doubt.

Can you email me the full question paper? Send it to robinfromsps(at)

Sir can u correct the program question no 5 of specimen paper 2020 part B. As it has one problem.the problem is its states that variable i is nt initialized.

Hi sir can u solve the first program o part B question 4 2020 specimen paper in BufferedReader.please

Make following changes:
throws IOException beside main() and accept()
BufferedReader br = new BufferedReader(new InputStreamReader(;
name = br.readLine();
w = Integer.parseInt(br.readLine());

Sir can u solve this program. WAP to take a sentence as input from user and find the longest word in the sentence.please.But in buffered reader.

Sir this is not the one I meant it is something like this.
Input : India is my motherland.
Output: motherland
This program i need sir.
So please help.

Sir,a program is given which states that:
A sphenic number is a positive number which has exactly 3 prime factors.
Eg: 30,42,66,70,78,etc
WAP in JAVA to accept a number and check whether it is a sphenic number or not.
Sample Input:30
Sample output:30 is a sphenic number.
Hint:2 x 3 x 5
It is the product of 3 prime numbers.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.