ISC 2020 Computer Science Practical Paper solved

ISC 2020 Computer Science Practical Paper solved


In this post I will be providing you with the solved questions of ISC 2020 Computer Practical Paper which can be easily downloaded. And I hope that students will find this to be useful.

Question 1 :

A Prime-Adam integer is a positive integer (without leading zeros) which is a prime as well as an Adam number.

Prime number: A number which has only two factors, i.e. 1 and the number itself.                           

Example: 2, 3, 5, 7.. etc. 

Adam number: The square of a number and the square of its reverse are reverse to each other.

Example: If n=13 and reverse of "n" =31, then,                        

(13)2 = 169                        

(31)2 =961 which is reverse of 169                         

thus 13, is an Adam number.


Accept two positive integers m and n, where m is less than n as user input. Display all Prime-Adam integers that are in the range between m and n (both inclusive) and output them along with the frequency, in the format given below:
Test your program with the following data and some random data:

Example 1
INPUT: m=5    n=100
OUTPUT:
THE PRIME-ADAM INTEGERS ARE:11 13 31                  
FREQUENCY OF PRIME-ADAM INTEGERS IS:3

Example 2
INPUT: m=100  n= 200
OUTPUT: 
THE PRIME-ADAM INTEGERS ARE:101 103 113             
FREQUENCY OF PRIME-ADAM INTEGERS IS:3

Example 3
INPUT:m= 50   n = 70
OUTPUT:
THE PRIME-ADAM INTEGERS ARE:NIL                 
FREQUENCY OF PRIME-ADAM INTEGERS IS:0

Example 4
INPUT: m=700  n =450
OUTPUT: INVALID INPUT.
/**
 *[ ISC 2020] QUESTION 1: A Prime-Adam integer is a positive integer (without leading zeros) which is a prime as well as an Adam number.
 * @theschoolprogrammer
 * www.theschoolprogrammer.com 
 */

import java.util.*;
public  class PrimeAdam
{ 
    static boolean Prime(int n)
    //function to check given number is prime or not
    {
        int i,f=0;
        for(i=1;i<=n;i++)
        {
            if(n%i==0)
                f++;
        }
        if(f==2)
            return(true);
        else
            return(false);
    }

    static int Reverse(int n)//returns reverse of a number
    {
        String s=Integer.toString(n);
        //converting number to string for easy algorithm
        int i;
        String ns="";
        for(i=0;i<s.length();i++)
        {
            ns=s.charAt(i)+ns;

        }

        return(Integer.valueOf(ns));

    }

    static void main()
    {
        Scanner sc=new Scanner(System.in);
        System.out.println("ENTER FIRST NUMBER");
        int m=sc.nextInt();
        System.out.println("ENTER SECOND NUMBER");
        int n=sc.nextInt();
        
        if(m<n)
        {
            System.out.println("THE PRIME ADAM INTEGERS ARE:");
            int i,k,f=0;
            for(i=m;i<=n;i++)
            {
                k=(int)Math.pow(Reverse(i),2);

                if((Prime(i)==true) &&(Reverse(i*i)==k))
                {              
                    System.out.print(i+" ");
                    f++;
                }
            }
            System.out.println();
            if(f==0)
            {
                System.out.println(" NIL");
            }
            System.out.print("FREQUENCY OF ADAM INTERGERS IS :"+f);
        }
        else
            System.out.println("INVALID INPUT");
    }
}

Question 2:

Write a program to declare a matrix A[][]of order ( M*N) where 'M' is the number of rows and 'N' is the number of columns such that the value of "M' must be greater than 0 and less than 10 and the value of 'N' must be greater than 2 and less than 6. Allow the user to input digits (0-7) only at each location, such that each row represents an octal number.

Example: 

231(decimal equivalent of 1st row=153 i.e. 2*8² +3*8¹ +1*8⁰)    
405(decimal equivalent of 1st row=261 i.e.4*8¹+0*8¹+5*8⁰ ) 
156(decimal equivalent of 1st row=110 i.e. 1*8²+5*8¹+6*8⁰)

Perform the following tasks on the matrix:
  • Display the original matrix.
  • Calculate the decimal equivalent for each row and display as per the format given below.
Example 1:
Input:
ENTER ROW SIZE M=3           
ENTER COLUMN SIZE  N=4            
ENTER ELEMENTS FOR ROW 1: 1 1 3 7           
ENTER ELEMENTS FOR ROW 2: 2 1 0 6            
ENTER ELEMENTS FOR ROW 3: 0 2 4 5
Output:            
FILLED MATRIX   DECIMAL EQUIVALENT                          
1 1 3 7       607                             
2 1 0 6         1094                             
0 2 4 5         165

Example 2:
Input:
ENTER ROW SIZE M=3          
ENTER COLUMN SIZE N=3            
ENTER ELEMENTS FOR ROW 1: 0 2 8
Output:
INVALID INPUT

Example 3:
Input:
ENTER ROW SIZE  M=3           
ENTER COLUMN SIZE N=9
Output:OUT OF RANGE
/**
 *QUESTION_2
 * @theschoolprogrammer
 * www.theschoolprogrammer.com 
 */

import java.io.*;
public class Question2
{

    static void main()throws IOException
    {
        BufferedReader br=newBufferedReader
        (newInputStreamReader(System.in));
        int i,j,k,sum=0;

        System.out.println("ENTER ROW SIZE");
        int M=Integer.parseInt(br.readLine());
        System.out.println("ENTER COLUMN SIZE");
        int N=Integer.parseInt(br.readLine());
        if((M>0&&M<10)&&(N>2&&N<6))
        {
            int a[][]=new int[M][N];
            String s[]=new String[N];
            int flag=0;
            outer: for(i=0;i<M;i++)
            {
                System.out.print("ENTER ELEMENTS FOR ROW "+(i+1)+": ");
                s[i]=br.readLine();
                k=0;
                for(j=0;j<N;j++)
                {
                    a[i][j]=Integer.parseInt(s[i].charAt(k)+"");
                    //filling values in array
                    if(a[i][j]<0||a[i][j]>7)
                    {
                        flag=1;
                        break outer;//using labeled break 
                    }
                    k=k+2;

                }
            }
            if(flag==0)
            { 

                System.out.println("FILLED MATRIX \t DECIMAL 
                EQUIVALENT");
                for(i=0;i<M;i++)
                {
                    sum=0;
                    for(j=0;j<N;j++)
                    {
                        System.out.print(a[i][j]+" ");
                        sum=sum+(int)Math.pow(8,N-1-j)*a[i][j];
                    }
                    System.out.println("\t"+sum);

                }
            }
            else
            System.out.println("INVALID INPUT");

        }
        else
            System.out.println("OUT OF RANGE");
    }
}

Question 3:

Write a program to accept a sentence which may be terminated by either. '.', '?' or '!' only. The words are to be separated by a single blank space and are in UPPER CASE.

Perform the following tasks:

  • Check for the validity of the accepted sentence only for the terminating character.
  • Arrange the words in ascending order of their length. If two or more words have the same length, then sort them alphabetically.
  • Display the original sentence along with the converted sentence.
Example 1:
Input:AS YOU SOW SO SHALL YOU REAP.
Output:
AS YOU SOW SO SHALL YOU REAP.               
AS SO SOW YOU YOU REAP SHALL

Example 2:
Input:NOTHING IS IMPOSSIBLE#
Output:
INVALID INPUT
/**
 * QUESTION_3
 * @theschoolprogrammer
 * www.theschoolprogrammer.com 
 */
import java.util.*;
import java.io.*;
public class Question3
{

    static void main()throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String s=br.readLine().toUpperCase();
        int i,j;

        if(".?!".indexOf(s.charAt(s.length()-1))!=-1)
        {
            System.out.println(s);
            s=s.substring(0,s.length()-1);
            StringTokenizer str=new StringTokenizer(s);

            int l=str.countTokens();
            String ss[]=new String[l];
            for(i=0;i<l;i++)
                ss[i]=str.nextToken();

            //now sorting the array
            for(i=0;i<l-1;i++)
            {

                for(j=0;j<l-i-1;j++)
                {
                    if(ss[j].length()>ss[j+1].length())
                    {
                        String t=ss[j];
                        ss[j]=ss[j+1];
                        ss[j+1]=t;
                    }
                    if((ss[j].length()==ss[j+1].length())&&(ss[j].compareTo(ss[j+1])>0))//comparing them lexicographically
                    {
                        String t=ss[j];
                        ss[j]=ss[j+1];
                        ss[j+1]=t;
                    }
                }
            }
            for(i=0;i<l;i++)
                System.out.print(ss[i]+" ");
        }
        else
            System.out.println("INVALID INPUT");
    }
}

This ISC Board class 12th [ 2020 computer Practical ] solved paper would  be very useful in understanding the pattern of questions that can be asked in computer Practical of year 2021. It would help isc students to prepare for computer practical 2021 and score good marks.
Board : Council for the Indian School Certificate Examinations (CISCE)
Class : 12
Subject : Computer Practical
Year: 2020

Found this useful? Share with your friends. Share

Comments

You are welcome to share your ideas with us in comments!!!

Full Screen Mode

Archive

Contact Form

Send