Tuesday, February 13, 2018

2018 ISC Computer Practical Paper With Solutions


Question 1


A Goldbach number is a positive even integer that can be expressed as the sum of two odd primes.
Note: All even integer numbers greater than 4 are Goldbach numbers. Example: 6 = 3 + 3
10 = 3 + 7
10 = 5 + 5
Hence, 6 has one odd prime pair 3 and 3. Similarly, 10 has two odd prime pairs, i.e. 3 and 7, 5 and 5.
Write a program to accept an even integer ‘N’ where N > 9 and N < 50. Find all the odd prime pairs whose sum is equal to the number ‘N’.
Test your program with the following data and some random data: Example 1:
INPUT: N = 14
OUTPUT: PRIME PAIRS ARE:
3, 11
7, 7
Example 2: INPUT: N = 30
OUTPUT: PRIME PAIRS ARE
7, 23
11, 19
13, 17
Example 3: INPUT: N = 17
OUTPUT: INVALID INPUT. NUMBER IS ODD.
Example 4: INPUT: N = 126
OUTPUT: INVALID INPUT. NUMBER OUT OF RANGE.

Program

import java.io.*;
public class Goldbach
{
    boolean isPrime(int n)
    {
        if(n<=1)      
            return false;

        int i;
        for(i=2;i
        {
            if(n%i==0)
               break;
        }
       if(i==n)
       return true;
       else
       return false;
    }
   
    void show(int n)
    {
        int i, j;
        for(i=2;i<=n;i++)
        {
            for(j=i;j<=n;j++)
            {
               if(i+j==n)
                if(isPrime(i)&&isPrime(j))
                System.out.println(i+", "+j);
            }
        }
    }
    public static void main(String args[])
    {
         Goldbach ob = new Goldbach(); 
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n;
        System.out.println("Enter the limit: ");
        n = Integer.parseInt(br.readLine())
        if(n%2==1)
          System.out.println("INVALID INPUT. NUMBER IS ODD.");
        else if(n<=9||n>=50)
           System.out.println("INVALID INPUT. NUMBER OUT OF RANGE.");
        else
        {
        System.out.println("Prime Pairs are: ");
        ob.show(n);
        }
    }
}

Variable Description


Type
Name
Use
BufferedReader
br
Intakes limit from user
int
n
Limit value is stored
Int
i
Loop control variable
int
j
Loop control variable


Algorithm


Step 1: Create BufferedReader object ‘br’ and an int type variable ‘n’ to store the limit
Step 2: Value of ‘n’ is checked for validity and if it is invalid, terminate the program otherwise proceed.

Step 3: Each 2 values whose sum is equal to the limit value are checked for prime or not. If the values are prime then they are displayed otherwise search for next pair is continued. 


Others coming soon................

Wednesday, February 7, 2018

ISC 2018 Theoretical and Practical Exam Suggestion



In this page you will get suggestions for ISC Computer application theory examination 2018. The entire syllabus is to be covered by all students but I'll point out few chapters or topics which needs more attention for the exam purpose.

1. Recursive function: Students are advised to understand recursive function properly. I can assure that at least one program would be there in your Computer application theory examination paper 2018 with a recursive function. Prepare your self with programs like displaying the sum of a series where the numerator and denominator are generated using recursive function.

2. Inheritance, function overriding and use of super keyword: A simple program on inheritance is expected in Computer application theory examination 2018. The program would be as follows - Initialise the super class and sub class date members through constructors and thus use of super keyword inside sub class constructor body. A specific function would display the super class data member values and the overridden function in the sub class displaying the data members declared in the sub class. This type of display will also need to use super keyword  inside the overridden function body.

3. Program on Linked List, Stack and Queue: A class definition for creating a linked list will be given and the students have to write either algorithm or procedure of performing different jobs like inserting a node at the beginning, searching value etc. Stack and Queue programs using array is very important.

So far as Linked List is concerned, there won't be any program but students will have to write a model function or algorithm for insertion, deletion or searching operation on Linked List.


4. Tree Traversal: A given tree is to be traversed in pre-order, post-order and in-order.




To Download ISC 2018 Computer Application Practical Suggestion with SolutionsCLICK HERE

To Download ISC 2018 Computer Application Theoretical Suggestion with Solutions: CLICK HERE

Thursday, January 4, 2018

Pattern of numbers in BlueJ

To print the following pattern: 
1
3 1
5 3 1
7 5 3 1
9 7 5 3 1 


Here is the code:


class A
{
 int i,j,k;
public void display()
{
 for(i=0;i<=4;i++)
{
 k=i*2+1;
 for(j=0;j<=i;j++)
{
 System.out.print(k + " ");
k=k-2;
}
System.out.println();
}
}
public static void main(String args[])
{
 A obj=new A();
obj.display();
}
}

Wednesday, May 24, 2017

Pattern on numbers and space


1
1_2
1_2_3
1_2_3_4
1_2_3_4_5
_ stands for space 


class A
{
 int i,j;
public void show()
{
 for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
 System.out.print(j+" ");
}
System.out.println();
}
}
public static void main(String args[])
{
 A ob=new A();
ob.show();
}
}

Pattern on Numbers



13579
35791
57813
79135
91357 

class A
{
 int i,j,x=1,y;
public void show()
{
 for(i=0;i<=4;i++)
{
 y=x;
for(j=0;j<=4;j++)
{
if(y>9)
y=1;
 System.out.print(y);
y=y+2;
}
System.out.println();
x=x+2;
}
}
public static void main(String args[])
{
 A ob=new A();
ob.show();
}
}

Saturday, April 22, 2017

Pattern on Numbers using nested loop



To print the given below pattern

0
0 1
0 2 4
0 3 6 9
0 4 8 12 16
0 5 10 15 20 25
0 6 12 18 24 30 36
0 7 14 21 28 35 42 49
0 8 16 24 32 40 48 56 64
0 9 18 27 36 45 54 63 72 81

Program is as follows:

class B
{
 int i,j,x;
public void show()
{
 for(i=0;i<=9;i++)
{
 System.out.print("0 ");
x=i;
for(j=0;j<=i-1;j++)
{
 System.out.print(x + " ");
x=x+i;
}
System.out.println();
}
}
public static void main(String args[])
{
 B ob=new B();
ob.show();
}
}

Monday, April 3, 2017

2017 ISC Theoretical Paper on Computer with Solutions











Question 2


(a): What is an interface? How it is different from a class? (2)

An interface is like a class but not a class. In an interface, the data members declared are always static final and methods are declared only. A class can implement an interface but can’t extend an interface.

A class contains data members and method members. Methods are defined in a class. The data members and methods members of a class can have any access specifiers – public, private, default or protected and they may be either instance of static member. We can create objects of a defined class.


An interface contains data members which must be static final and method declaration which should be final only. We can’t create objects of an interface but a class can implements number of interfaces.


(b): Convert the following infix expression to postfix form (2)

P * Q / R + (S+T)


PQ*R/ST++

(c): A matrix P[15][10]is stored with each element requiring 8 bytes of storage. If the base address at P[0][0] is 1400, determine the address at P [10][7] when the matrix is stored in row major wise. (2)

(Row major order) Address(Arr[j,k])=base(Arr)+w[n(j-1)+(k-1)] - 'w' is the bytes required for each location and 'n' is length of 2nd dimension
1400 + 8 * [10*9+6]
1400+8*96

2168

Solutions coming Soon...................

Friday, February 3, 2017

2017 ISC Computer Practical Paper Programs with Solutions

  • A Company manufacturing packaging cartoons in four sizes, i,e cartoons to accommodate 6 boxes, 12 boxes, 24 boxes and 48 boxes.Design a program to accept the number of boxes to be packed (N) by the user (maximum upto 1000 boxes) and display the break up of the cartoons used in descending order of capacity. (ie preference should be given to the highest capacity available and if boxes left are less than 6. an extra cartoon of capacity 6 should be used.


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

Example 1: 
INPUT= N=726
OUTPUT= 48 X 15=720
6 X 1=6
Remaining boxes= 0
Total number of boxes= 726
Total Number of cartoons= 16


Example 2: 
INPUT= N=140
OUTPUT= 48 X 2=96
24 x 1= 24
12 x 1= 12
6 x 1= 6
Remaining boxes= 2 x 1= 2

Total number of boxes= 140
Total Number of cartoons= 6


Example 2: 
INPUT= N= 4296
OUTPUT= INVALID INPUT



import java.io.*;
class Pat
{
 BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
int n,no,x,cartoons=0, size=48;
public void takeBoxes() throws Exception
{
 System.out.print("\nEnter the number of boxes:");
 n=Integer.parseInt(br.readLine());
no=n;
if(n >=1001)
{
 System.out.println("INVALID INPUT.");
return;
}
System.out.print("\nOUTPUT:");
while(true)
{
if(n/size!=0)
{
x=n/size;
 System.out.print("\n"+size + "x"+ x + "=" + (size * x));
 cartoons+=n/size;
n=n%size;
}
size=size/2;
if(size==0)
break;
if(n<6 amp="" font="" n="">
{
 cartoons++;
System.out.print("\nRemaining Boxes:" + n + "x 1 ");
break;
}
else if(n==0)
{
 System.out.print("\nRemaining Boxes: 0");
break;
}
}
System.out.print("\nTotal No of Boxes:" + no);
System.out.print("\nTotal No of Cartoons:" + cartoons);
}
public static void main(String args[]) throws Exception
{
 Pat ob=new Pat();
ob.takeBoxes();
}
}



  • The result of a quiz competition is to be prepared as follows:


The quiz has five questions with four multiple choices (A, B, C, D), with each question carrying 1 mark for the correct answer. Design a program to accept the number of participants N such that N must be greater than 3 and less than 11. Create a double dimensional array of size (Nx5) to store the answers of each participant row-wise.
Calculate the marks for each participant by matching the correct answer stored in a single dimensional array of size 5. Display the scores for each participant and also the participant(s) having the highest score.
Example: If the value of N = 4, then the array would be:
Note: Array entries are line fed (i.e. one entry per line)
Test your program with the sample data and some random data:
Example 1
INPUT : N = 5
Participant 1 D A B C C
Participant 2 A A D C B
Participant 3 B A C D B
Participant 4 D A D C B
Participant 5 B C A D D
Key: B C D A A
OUTPUT : Scores :
Participant 1 D A B C C
Participant 1 = 0
Participant 2 = 1
Participant 3 = 1
Participant 4 = 1
Participant 5 = 2
Highest score: Participant 5
Example 2
INPUT : N = 4
Participant 1 A C C B D
Participant 2 B C A A C
Participant 3 B C B A A
Participant 4 C C D D B
Key: A C D B B
OUTPUT : Scores :
Participant 1 = 3
Participant 2 = 1
Participant 3 = 1
Participant 4 = 3
Highest score:
Participant 1
Participant 4
Example 3
INPUT : N = 12
OUTPUT : INPUT SIZE OUT OF RANGE.

import java.io.*; class Quiz { char allans[][],correct[]; int result[],n; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); public void takeAns() throws Exception { System.out.print("Enter number of participants : "); n = Integer.parseInt(br.readLine()); if(n < 4 || n > 10) { System.out.println("INPUT SIZE OUT OF RANGE"); return; } allans = new char[n][5]; // Array to hold answers of every participants correct = new char[5]; // Array to store answer key result = new int[n]; // Array to store score of individual participant System.out.print("\nSet the Answer Key : "); for(int i = 0; i<=4; i++) { br=new BufferedReader(new InputStreamReader(System.in)); System.out.print("\nAnswer of Quiz No "+ (i+1) + ": "); correct[i] = (char)br.read(); } System.out.println("\n Enter answer of each participant\n"); for(int i = 0; i<=n-1;i++) { System.out.print("Taking answers from participant no "+(i+1)); for(int j=0; j<=4; j++) { br =new BufferedReader(new InputStreamReader(System.in)); System.out.print("\nAnswer of Quiz No " + (j+1) + " : "); allans[i][j] = (char)br.read(); } } getMarks(); } private void getMarks() // Function to calculate score { for(int i = 0; i<=n-1;i++) { result[i] = 0; for(int j=0; j<=4; j++) { if(allans[i][j] == correct[j]) { result[i]=result[i]+1; } } } printResult(); } private void printResult() { int max = 0; System.out.println("\nSCORES : "); for(int i = 0; i<=n-1;i++) { System.out.println("\tParticipant No:"+(i+1)+" = "+result[i]); if(result[i] > max) { max = result[i]; // Storing the Highest Score } } System.out.println("\nHighest Score : "+max); System.out.println("\tHighest Scorers : "); for(int i = 0; i<=n-1;i++) { if(result[i] == max) { System.out.println("***Participant No "+(i+1)); } } } public static void main(String args[])throws Exception { Quiz ob = new Quiz(); ob.takeAns(); } }



  • Caesar Cipher is an encryption technique which is implemented as ROT13 (‘rotate by 13 places’). It is a simple letter substitution cipher that replaces a letter with the letter 13 places after it in the alphabets, with the other characters remaining unchanged.


Write a program to accept a plain text of length L, where L must be greater than 3 and less than 100.
Encrypt the text if valid as per the Caesar Cipher.
Test your program with the sample data and some random data:
Example 1
INPUT : Hello! How are you?
OUTPUT : The cipher text is:
Uryyb? Ubj ner lbh?
Example 2
INPUT : Encryption helps to secure data.
OUTPUT : The cipher text is:
Rapelcgvba urycf gb frpher qngn.
Example 3
INPUT : You
OUTPUT : INVALID LENGTH

import java.io.*; class Pat { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String s,str=""; int a; char ch; void takeString() throws Exception { System.out.print("\nEnter the sentence:"); s=br.readLine().trim(); if(s.length()<3 s.length="">100) { System.out.print("\nInvalid Length of String:"); return; } for(int i = 0; i<=s.length()-1;i++) { ch = s.charAt(i); if(Character.isLetter(ch)) { a = ch + 13; if((Character.toUpperCase(ch) > 90) ||(Character.toLowerCase(ch) > 122)) { a = a - 26; } ch = (char)a; } str = str + ch; } System.out.println("The cipher text is :"+str); } public static void main(String args[]) throws Exception { Pat ob = new Pat(); ob.takeString(); } }

CHECK HERE FOR PREVIOUS POSTS

Google+ Followers

Subscribe via email

Enter your email address:

Delivered by FeedBurner