Computer Application Semester-2 ICSE Specimen Paper Solved Class-10

Computer Application Semester-2 ICSE Specimen Paper Solved Class-10.  Step by step solutions of ICSE Class-10 specimen model sample paper.  During solutions of semester-2 Computer Application specimen paper so that student can achieve their goal in next upcoming exam of council .

Computer Application Semester-2 ICSE Specimen Paper Solved Class-10

Board ICSE
Class  10th (X)
Subject Computer Application
Topic Semester-2 ICSE Specimen Paper Solved
Syllabus  on bifurcated syllabus (after reduction)
session 2021-22
Question Type Descriptive Type (as prescribe by council)
Total question Total- 7 with all parts (Sec-A&B)
Max mark 50

Warning :- before viewing solution view Question Paper

Question 1:

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

(i) When primitive data type is converted to its corresponding object of its class, it is called as ___________.

(a) Boxing

(b) Explicit type conversion

(c) Unboxing

(d) Implicit type conversion

Answer : (a) Boxing

(ii) State the value of y after the following is executed:

char x=’7′;

y= Character.isLetter(x);

(a) false

(b) 7

(c) true

(d) ‘7’

Answer : (a) false

(iii) Give the output of the following string methods:

“MISSISSIPPI”.indexOf(‘S’)+ “MISSISSIPPI”.lastIndexOf(‘I’)

(a) 10

(b) 12

(c) 20

(d) 11

Answer : (b) 12

(iv) Corresponding wrapper class of int data type is __________.

(a) integer

(b) INTEGER

(c) Int

(d) Integer

Answer : (d) Integer

(v) Variable that is declared with in the body of a method is termed as:

(a) Instance variable

(b) class variable

(c) Local variable

(d) Argument variable

Answer : (c) Local variable

(vi) Identify the correct array declaration statement:

(a) int a[10];

(b) int a[]=new int[10];

(c) int arr[i]=10;

(d) int a[10]=new int[];

Answer : (b) int a[]=new int[10];

(vii) A variable that is bounded to the object itself is called as:

(a) Instance variable

(b) class variable

(c) Local variable

(d) Argument variable

Answer : (a) Instance variable

(viii) The access modifier that gives most accessibility is:

(a) private

(b) public

(c) protected

(d) package

Answer : (b) public

(ix) Give the output of the following code:

String A =”26.0″, B=”74.0″;

double C= Double .parseDouble(A);

double D = Double .parseDouble(B);

System.out.println((C+D));

(a) 26

(b) 74

(c) 100.0

(d) 2674

Answer : (c) 100.0

(x) Wrapper classes are available in __________ package.

(a) java.io

(b) java.util

(c) java.lang

(d) java.awt

Answer : (c) java.lang


SECTION B

(Attempt any four questions.)

Question 2:

Define a class to declare an integer array of size n and accept the elements into the array. Search for an element input by the user using linear search technique, display the element if it is found, otherwise display the message “NO SUCH ELEMENT.

Answer :

#include<iostream>

using namespace std;

class dec {

public:

int a[];

dec(int b[],int n) {

for(int i=0,i<n,i++)

a[i]=b[i];

}

void search(int x) {

for(int i : a) {

if (i==x) {

cout << i;

break;

}

}

}

};

int main() {

int arr[3]={1,2,3};

dec obj(arr,3);

obj.search(2);

}

Question 3 :

Define a class to declare a character array of size ten, accept the character into the array and perform the following:

• Count the number of uppercase letters in the array and print.

• Count the number of vowels in the array and print.

Answer :

 To count the number of uppercase letters in the array and print.

import java.util.Scanner;
public class CountUpperLower{
public static void main(String args[]){
//variable declaration
String str;
int upper=0,;//vriable declaration and initialization
Scanner scan=new Scanner(System.in);
//create a scanner object for input
System.out.println(“Enter the String “);
str=scan.nextLine();
for(int i=0; i<str.length(); i++){
char ch=str.charAt(i);
if(ch>=‘A’ && ch<=‘Z’){
upper++;
}
System.out.println(“uppercase letters: “+upper);
}
 
To count the number of vowels in the array and print.
/ Java Program to Count Number of Vowels
// in a String in a iterative way
import java.io.*;
public class vowel {
    public static void main(String[] args)
        throws IOException
    {
        String str = "GeeksForGeeks";
        str = str.toLowerCase();
        int count = 0;
        for (int i = 0; i < str.length(); i++) {
            // check if char[i] is vowel
            if (str.charAt(i) == 'a' || str.charAt(i) == 'e'
                || str.charAt(i) == 'i'
                || str.charAt(i) == 'o'
                || str.charAt(i) == 'u') {
                // count increments if there is vowel in
                // char[i]
                count++;
            }
        }
        // display total count of vowels in string
        System.out.println(
            "Total no of vowels in string are: " + count);
    }
}

Question 4 :

Define a class to declare an array of size 20 of double datatype, accept the elements into the array and perform the following:

• Calculate and print the sum of all the elements.

• Calculate and print the highest value of the array.

Answer :

To Calculate and print the sum of all the elements.

/* C++ Program to find sum of elements
in a given array */
#include <bits/stdc++.h>
using namespace std;
// function to return sum of elements
// in an array of size n
int sum(int arr[], int n)
{
    int sum = 0; // initialize sum
    // Iterate through all elements
    // and add them to sum
    for (int i = 0; i < n; i++)
    sum += arr[i];
    return sum;
}
// Driver code
int main()
{
    int arr[] = {12, 3, 4, 15};
    int n = sizeof(arr) / sizeof(arr[0]);
    cout << "Sum of given array is " << sum(arr, n);
    return 0;
}
 To Calculate and print the highest value of the array.
// C++ program to find maximum
// in arr[] of size n
#include <bits/stdc++.h>
using namespace std;
int largest(int arr[], int n)
{
    int i;
    
    // Initialize maximum element
    int max = arr[0];
    // Traverse array elements
    // from second and compare
    // every element with current max
    for (i = 1; i < n; i++)
        if (arr[i] > max)
            max = arr[i];
    return max;
}
// Driver Code
int main()
{
    int arr[] = {10, 324, 45, 90, 9808};
    int n = sizeof(arr) / sizeof(arr[0]);
    cout << "Largest in given array is "
         << largest(arr, n);
    return 0;
Question 5 :

Define a class to accept two strings, convert them into uppercase, check and display whether two strings are equal or not, if the two strings are not equal, print the string with the highest length or print the message both the strings are of equal length.

Answer :

// Function to compare two strings ignoring their cases
bool equalIgnoreCase(string str1, string str2)
{
    int i = 0;
    // Convert to uppercase
    // using transform() function and ::toupper in STL
    transform(str1.begin(), str1.end(), str1.begin(), ::toupper);
    transform(str2.begin(), str2.end(), str2.begin(), ::toupper);
    // Comparing both using inbuilt function
    int x = str1.compare(str2);
    // if strings are equal,
    // return true otherwise false
    if (x != 0)
        return false;
    else
        return true;
}
// Function to print the same or not same
// if strings are equal or not equal
void equalIgnoreCaseUtil(string str1, string str2)
{
    bool res = equalIgnoreCase(str1, str2);
    if (res == true)
        cout << "Same" << endl;
    else
        cout << "Not Same" << endl;
}
// Driver Code
int main()
{
    string str1, str2;
    str1 = "Geeks";
    str2 = "geeks";
    equalIgnoreCaseUtil(str1, str2);
    str1 = "Geek";
    str2 = "geeksforgeeks";
    equalIgnoreCaseUtil(str1, str2);
    return 0;
}

Question 6 :

Define a class to accept a string, convert it into lowercase and check whether the string is a palindrome or not. A palindrome is a word which reads the same backward as forward.

Example:

madam, racecar etc.

Answer :

for converting in lower case refer Q-3 and checking if palindrome or not

public class PalindromeString

{

public static void main(String[] args) {

String string = “Kayak”;

boolean flag = true;

 

//Converts the given string into lowercase  

string = string.toLowerCase();

 

//Iterate the string forward and backward, compare one character at a time   

//till middle of the string is reached  

for(int i = 0; i < string.length()/2; i++){

if(string.charAt(i) != string.charAt(string.length()-i-1)){

flag = false;

break;

}

}

if(flag)

System.out.println(“Given string is palindrome”);

else

System.out.println(“Given string is not a palindrome”);

}

}

Question 7:

Define a class to accept and store 10 strings into the array and print the strings with even number of characters.

Answer :

public class Main

{

public static void main(String[] args) {

String[] strs = new String[10];

java.util.Scanner sc = new java.util.Scanner(System.in);

for(int i = 0; i < 10; i++){

System.out.print(“Enter string ” + (i+1) + “:”);

strs[i] = sc.nextLine();

}

System.out.println(“The strigs with even number of characters is”);

for(int i = 0; i < strs.length;i++){

if(strs[i].length() % 2 == 0){

System.out.println(strs[i]);

}

}

}

}


Return to:-    ICSE Class-10 Specimen Paper Semester-2 of 2021-22 

thanks

Please share with your ICSE friends

18 thoughts on “Computer Application Semester-2 ICSE Specimen Paper Solved Class-10”

Leave a Comment

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

error: Content is protected !!