Sunday, 20 November 2016

ISC Computer 2013 Practical Paper Solved

ISC Computer 2013 Practical Paper Solved

Question : 1
Checks whether the ISBN code is valid or not.
Sample Input : 
0201103311
Sample Output : 
SUM = 55
LEAVES NO REMAINDER - VALID ISBN CODE
//Publisher : Sharma Tutorials Jamshedpur
//Author : Shubham Kumar Sharma
import java.util.*;
public class ISBN
{
    public static void main()
    {
        Scanner in=new Scanner(System.in);
        String s;
        int sum=0,l,i;
        char c;
        System.out.println("Enter the ISBN Number : ");
        s=in.nextLine();
        l=s.length();
        if(l==10)
        {
            for(i=10;i>=1;i--)
            {
                c=s.charAt(10-i);
                if((c=='x')||(c=='X'))
                {
                    sum=sum+(10*i);
                }
                else
                {
                    sum=sum+(Integer.parseInt(c+"")*i);
                }
            }
            System.out.println("SUM = "+sum);
            if(sum%11==0)
            System.out.println("LEAVES NO REMAINDER - VALID ISBN CODE");
            else
            System.out.println("LEAVES REMAINDER - INVALID ISBN CODE");
        }
        else
        {
            System.out.println("INVALID INPUT");
        }
    }
}

Question : 2
Inputs a matrix of order M  M and displays original matrix and image of original matrix.
Sample Input : 
1      2      3      
4      5      6      
7      8      9      
Sample Output : 
ORIGINAL MATRIX
1      2      3      
4      5      6      
7      8      9      
MIRROR IMAGE MATRIX
3      2      1      
6      5      4      
9      8      7
//Publisher : Sharma Tutorials Jamshedpur
//Author : Shubham Kumar Sharma
import java.util.*;
public class Square_Matrix
{
    public static void main()
    {
        Scanner in=new Scanner(System.in);
        int m,i,j;
        System.out.println("Enter size of matrix : ");
        m=in.nextInt();
        if((m>2)&&(m<20))
        {
            int a[][]=new int[m][m];
            int b[][]=new int[m][m];
            System.out.println("Enter Elements in the matrix : ");
            for(i=0;i<m;i++)
            {
                for(j=0;j<m;j++)
                {
                    a[i][j]=in.nextInt();
                }
            }
            System.out.println("ORIGINAL MATRIX");
            for(i=0;i<m;i++)
            {
                for(j=0;j<m;j++)
                {
                    System.out.print(a[i][j]+"\t");
                }
                System.out.println();
            }
            for(i=0;i<m;i++)
            {
                for(j=0;j<m;j++)
                {
                    b[i][m-j-1]=a[i][j];
                }
            }
            System.out.println("MIRROR IMAGE MATRIX");
            for(i=0;i<m;i++)
            {
                for(j=0;j<m;j++)
                {
                    System.out.print(b[i][j]+"\t");
                }
                System.out.println();
            }
        }
        else
        System.out.println("SIZE OUT OF RANGE");
    }
}     

Question : 3
Inputs a sentence in upper case and display palindromic words and the number of palindromic words present in sentence.
Sample Input : 
MADAM ARORA WILL COME AT NOON.
Sample Output : 
PALINDROMIC WORDS ARE : 
MADAM ARORA NOON 
NUMBER OF PALINDROMIC WORDS : 3
//Publisher : Sharma Tutorials Jamshedpur
//Author : Shubham Kumar Sharma
import java.util.*;
public class Palindrome
{
    public static void main()
    {
        Scanner in=new Scanner(System.in);
        String s,w[],wrd="",str="";
        int i,j,p=0;
        char c;
        System.out.println("ENTER YOUR SENTENCE : ");
        s=in.nextLine();
        if((s.charAt(s.length()-1)=='?')||(s.charAt(s.length()-1)=='.')||(s.charAt(s.length()-1)=='!'))
        {
            w=s.split("[?!. ]+");
            for(i=0;i<w.length;i++)
            {
                for(j=0;j<w[i].length();j++)
                {
                    c=w[i].charAt(j);
                    wrd=c+wrd;
                }
                if(w[i].equals(wrd))
                {
                    str=str+w[i]+" ";
                    p++;
                }
                wrd="";
            }
            if(p>0)
            {
                System.out.println("PALINDROMIC WORDS ARE : ");
                System.out.println(str);
                System.out.println("NUMBER OF PALINDROMIC WORDS : "+p);
            }
            else
            {
                System.out.println("NO PALINDROMIC WORDS");
            }
        }
        else
        System.out.println("INVALID INPUT");
    }
}

10 comments:

  1. Hello, Shubham...
    Question 3 solution is as same as the question 2... please correct it.

    ReplyDelete
    Replies
    1. Thanks for reporting us......
      The solution has been changed.
      We apologize for your inconvenience.

      Delete
  2. Thank for your brilliant solutions it help me a lot thank you so much.....

    ReplyDelete
  3. Please provide the solution's of 2011 and 2010

    ReplyDelete
  4. Why you used split in question no.3??

    ReplyDelete
    Replies
    1. split function is used to split the string into a array.
      Suppose your string is "You are learning with Shubham Sharma" and you want to separate from space present in string.
      = .split('');
      your result will be {"You", "are", "learning", "with", "Shubham", "Sharma"}

      Delete
  5. Is it true that all matrix progra
    ms are of same method, steps and logic

    ReplyDelete
    Replies
    1. Taking input and output methods are same. You just need to develop a logic for the operation need to be performed as per problem statement.

      Delete