Search This Blog

Loading...

Saturday, February 26, 2011

ISC 2011-solved computer application practical programs


Program Number 1 of ISC 2011 on displaying number in word

Write a program to input a natural number less than 1000 and display it in words. Test your program on the sample data and some random data.


Sample input and output of the program

Input: 29
Output: TWENTY NINE

Input: 17001
Output: OUT OF RANGE

Input: 119
Output: ONE HUNDRED AND NINETEEN

Input: 500
Output: FIVE HUNDRED

 Codes of the program

import java.io.*;
class Program1
{
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
  String str="",str1="",str2="";
 int h=0,t=0,u=0,i=0,n;
 public void takeNumber() throws Exception
 {
  System.out.println("\nEnter the number:");
  n=Integer.parseInt(br.readLine());
  if(n<1 || n>999)
  {
    System.out.println("\nINVALID ENTRY:");
    return;
  }
  while(true)
  {
   if(i==0)
   u=n%10;
   else if(i==1)
   t=n%10;
   else if(i==2)
   h=n%10;
   i++;
   n=n/10;
   if(n==0)
   break;
   }
  if(h!=0)
  str=word1(h)+ " HUNDRED ";
  if(t>1)
  str1= word2(t);
  if(t==1)
  str2= word3(u);
  else
  str2=word1(u);
  if(!str1.equals("") || !str2.equals(""))
  str=str+ "AND ";
  if(!str1.equals(""))
  str=str+ str1+ " ";
  if(!str2.equals(""))
  str=str+ str2;
  System.out.println(str);
 }
 String word1(int x)
 {
  String s="";
  switch(x)
  {
   case 1:
   s="ONE";
   break;
   case 2:
   s="TWO";
   break;
   case 3:
   s="THREE";
   break;
   case 4:
   s="FOUR";
   break;
   case 5:
   s="FIVE";
   break;
   case 6:
   s="SIX";
   break;
   case 7:
   s="SEVEN";
   break;
   case 8:
   s="EIGHT";
   break;
   case 9:
   s="NINE";
   break;
   }
    return s;
    }
 String word2(int x)
 {
  String s="";
  switch(x)
  {
   case 2:
   s="TWENTY";
   break;
   case 3:
   s="THIRTY";
   break;
   case 4:
   s="FOURTY";
   break;
   case 5:
   s="FIFTY";
   break;
   case 6:
   s="SIXTY";
   break;
   case 7:
   s="SEVENTY";
   break;
   case 8:
   s="EIGHTY";
   break;
   case 9:
   s="NINETY";
   break;
   }
    return s;
    }
 String word3(int x)
 {
  String s="";
  switch(x)
  {
   case 0:
   s="TEN";
   break;
   case 1:
   s="ELEVEN";
   break;
   case 2:
   s="TWELVE";
   break;
   case 3:
   s="THIRTEEN";
   break;
   case 4:
   s="FOURTEEN";
   break;
   case 5:
   s="FIFTEEN";
   break;
   case 6:
   s="SIXTEEN";
   break;
   case 7:
   s="SEVENTEEN";
   break;
   case 8:
   s="EIGHTEN";
   break;
   case 9:
   s="NINETEEN";
   break;
   }
    return s;
    }

  public static void main(String args[]) throws Exception
  {
   Program1 ob=new Program1();
   ob.takeNumber();
   }
   }
Program Number 2 of ISC 2011-encryption of message


Encryption is a technique of coding messages to maintain their secrecy. A String array of size ‘n’ where ‘n’ is greater than 1 and less than 10, stores single sentences (each sentence ends with a full stop) in each row of the array.

Write a program to accept the size of the array. Display an appropriate message if the size is not satisfying the given condition. Define a string array of the inputted size and fill it with sentences row-wise. Change the sentence of the odd rows with an encryption of two characters ahead of the original character. Also change the sentence of the even rows by storing the sentence in reverse order. Display the encrypted sentences as per the sample data given below.

Test your program on the sample data and some random data.

Input: n=4

IT IS CLOUDY.
IT MAY RAIN.
THE WEATHER IS FINE.
IT IS COOL.

Output:
 KV KU ENQWFA.
RAIN MAY IT.
VJG YGCVJGT KU HKPG.
COOL IS IT.

Input: n=13
Output: INVALID ENTRY

Codes of this encryption program using BlueJ

import java.io.*;
class Program1
{
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
 String str[],s;
 int i,n;
 public void takeString() throws Exception
 {
  System.out.println("\nHow many sentences:");
  n=Integer.parseInt(br.readLine());
  if(n<1 || n>9)
  {
    System.out.println("\nINVALID ENTRY:");
    return;
  }
  str=new String[n];
  for(i=0;i< n;i++)
  {
    System.out.println("\nEnter sentence ( ends with full stop):");
    s=br.readLine().trim();
    if(s.charAt(s.length()-1)!='.')
    {
     System.out.println("\nFull stop at the end is mandatory:");
     i--;
     continue;
     }
    str[i]=s;
  }
  for(i=0;i< n;i++)
  {
   s=str[i];
   if(i%2==0)
   encrypt(s);
   else
   reverse(s);
  }
  }
  public void encrypt(String s)
  {
   int i,len;
   char ch;
   String st="";
   len=s.length();
   for(i=0;i< len;i++)
   {
    ch=s.charAt(i);
    if((ch >=65 && ch< =90)||(ch >=97 && ch< =122))
    {
       ch=(char)(ch+2);
  if(ch >90 && ch< 97)
  {
   ch=(char)((64+ch-90));
   }
  else if(ch >122)
  {
   ch=(char)((96+ch-122));
   }
 }
  st=st+ch;
  }
 System.out.println(st);
 }

 public void reverse(String s)
 {
  int i;
  String s1;
  s=s.trim();
  s=s.substring(0,s.length()-1);
  while(true)
  {
  i=s.lastIndexOf(" ");
  if(i<0)
  break;
  s1=s.substring(i).trim();
  System.out.print(s1+ " ");
 s=s.substring(0,i).trim();
 }
 System.out.println(s+".");
 }
  public static void main(String args[]) throws Exception
  {
   Program1 ob=new Program1();
   ob.takeString();
   }
   }


Program Number 3 of ISC 2011 on displaying day number

Design a program which accepts your date of birth in dd mm yyyy format. Check whether the date entered is valid or not. If it is valid, display “VALID DATE”, also compute and display the day number of the year for the date of birth. If it is invalid, display “INVALID DATE” and then terminate the program.


Testing of the program


Input: Enter your date of birth in dd mm yyyy format

05
01
2010

Output: VALID DATE
5

Input: Enter your date of birth in dd mm yyyy format

03
04
2010

Output: VALID DATE
93


Input: Enter your date of birth in dd mm yyyy format

34
06
2010

Output: INVALID DATE


Codes of this BlueJ program on displaying number of days

import java.io.*;
class Program1
{
 int days[]={31,28,31,30,31,30,31,31,30,31,30,31};
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
 int d,m,y;
 public void takeDate() throws Exception
 {
  System.out.println("Enter your date of birth in dd mm yyyy format:");
  d=Integer.parseInt(br.readLine());
  m=Integer.parseInt(br.readLine());
  y=Integer.parseInt(br.readLine());
 if(m<=0 || m>12)
 {
   System.out.println("INVALID MONTH");
   return;
  }
 else if(d<=0 || d>12)
 {
   System.out.println("INVALID DATE");
   return;
  }
  y=validDate(d,m,y);
  if(y>0)
  {
  System.out.println(" VALID DATE\n"+y);
  }
  else
  {
  System.out.println(" INVALID DATE");
  return;
  }
  }
  int validDate(int d1,int m1,int y1)
  {
  
  int li,i;
  li=leap(y1);
  if(d1>days[m1-1])
  return 0;
  else
  {
   for(i=0;i< m1-1;i++)
   {
    d1=d1+days[i];
   }
    d1=d1+li;
    return d1;
  }
  }
   int leap(int y)
   {
    if(y%100==0 && y%400==0)
    return 1;
    else if(y%100!=0 && y%4==0)
    return 1;
   else
   return 0;
   }
   public static void main(String args[]) throws Exception
   {
    Program1 ob=new Program1();
    ob.takeDate();
    }
    }

Related Posts:  
Guess Computer Application 2015 Theoretical and Practical Examination

Last Minutes Suggestions for ISC 2013
ISC Computer Practical Programs - 2005
ISC Computer Practical Programs - 2006
ISC 2007 Computer Practical Paper
ISC Computer Practical Paper - 2008
ISC 2010 Computer Practical

46 comments:

  1. really easy paper this tym....:):)

    ReplyDelete
  2. sir attempting all questions n the practical is compulsary or any choice is given?

    ReplyDelete
  3. sir can you please solve the isc 2011 computer science theory and practical papers and post it............................................

    ReplyDelete
  4. ISC practical paper of 2011 has been posted in this site earlier. Please search. Post the theory paper in this site, I will solve the paper.

    ReplyDelete
  5. Sir please solve problem number 3 of ISC 2006 it will be of great help to me. The problem with protection code in an Operating System

    ReplyDelete
  6. Sorry for the late. My next post will be on this program Just wait for another two days.

    ReplyDelete
  7. please tell me how to make program of circular decoding i.e. when "AbZ" is entered, it returns "bCa".It converts the case as well as increases the letter by one( to 'a' in case of 'z').

    ReplyDelete
  8. if(ch >90 && ch< 97)
    {
    ch=(char)((64+ch-90));
    }
    else if(ch >122)
    {
    ch=(char)((96+ch-122));
    }
    }
    SIR IM UNABLE TO UNDERSTND WHY U HAVA CHKD THAT IF CHARACTER LIES BETWEEN 90 AND 97 AND GREATER THAN 122 WHICH TYPE OF CHRACTERS LIE B/W 90 AND 97 AND ABOVE 122

    ReplyDelete
    Replies
    1. Characters are shifted in forward direction here in this program so after shifting it may exceed the range of alphabet. That's why the checking is done and the character is changed in circular manner.

      Delete
  9. please sir tell in viva which type of ques are asked
    my practcal is on 24th

    ReplyDelete
    Replies
    1. It depends on the program. Normally the questions are based on the program.

      Delete
    2. sir this year are chANCES OF DATE RELATED PRGRMS TO COME

      Delete
    3. Since you will get three questions, it is possible

      Delete
  10. how do we write algorithm in programs??????
    pls tell the key things....

    ReplyDelete
    Replies
    1. Algorithm is the structure of a program, not the executable codes. Write the sequences of the program in your own language step wise.

      Delete
  11. sir plz can u tell expected questions to come in isc computer practical 2012

    ReplyDelete
    Replies
    1. I have already posted expected programs but please go through all type programs of the previous years.

      Delete
  12. Can you please tell me for ISC 2012 computer practical what kind of java programs i should practice related to string?

    Please reply

    ReplyDelete
    Replies
    1. Please go through the previous year practical papers. Similar type of programs are expected.

      Delete
  13. Sir please tell me what does .trim() function means here what this function will do in taking text?

    text=br.readLine().trim();

    ReplyDelete
    Replies
    1. 'trim()' is a function of String class which eliminates the leading or trailing space from the entered value, if any.

      Delete
  14. Can I know what is important for ISC 2012?

    ReplyDelete
  15. how do we use valueOf in java??????
    pls tell the syntax......

    ReplyDelete
    Replies
    1. valueOf() is a static function of String class which takes any primitive value as argument and convert it into string object.

      int a=10;
      String s=String.valueOf(a)
      Now 's' is "10";

      Delete
  16. sir,I am a beginner in java.
    wanted to know whether the past year papers will help me build any base?
    I also wanted to know whether there are any tutorials for java on the net?

    ReplyDelete
  17. Sir could this program be a shorter version of what you did I made it... Is it correct?

    import java.util.Scanner;
    import java.io.*;
    public class Q1_2011
    {
    public static void main()
    {
    Scanner ob= new Scanner(System.in);
    String[] a = {"ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","TEN","ELEVEN","TWELVE","THIRTEEN","FOURTEEN","FIFTEEN","SIXTEEN","SEVENTEEN","EIGHTEEN","NINETEEN","TWENTY","THIRTY","FOURTY","FIFTY","SIXTY","SEVENTY","EIGHTY","NINETY"};
    System.out.println("Enter amount:");
    int amt = ob.nextInt();
    int rev = amt/100;
    amt=amt-(rev*100);
    if(rev!=0)
    {
    System.out.print(a[rev-1]+" HUNDRED");
    }
    else
    {
    System.out.print("");
    rev=amt/10;
    amt=amt-(rev*10);
    if(rev!=0)
    {
    if(amt!=0&&rev!=1)
    {
    System.out.print(a[rev+17]+" "+a[amt-1]);
    }
    else if(rev==1)
    {
    System.out.print(a[amt+9]);
    }
    else
    {
    System.out.print("");
    }
    }
    }
    rev=amt/10;
    amt=amt-(rev*10);
    if(rev!=0)
    {
    if(amt!=0&&rev!=1)
    {
    System.out.print(" AND "+a[rev+17]+" "+a[amt-1]);
    }
    else if(rev==1)
    {
    System.out.print(" AND "+a[amt+9]);
    }
    else
    {
    System.out.print("");
    }
    System.out.println();


    }
    }
    }

    ReplyDelete
  18. Where's 2009 solved practical paper?

    ReplyDelete
    Replies
    1. 2009 question paper is not available in net, if anyone can send it, I will solve the paper.

      Delete
  19. Dhananjoy Chakraborty Sir , which programs should i practice for 2013 exam whic will be on this monday ?

    ReplyDelete
  20. sir can we expect 2d array nd date prorgrams this year??

    ReplyDelete
  21. What type of question can come for 2014 computer practical exam ?

    ReplyDelete
  22. Sir
    is it fine if we don't write the question number in the answer paper ?
    I am a bit worried..
    Do they cut marks for that ?

    ReplyDelete
    Replies
    1. Thank you soo much sir.
      Now i am a bit relieved.

      Delete

CHECK HERE FOR PREVIOUS POSTS

Google+ Followers

Subscribe via email

Enter your email address:

Delivered by FeedBurner