ISC 2019 Computer Science Practical Paper Solved

Isc 2019 computer science paper solved- theschoolprogrammer
@theschoolprogrammer


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

Question 1

Design a program to accept a day number (between 1 and 366), year (in 4 digits) from the user to generate and display the corresponding date, Also, accept 'N' (1-N 1 00) from the user to compute and display the future date corresponding to 'N' days after the generated date. Display an error message if the value of the day number, year and N are not within the limit or not according to the condition specified.

Test your program with the following data and some random data:

Example 1

INPUT: DAY NUMBER:         255
       YEAR:               2018
       DATE AFTER(N DAYS): 22
OUTPUT:DATE:               12 TH SEPTEMBER,2018
       DATE AFTER 22 DAYS: 4 TH OCTOBER,2018

Example 2

INPUT: DAY NUMBER:         360
       YEAR:               2018
       DATE AFTER(N DAYS): 45
OUTPUT:DATE:               26 TH DECEMBER,2018
DATE AFTER 45 DAYS:        9 TH FEBRUARY,2019

Example 3

INPUT: DAY NUMBER:  500
YEAR:               2018
DATE AFTER(N DAYS): 33
OUTPUT:DAY NUMBER OUT OF RANGE.

Example 4

INPUT: DAY NUMBER:         360
       YEAR:               2018
       DATE AFTER(N DAYS): 45
OUTPUT:DATE AFTER(N DAYS) OUT OF RANGE.

Code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import java.util.*;

/**
 * ISC 2019 PRACTICAL QUESTION 1
 *
 * @THESCHOOLPROGRAMMER
 * WWW.THESCHOOLPROGRAMMER.COM
 */
public class isc2019q1
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        //TAKING INPUT OF ALL THE REQURIED DATA
        System.out.println("DAY NUMBER:");
        int dayNum=sc.nextInt();
        System.out.println("ENTER YEAR");
        int year=sc.nextInt();
        System.out.println("ENTER DAY TO ADD");
        int dayAdd=sc.nextInt();

        if((dayNum<=366&&dayNum>=1)&&(year>999&&year<10000)&&(dayAdd>0&&dayAdd<101))
        {
            int yr[]={31,28,31,30,31,30,31,31,30,31,30,31};
            String yrWords[]={"JANUARY","FEBRUARY","MARCH",
                    "APRIL","MAY","JUNE","JULY",
                    "AUGUST","SEPTEMBER",
                    "OCTOBER","NOVEMBER","DECEMBER"};
            if(((year%4==0)&&(year%100!=0))||(year%400==0))
                yr[1]=29;

            //Finding the Nth Day
            int day;
            int month=1;
            int k=0;//flag variable
            int i=0;//index variable
            while(dayNum>yr[i])
            {
                k=1;//flaging
                dayNum-=yr[i++];
            }
            day=dayNum;
            if(k==1)
                month=i+1;
                System.out.println("DATE: \t \t"+day+" TH "+yrWords[month-1]+","+year);
                System.out.print("DATE AFTER "+dayAdd+" DAYS: \t");
            //now adding extra day
            i=month-1;
            while(dayAdd>0)
            {
                if(dayAdd+day<=yr[i])
                {
                    day=day+dayAdd;
                    month=i;
                    break;
                }
                else
                {
                    month++;
                    dayAdd-=yr[i]-day;
                    day=0;
                }
                i++;
                if(i==12&&dayAdd>0)
                {
                    i=0;year++;
                    if(((year%4==0)&&(year%100!=0))||(year%400==0))
                        yr[1]=29;
                }
            }
            System.out.println(day+" TH "+yrWords[month]+","+year);

        }
        else
        {
            if(dayNum>366&&dayNum<1)
                System.out.println("DAY NUMBER OUT OF RANGE");
            else if(dayAdd<1&&dayAdd>100)
                System.out.println("DATE AFTER(N DAYS) OUT OF RANGE");
        }

    }
}


Join Us

For those who prefer reading on mobile, we have Telegram channel and WhatsApp group that will allow you to receive updates, announcements, and links to our stories straight to your mobile device..



Question 2:

Write a program to declare a single dimensional array al and a square matrix b[ ] [] of size N, where N>2 and N<10. Allow the user to input positive integers into the single dimensional array

Perform the following tasks on the matrix:

(a) Sort the elements of the single dimensional array in ascending order using any standard sorting technique and display the sorted elements.

(b) Fill the square matrix b[ ][] in the following format.

If the array a[ ] = { 5, 2, 8, 1 } then, after sorting a[ ]= (1, 2, 5, 8} Then, the matrix b[ would fill as below:

Then, the matrix b[][] would fill as below:

       1 2 5 8
       1 2 5 1
       1 2 1 2
       1 1 2 5

(c) Display the filled matrix in the above format.

Test your program for the following data and some random data:

Example 1

INPUT:
N=3
ENTER ELEMENTS OF SINGLE DIMESIONAL ARRAY: 3 1 7
OUTPUT: 
SORTED ARRAY: 1 3 7
FILLED MATRIX
1 3 7
1 3 1
1 1 3

Example 2

INPUT: 
N=13
OUTPUT: 
MATRIX SIZE OUT OF RANGE

Example 3

INPUT: 
N=5
ENTER ELEMENTS OF SINGLE DIMESIONAL ARRAY: 10 2 5 23 6 
OUTPUT: 
SORTED ARRAY: 2 5 6 10 23 
FILLED MATRIX 
2  5  6  10 23
2  5  6  10 2
2  5  6  2  5
2  5  2  5  6
2  2  5  6  10

Code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
 * ISC 2019 PRACTICAL QUESTION 2
 *
 * @THESCHOOLPROGRAMMER
 * WWW.THESCHOOLPROGRAMMER.COM
 */
import java.util.*;
public class isc2019q2
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        System.out.println("Enter the size of array");
        int n=sc.nextInt();
        if(n>2&&n<10)
        {
            int a[]=new int[n];
            int b[][]=new int[n][n];
            int i,j;
            for(i=0;i<n;i++)
            {
                System.out.println("ENTER THE ELEMENT");
                a[i]=sc.nextInt();
            }
            //sorting the array a[] using bubble sort method

            for(i=0;i<n-1;i++)
            {
                for(j=0;j<n-i-1;j++)
                {
                    if(a[j]>a[j+1])
                    {
                        int temp=a[j];
                        a[j]=a[j+1];
                        a[j+1]=temp;
                    }
                }
            }
            //printing the sorted array
            System.out.print("SORTED ARRAY: ");
            for(i=0;i<n;i++)
                System.out.print(a[i]+" ");

            //STORING VALUES IN ARRAY "B"
            for(i=0;i<n;i++)
            {
                int flag=n-i;
                int x=0;
                for(j=0;j<n;j++)
                {
                    if(flag==0)
                        x=0;

                    b[i][j]=a[x++];
                    flag--;
                }
            }
            //PRINTNG THE ARRAY "B"
            System.out.println("\n FILLED MATRIX");
            for(i=0;i<n;i++)
            {
                for(j=0;j<n;j++)
                {
                    System.out.print(b[i][j]+" ");
                }
                System.out.println();
            }
        }
        else
            System.out.println("MATRIX OUT OF RANGE");
    }
}

Also check:

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:

(a) Check for the validity of the accepted sentence.

(b) Convert the non-palindrome words of the sentence into palindrome words by concatenating the word by its reverse (excluding the last character).

Example: The reverse of the word HELP would be LEH (omitting the last alphabet) and by concatenating both the new palindrome word is HELPLEH. Thus, the word HELP becomes HELPLEH.

Note: The words which end with repeated alphabets, for example ABB would become ABBA and not ABBBA and XAZZZ becomes XAZZZAX.

[Palindrome word: Spells same from either side. Example: DAD, MADAM etc.]

(c) Display the original sentence along with the converted sentence.

EXAMPLE 1

INPUT: THE BIRD IS FLYING 
OUTPUT: 
THE BIRD IS FLYING.
THEHT BIRDRIB ISI FLYINGNIYLF

EXAMPLE 2

INPUT: IS THE WATER LEVEL RISING?
OUTPUT:
IS THE WATER LEVEL RISING?
ISI THEHT WATERETAW LEVEL RISINGNISIR

EXAMPLE 3

INPUT: THIS MOBILE APP LOOKS FINE.
OUTPUT:
THIS MOBILE APP LOOKS FINE.
THISIHT MOBILELIBOM APPA LOOKSKOOL FINENIF

EXAMPLE 4 

INPUT: YOU MUST BE CRAZY#
OUTPUT:
INVALID INPUT

Code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
 * ISC 2019 PRACTICAL QUESTION 3
 *
 * @THESCHOOLPROGRAMMER
 * WWW.THESCHOOLPROGRAMMER.COM
 */
import java.util.*;
public class isc2019q3
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        System.out.println("ENTER THE SENTENCE");
        String s=sc.nextLine();

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

            StringTokenizer str=new StringTokenizer(s);
            
            int count=str.countTokens();
            for(int i=1;i<=count;i++)
            {

                String word=str.nextToken();
                if(word.equals(reverse(word)))
                    System.out.print(word+" ");
                else
                    System.out.print(word+(reverse(word).substring(1,reverse(word).length())+" "));
            }
        }
        else
            System.out.println("INVALID INPUT");
    }

    public static String reverse(String s)
    {
        int l=s.length();
        String ns="";
        for(int i=l-1;i>=0;i--)
            ns=ns+s.charAt(i);
        return(ns);
    }
}

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