Saturday, February 12, 2011

ISC Computer practical programs on 2006

Program Number 1



Write a program which inputs a positive natural number N and prints the possible consecutive number combinations, which when added give N. Test your program for the following data and some random data..

A positive natural number, (for e.g 27) can be represented as follows-
2+3+4+5+6+7
8+9+10
13+14
Every row represents a combination of consecutive natural numbers, which add up to 27.

SAMPLE DATA
INPUT
N = 9
OUTPUT
4 5
2 3 4
INPUT
N = 15
OUTPUT
7 8
1 2 3 4 5
4 5 6

Codes of this Program on possible consecutive numbers already posted in this blog.

Program on Merging two sorted string arrays



Write a program that inputs the names of people in to different arrays, A and B. Array a has N number of names while array B has M number of names, with no duplicates in either of them. Merge arrays A and B in to a single array C, such that the resulting array is stored alphabetically.
Display all the three arrays, A, B and C, stored alphabetically.
Test your program for the given data and some random data.

SAMPLE DATA
INPUT
Enter number of names in Array A, N = 2
Enter number of names in Array A, B = 2
First array: (A)
Suman
Anil
Second array: (B)
Usha
Sachin
John
OUTPUT
Stored Merged array: (C)
Anil
John
Sachin
Suman
Usha
Stored First array: (A)
Anil
Suman
Stored second array: (B)
John
Sachin
Usha

Codes of this program


import java.io.*;
class SortedNames
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str1[],str2[],str3[];
int n,m;
String s;
int i,j;
public void take ()throws Exception
{
System.out.println("Number of Names for first array:");
n=Integer.parseInt(br.readLine());
System.out.println("Number of Names for second array:");
m=Integer.parseInt(br.readLine());
str1=new String[n];
str2=new String[m];
str3=new String[n+m];
System.out.println("Names for 1st array:");
for(i=0;i< n;i++)
{
System.out.println("Name:");
str1[i]=br.readLine().trim();
}
System.out.println("Names for 2nd array:");
for(i=0;i< m;i++)
{
System.out.println("Name:");
str2[i]=br.readLine().trim();
}
sort();
merge();
display();
}
private void sort()
{
int flag;
for(i=0;i< n;i++)
{
flag=0;
 for(j=0;j< n-i-1;j++)
 {
 if(str1[j].compareTo(str1[j+1]) >0)
 {
  s=str1[j];
  str1[j]=str1[j+1];
  str1[j+1]=s;
  flag=1;
  }
  }
  if(flag==0)
  break;
  }
for(i=0;i< m;i++)
{
flag=0;
 for(j=0;j< m-i-1;j++)
 {
 if(str2[j].compareTo(str2[j+1]) >0)
 {
  s=str2[j];
  str2[j]=str2[j+1];
  str2[j+1]=s;
  flag=1;
  }
  }
  if(flag==0)
  break;
  }
}
private void merge()
{
int x=0;
 i=0;
 j=0;
 while(i!=n && j!=m)
 {
  if(str1[i].compareTo(str2[j])< =0)
     str3[x++]=str1[i++];
  else
     str3[x++]=str2[j++];
 }
 if(i==n)
 {
  for(;j< m;j++)
  str3[x++]=str2[j];
 }
 else
 {
  for(;i< n;i++)
  str3[x++]=str1[i];
 }
 }
  private void display()
 {
  System.out.println("\nSorted Merged Names\n");
  for(i=0;i< m+n;i++)
  System.out.println(str3[i]);
  System.out.println("\n*********\n");
  System.out.println("\nFirst array names\n");
  for(i=0;i< n;i++)
  System.out.println(str1[i]);
  System.out.println("\n*********\n");
  System.out.println("\nSecond array names\n");
  for(i=0;i< m;i++)
  System.out.println(str2[i]);
  }
 public static void main(String args[])throws Exception
{
SortedNames obj=new SortedNames();
obj.take();
}
}

Program Number 3

ISC 2019 English Paper II Suggestions (New Syllabus): CLICK HERE

A new advanced Operating System, incorporating the latest hi-tech features has been designed by Opera Computer System. The task of generating copy protection codes to prevent software piracy has been entrusted to the Security Department. The security department has decided to have codes containing a jumbled combination of alternate uppercase letters of the alphabet starting from A upto K (namely among A,C,E,G,I,K). The codes may or may not be in the consecutive series of alphabets.

Develop a program to input a code and its length. At the first instance of an error display “Invalid!” stating the appropriate reason. In case of no error, display the message “Valid!”

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

SAMPLE DATA
INPUT
N = 4
ABCE
OUTPUT
Invalid! Only alternate letters permitted!
INPUT
N = 4
AcIK
OUTPUT
Invalid! Only upper case letters permitted!
INPUT
N = 4
AAKE
OUTPUT
Invalid! Repetition of characters not permitted!
INPUT
N = 7
OUTPUT
Error! Length of string should not exceed 6 characters!
INPUT
N = 4
AEGIK
OUTPUT
Invalid! String length not the same as specified!
INPUT
N = 3
ACE
OUTPUT
Valid!
INPUT
N = 5
GEAIK
OUTPUT
Valid!

To view the codes of this program follow this link.


Related Posts:
ISC 2007 Computer Practical Paper
ISC Computer Practical Paper - 2008
ISC 2010 Computer Practical
ISC 2011 Computer Practical solved paper

19 comments:

  1. hi please sujjest some guess papers for practicals to be held on 25th

    ReplyDelete
  2. Solve the previous years practical papers. You can expect same type programs this year also.

    ReplyDelete
  3. ayr8 sir..thnks a lot

    ReplyDelete
  4. Please help me with this program

    INPUT:141296
    OUTPUT:14TH DECEMBER,96
    :VALID DATE

    INPUT:230488
    OUTPUT:23RD APRIL,88
    :VALID DATE

    INPUT:300284
    OUTPUT:INVALID DATE

    ReplyDelete
  5. Could you please post some programs that may give us some idea of what might come this year.

    ReplyDelete
  6. I have posted lot of guess programs for both ISc and ICSe students in this blog site. Please go through those programs.

    ReplyDelete
  7. The date format program is posted in my blog. Please search.

    ReplyDelete
  8. sir, please post some programs which might come this year

    ReplyDelete
  9. You will find lot of guess programs in this blog site. Go through those programs and definitely same type of programs will be in your examination paper.

    ReplyDelete
  10. hi.......
    sir please tell me how to print the prime factors of a given number....

    ReplyDelete
  11. Already posted. Please search it.

    ReplyDelete
  12. you are great Mr.Dhananjoy!!

    ReplyDelete
  13. sir please post the answer of the third question bcoz this question is important for my isc project this year please sir post the answer of third question by thursday.plz from avirup sengupta

    ReplyDelete
  14. Program is posted few days back. Please follow the link.

    ReplyDelete
  15. sir please say how to do this one....
    INPUT:
    4
    OUTPUT:
    3 1
    2 2
    2 1 1
    1 1 1 1

    ReplyDelete
  16. Search in my blog with the string: BlueJ program on all possible consecutive number combinations

    ReplyDelete
  17. ICSE 2012 Question Number 8

    Write a program to accept a string. Convert it to uppercase. Count and output the number of double letter sequence that exist in string.

    Sample Input: SHE WAS FEEDING THE LITTLE RABBIT WITH an apple
    Output: 4

    import java.io.*;
    public class stringcount {

    public static void main(String args[])throws IOException
    {
    String s;
    String s1= " ";
    int l,i,j,count=0;
    char c,c1=' ';
    char c2,c3;
    InputStreamReader in=new InputStreamReader(System.in);
    BufferedReader br=new BufferedReader(in);
    System.out.println("Enter the String");
    s=br.readLine();
    l=s.length();

    for(i=0;i='a'&& c<='z')
    {
    c1=Character.toUpperCase(c);

    s1=s1+c1;
    }
    else
    {
    s1=s1+c;
    }
    }

    for(j=0;j<l-1;j++)
    {
    c2=s.charAt(j);
    c3=s.charAt(j+1);
    if(c2==c3)
    {
    count++;
    }
    }

    System.out.println(s1);
    System.out.println("Number of double letter word are"+"\t"+count);



    }
    }

    ReplyDelete
  18. ICSE 2012 Computer application Question Number 7

    Design a class to overload a function polygon as follows
    (i) void polygon(int n,char ch) with one integer argument and one character type argument that draws a filled square of side n using the character stored in ch
    (ii) void polygon(int x,int y): with two integer argument that draws a filled rectangle of length x and breadth y using the symbol @
    (iii) void polygon() with no argument that draws a filled triangle shown below
    *
    **
    ***

    public class overload {

    void polygon(int n,char ch)
    {
    int i,j;
    for(i=1;i<=n;i++)
    {
    for(j=1;j<=n;j++)
    {
    System.out.print(ch);
    }
    System.out.println();
    }
    }
    void polygon(int x,int y)
    {
    int i,j;
    for(i=1;i<=x;i++)
    {
    for(j=1;j<=y;j++)
    {
    System.out.print('@');
    }
    System.out.println();
    }
    }
    void polygon()
    {
    int i,j;
    for(i=1;i<=3;i++)
    {
    for(j=1;j<=i;j++)
    {
    System.out.print('*');
    }
    System.out.println();
    }
    }
    public static void main(String args[])
    {
    overload o=new overload();
    o.polygon(2,'O');
    o.polygon(2, 5);
    o.polygon();
    }
    }

    ReplyDelete

Subscribe via email

Enter your email address:

Delivered by FeedBurner