Tuesday, May 18, 2010

ICSE Board guess question, answer and sample programs on BlueJ (2)


Today we'll deal with icse computer applications sample papers.

Write any two rules for naming varible declaration.
Two rules of variable declaration are
(i) Variable name must start with an alphabet
(ii) Java keywords can't be used as variable name

Write down the difference between prefix and postfix operators.

Prefix and postfix operators while used in single statement has no difference. e.g
int a=10;
a++ or ++a has the same meaning,both are incremented by 1 after the statement is executed. But in expression they reacts differently.
e.g int a=10;
System.out.println(a++);
Here the output will be 10 as when postfix expression is used in expression, the expression executes first and then the operator works. So println() will display 10 and after that 'a' will be incremented by 1.
Again in prefix, the operator will work first and after that the expression will work.
e.g
int a=10;
System.out.println(++a);
Here the output will be 11.

 A class is a user-defined data type. Say whether the statement is correct or not and justify your answer.

This statement is correct as we know that type defines the nature and behavior of it's instance. By defining a class we also defines the nature and behavior of it's instance which are known as object.So class can be called as user defined data type.

Give an example of conditional operator.

Suppose int a,b,max are three variables and a and b holds unique value. We want to assign the maximum value on the variable max.
Using conditional statement we can write the codings as below
max=(a>b)?a:b;

Write a function to suppress negative elements of an array to bottom without altering the original sequence i.e. if array contains
5 , -4 , 3 , -2 , 6 , -11 , 12 , -8 , 9 
Then the return array will be  : 5 , 3 , 6, 12 , 9 , -4 , -2 ,  -11 ,  -8 

int separate(int a[],int n)
{
int pos[]=new int[n];
int neg[]=new int[n];
int i,p=0,n1=0
for(i=0;i< n;i++)
{
if(a[i] >=0)
pos[p++]=a[i]
else
neg[n1++]
}
 for(i=0;i< p;i++)
a[i]=pos[i];
for(int j=0;j< n1;j++)
a[i++]=neg[j];
return a;
}

What is inheritance and how is it useful in java ?

Inheritance is the process of acquiring properties, means data members and function members  of any defined class in another class. Inheritance means reuse of codes. By the power of inheritance a class can acquire nature and behavior of a predefined class without writing a single line of code.
There are three types of inheritance - multilevel, multiple and hierarchical. Java supports multilevel and hierarchical inheritance.

What is an exception ? how does java deal with it ?

Exception means run time abnormality.
Java uses Exception Handler to deal with such situation. In java we can use throws clause, try....catch , try...finally block and throw clause as exception handler.

What is meant by polymorphism? Give an example.

Polymorphism is one of the four features of OOPs. When same operator or same function behaves differently in different environment, it is called polymorphism. There are three types polymorphism, operator overloading, function overloading and
function overriding. Constructor overloading is an example of function overloading.

State difference between call-by-value and call-by-reference.

When variables are used as actual and formal argument, it is called call by value and call by reference means when objects are used as actual and formal arguments.

What output will the following code fragment produce ?
int val=9, res , n =1000;

res = n + val > 1750 ? 400 : 200 ;

System.out.println(res);


Output will be 200

What will be the result of following two expressions if I =10 initially ?                                            

I )    ++ I <=10     II ) I++ <=10For the first statement the result will be false and for the second statement the result will be true.Given the following set of identifiers:
long longval ; char ch ; int intval ; float fl ; short sh ;
Identify the datatype of the following expressions:

a) ‘a’-3    b) intval*longval-ch    c) fl+ longval/sh    d) longval * 3

Ans: a) int
b) long
c) float
d) long

Write a java program to print largest even and largest odd number from a list of
numbers entered through keyboard. The list terminates as soon as one enter 0 (zero).

import java.io.*;
class Max
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int maxeven=1,maxodd=2,n;
void take() throws IOException
{
for(;;)
{
System.out.println("Enter the number:");
n=Integer.parseInt(br.readLine());
if(n==0)
break;
if(n%2==0 && maxeven==1)
maxeven=n;
elseif(n%2==0 && n > maxeven)
maxeven=n;
elseif(n%2!=0 && maxodd=2)
maxodd=n;
elseif(n%2!=0 && n > maxodd)
maxodd=n;
}
System.out.println("Maximum even number="+maxeven);
System.out.println("Maximum odd number="+maxodd);
}
}
 Write a java program to print fibonacci series i.e. 0 1 1 2 3 5 8 ………. 

class Fib
{
int i,p=0,c=1,next;
void  show(int n)
{
System.out.println("Series is as follows:" + p+" "+ c);
for(i=0;i< n-2;i++)
{
next=p+c;
System.out.println(" "+next);
p=c;
c=next;
}
}
}


Let A (n* n) be a two dimensional array. Write a program to find sum of all the elements which lie on either diagonal.

For example for the matrix shown below, your program should output 68 = (1 + 6+11+16+4+7+10+13)                  

1 2 3 4
5 6 7 8
9 10 11 12                                  
13 14 15 16



import java.io.*;
class Mat
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int a[]=new int[4][4];
int i,j,sum=0

void take() throws IOException
{
for(i=0;i< 4;i++)
{
for(j=0;j< 4;j++)
{
System.out.println("Enter the number:");
a[i][j]=Integer.parseInt(br.readLine());
}
}
for(i=0;i < 4;i++)
{
for(j=0;j < 4;j++)
{
if(i==j || i+j==3)
sum+=a[i][j];
}
}
System.out.println("sum of the diagonals="+sum);
}
}

This page is on icse sample papers . If you have any doubt in any program, pl. feel free to put your comments. I am here to clear your doubts.


118 comments:

  1. if i m doing java programming by making function inside the class and called it through the object from main method of that class.please tell me either this method is right for ICSE students or not.

    ReplyDelete
  2. Dear friend! You can define main() function in BlueJ programs also and can call functions from inside the main() function. There is nothing wrong.

    ReplyDelete
  3. Sir,can you please tell the logic for the following programs-
    a)WAP to enter a sentence and tell the longest word in it.
    b)WAP to enter a sentence and then input a word and tell how many times the word appear in the sentence.
    A STUDENT(ICSE)
    email-bon2heg@gmail.com

    ReplyDelete
  4. For the first program you have to retrieve one after another word from the sentence using indexOf() function of String class.
    As you do not the number of words in the string, execute an infinite loop as we know that return value of
    the function indexOf() is -1 when the searched character or string is not available in the invoking string object.
    Within the loop consider the first word as the word with maximum length and afterwards compare the current word retrieved with the
    word with maximum length and take necessary action. Keep it mind that when the loop breaks, strill the last word is compared, so compare it
    outside the loop body.


    import java.io.*;
    class Pattern
    {
    String s1,s2,word;
    int pos;
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    public void take() throws IOException
    {
    int x=0;
    System.out.println("Enter the sentence:");
    s1=br.readLine().trim();
    while(true)
    {
    pos=s1.indexOf(' ');
    if(pos<=0)
    break;
    s2=s1.substring(0,pos);

    s1=s1.substring(pos+1);
    if(x==0)
    word=s2;
    else if(s2.length()>word.length())
    word=s2;
    x++;
    }
    if(s1.length()>word.length())
    word=s2;
    System.out.println("Word with maximum length="+word);
    }
    public static void main(String args[]) throws IOException
    {
    Pattern ob=new Pattern();
    ob.take();
    }
    }

    For the second program you take the string, the word to be replaced and the word with which
    replacement will be done. Search the word in the sentence and if found, take the left part
    of the string, replace the word and take the right part of the sentense.
    String functions to be used here. For string class functions visit: String class and its methods
    The loop construction would be same as the previous program


    import java.io.*;
    class Pattern
    {
    String s1,s2,word1,word2;
    int pos;
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    public void take() throws IOException
    {
    System.out.println("Enter the sentence:");
    s1=br.readLine().trim();
    System.out.println("Enter the word to replace:");
    word1=br.readLine().trim();
    System.out.println("Enter the word with which replacement will be done:");
    word2=br.readLine().trim();

    while(true)
    {
    pos=s1.indexOf(word1);
    if(pos<=0)
    break;
    s2=s1.substring(0,pos);

    s1=s1.substring(pos+1+word1.length());
    s1=s2+ " " + word2+ " "+s1;
    }
    System.out.println("Word with maximum length="+s1);
    }
    public static void main(String args[]) throws IOException
    {
    Pattern ob=new Pattern();
    ob.take();
    }
    }

    ReplyDelete
    Replies
    1. Sir why do you all the time use functions in ur programs.I am a student in class 10th ICSE.I can do all these programs without function.

      Delete
    2. You are doing java programs without using function? How??? Go through any of your programs and check at least one function is used. Please go through the encapsulation definition - only functions can manipulate data members.

      Your question is that why I use functions in every program? A detail study of function is needed. Functions are mini programs and each functions perform a specific job. Please go through your own programs where you have used one function and the same function is taking values, manipulating values and displaying values. Suppose I want to take values only but your program will perform all the functions defined inside the function body. To make the thing clear - brake, horn are functions in a motor bike. You are the designer of the bike and not interested to keep so many functions so brake and horn are put in one function. What will happen? The rider will be happy?

      I think you have got your answer. If you are still in the conception that you can do java programs without function, please send me one such sample.

      I don't know you are from which school but I know some schools where teachers have some problems in using functions. This is simply lack of knowledge.

      Delete
  5. Sir the output of the second program is jumbled up for both-I can't understand-
    1)output of second program-
    ....................................
    [ Pattern.main({ }) ]
    Enter the sentence:
    The little fox jumped over the little lazy dog
    Enter the word to replace:
    the
    Enter the word with which replacement will be done:
    A
    Word with maximum length=The little fox jumped over A little lazy dog
    ...........................
    2)Sir, what is the difference bet. compareTo ()
    and equals() function?
    And in our book it tells that-compareTo compares two strings lexicographically..what does it mean here?
    Sir,please help.
    STUDENT(ICSE)

    ReplyDelete
  6. Thank you for bringing this error in my notice. Actually I developed this program on modifying a previous one on displaying the word with max. length in a sentence. That program is also posted in this blog. Simply replace the string 'Word with maximum length' with 'Modified string'

    In my post on 'string functions', I think I have discussed about these two functions. Anyway
    equals() function compares two strings for equality. This function can tell you if the invoking string object and the argument string object are same.

    'compareTo()' checks for equality also but it gives a clear idea about the invoking string object and the argument string object. If the return value is '0' it means both are same, if the return value is more than '0' it means the invoking string is greater than the argument string. A negative return value indicates that the argument string is greater.

    ReplyDelete
  7. Sir,But please notice that the replacement by 'A' in the sentence did not occur on first 'the' but on the second one!
    --------------------
    [ Pattern.main({ }) ]
    Enter the sentence:
    The little fox jumped over the little lazy dog
    Enter the word with which replacement will be done:
    A
    Modified String=The little fox jumped over A little lazy dog
    ---------------------
    Please help!
    Your obedient
    STUDENT(ICSE)

    ReplyDelete
  8. Your sentence has started with 'The', not 'the' and you want to replace 'the' with 'A' then how the starting 'The' will be replaced?

    If you want to replace all words with same alphabets, simply modify the sentence and the words into upper case, replace words and after that modified upper case sentence into normal sentence with the first character in upper case and the others in lower case.

    ReplyDelete
  9. OH!I understand!Thank you,Sir!
    Ayan(ICSE)

    ReplyDelete
  10. Sir.,please can you help me out with how to hide a class when using two classes in a same program,accessing the methods of the first class from the second class without running the 1st class......i am pretty weak in computer and i will be appearing in ICSE 11...so it wud be great if u help.....

    ReplyDelete
  11. import java.io.*;
    class First
    {
    int i,j,k,x;
    public void display()
    {
    for(i=0;i<5;i++)
    {
    x=i+1;
    for(j=0;j<=i;j++)
    {
    System.out.print(x+" ");
    if(x==8)
    x--;
    else
    x++;
    }
    x=x-2;
    for(k=0;k<i;k++)
    {
    System.out.print(x+" ");
    x--;
    }
    System.out.println();
    }
    }
    }
    Class Smith1
    {

    public static void main(String args[])throws IOException
    {
    First ob=new First();
    ob.display();
    }

    }

    ReplyDelete
  12. @ Anonymous
    is this Ayan Bhattacharjee?

    ReplyDelete
  13. sir can u kindly solve this below prg and give me before tomo evening,because i have my 12th computer practicals on this friday...
    Accept a paragraph of text consisting of sentences that are terminated by either “.”, “,”, “!” or a “?” followed by a space. Assume that there can be a maximum of 5 sentences in a paragraph.
    Design a program to perform the following:
    (a) Arrange the sentences in alphabetical order of words, sentence by sentence.
    (b) Separate the words which begin with a vowel.

    Sample data 1:
    INPUT : HELLO! HOW ARE YOU? WHEN ARE YOU COMING? HOPE TO SEE YOU SOON.
    OUTPUT: HELLO! ARE HOW YOU? ARE COMING WHEN YOU? HOPE SEE SOON TO
    YOU

    ReplyDelete
  14. Please check my post 'ISC Computer Practical - 2008' in this blog.

    ReplyDelete
  15. Sir
    please tell me the programme of
    n=4
    1+1+1+1
    1+1+2
    1+3
    2+2


    from sarita lko

    ReplyDelete
  16. The program is posted recently. What you want to know?

    ReplyDelete
  17. sir i want a program (menu driven) to perform addition,subtraction,multiplication of matrix

    ReplyDelete
  18. Please check my post on 20 March 2011

    ReplyDelete
  19. plz post a sample program for this ques:
    WAP TO INPUT A THREE WORD NAME (e.g-Subhas chandra bose) and the output should be : "S.C. Bose".... plz do this using SCANNER CLASSES.

    ReplyDelete
  20. Please check my post on 28 January 2011.

    ReplyDelete
  21. Very happy to find this blog... Can you please give an example to show constructors are used to initilize private data members of a class.

    ReplyDelete
  22. class A
    {
    private int a,b;
    A(int x, int y)
    {
    a=x;
    b=b;
    }
    void show()
    {
    System.out.println("Sum=" (a+b));
    }
    }

    ReplyDelete
  23. please solve this:
    WAP in java to accept an email id from the user and then print whether it is a valid email or not.

    ReplyDelete
  24. Please solve:
    Write a program to print all prime palindrome numbers between 100 and 9999.

    ReplyDelete
  25. import java.io.*;

    class Word
    {
    int i,j;
    public void show()
    {
    for(i=100; i< =9999; i++)
    {
    if(prime(i) && palindrome(i))
    System.out.print(" "+i);
    }
    }
    boolean prime( int n)
    {
    for(j=2;j< n;j++)
    {
    if(n%j==0)
    break;
    }
    if(j==n)
    return true;
    else
    return false;
    }
    boolean palindrome(int n)
    {
    int r=0;
    for(j=n;j >0;j=j/10)
    {
    r=r*10+j%10;
    }
    if(r==n)
    return true;
    else
    return false;
    }
    public static void main(String args[])
    {
    Word ob=new Word();
    ob.show();
    }
    }

    ReplyDelete
  26. sir could you tell me how to check if a no is automorphic or not

    ReplyDelete
  27. This type of program is posted in my blog. Please search.

    ReplyDelete
  28. Hi,can you please host a program to enter a string using scanner and find out the number of words,spaces,letters,numbers and special characters? I am new to java and I would be very thankful if you could host this program.thanks in advance

    ReplyDelete
  29. Please check my post on 25 October 2011.

    ReplyDelete
  30. wap to input any given string to calculate the total no. of character and vowels present in the string and also reverse it.

    ReplyDelete
  31. import java.io.*;
    public class Str
    {
    int i,len,v=0,c=0;
    String str,str1,str2="";
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    public void show()throws Exception
    {
    System.out.println("Enter the string:");
    str=br.readLine();
    str1=str.toUpperCase();
    len=str1.length();
    for(i=0;i< len;i++)
    {
    switch(str1.charAt(i))
    {
    case 'A':
    case 'E':
    case 'I':
    case 'O':
    case 'U':
    v++;
    break;
    }
    if (str1.charAt(i)>=65 && str1.charAt(i)<=90)
    c++;
    }
    System.out.println("\n Number of vowels="+v);
    System.out.println("\n Number of characters="+c);
    for(i=len-1;i>=0;i--)
    str2=str2+str.charAt(i);
    System.out.println("\n Reversed string="+str2);
    }


    public static void main(String args[])throws Exception
    {
    Str ob=new Str();
    ob.show();
    }
    }

    ReplyDelete
  32. Wap to input a string and print frequency to each character of the string.

    ReplyDelete
  33. Today I have posted the same program.

    ReplyDelete
  34. wap to derive a calculator which is capable of doing basic calculation using switch case.

    ReplyDelete
  35. please sove the pattern

    1
    10
    101
    1010
    10101

    ReplyDelete
  36. I think this program is posted in my blog. Please navigate through 'label'. Anyway I am posting the program again.

    class P
    {
    int i,j;
    public void show()
    {
    for(i=0;i<5;i++)
    {
    for(j=0;j<=i;j++)
    {
    if(j%2==0)
    System.out.print("!");
    else
    System.out.print(")");
    }
    System.out.println();
    }
    }
    }

    ReplyDelete
  37. Oh! What a mistake. Please write '1' instead of '!' and '0' instead of ')'.

    ReplyDelete
  38. _______A
    _____A B A
    ____A B C B A
    ___A B C D C B A
    __A B C D E D C B A
    ___A B C D C B A
    ____A B C B A
    ______A B A
    ________A

    ReplyDelete
  39. public class Series
    {
    int i,m,n,k,a=0,b=0;
    char x;
    public void show()
    {
    for(i=0;i<9;i++)
    {
    x='A';
    for(k=a;k<4;k++)
    System.out.print(" ");
    for(m=0;m<=b;m++)
    {
    System.out.print(x);
    x=(char)(x+1);
    }
    x=(char)(x-2);
    for(n=0;n<b;n++)
    {
    System.out.print(x);
    x=(char)(x-1);
    }
    System.out.println();
    if(i<9/2)
    {
    a++;
    b++;
    }
    else
    {
    a--;
    b--;
    }
    }
    }

    public static void main(String args[]) throws Exception
    {
    Series ob=new Series();
    ob.show();
    }
    }

    ReplyDelete
  40. ________1
    ______1 2 1
    ____1 2 3 2 1
    __1 2 3 4 3 2 1
    1 2 3 4 5 4 3 2 1

    please solve the above pattern.

    ReplyDelete
  41. public class Series
    {
    int i,j,m,n,x;
    char ch;
    public void show()
    {
    for(i=0;i<5;i++)
    {
    x=1;
    for(j=i;j<4;j++)
    System.out.print(" ");
    for(m=0;m<=i;m++)
    System.out.print(x++);
    x=x-2;
    for(n=0;n<i;n++)
    System.out.print(x--);
    System.out.println();
    }
    }
    public static void main(String args[]) throws Exception
    {
    Series ob=new Series();
    ob.show();
    }
    }

    ReplyDelete
  42. sir please tell the program of this pattern.
    ____________________*
    __________________*___*
    ________________*_______*
    ______________*___________*
    ________________*________*
    __________________*____*
    ____________________*

    ReplyDelete
    Replies
    1. import java.io.*;
      class Arr
      {
      int i,j,x,y=-1,k,m=4;
      public void show()
      {
      m=5;
      for (i=0;i<7;i++)
      {
      for(j=0;j<m;j++)
      System.out.print(" ");
      if(i!=6)
      System.out.print("*");
      for(k=0;k<y;k++)
      System.out.print(" ");
      if(i!=0)
      System.out.print("*");
      System.out.println();
      if(i<7/2)
      {
      y=y+2;
      m=m-1;
      }
      else
      {
      y=y-2;
      m=m+1;
      }
      }
      }
      }

      Delete
  43. Wap which will ask the user to enter a choice and based on the choice the following operation will take place.
    if choice=1; then sum of even nos. from the series of 10 nos.
    if choice=2; then sum of odd nos. from a series of 10 nos.
    if choice=3; then it will check whether the no is perfect or not from a series of 10 nos.
    please solve this program as early as posible.

    ReplyDelete
  44. Check my post on 12 January 2012

    ReplyDelete
  45. sir i want to ask a question ,write a program in java to accept an integer and print the frequency of all the digits present in the number.

    ReplyDelete
  46. How to variable description or mnemonic codes in java?
    all the programmes state that make a variable description or mnemonic code... but i am unaware how to actually make it!
    Can you please help sir!?

    ReplyDelete
  47. sir, i could you please tell me the use of wrapping a primitive datatypes's value in an object...and how can an object have a specific value
    for e.g Integer i = new Integer(5);
    what will this statement do?

    ReplyDelete
    Replies
    1. By this statement int value '5' is converted into an object 'i'. In java collection group of classes like LinkedList, Vector etc, only objects are stored. In those situations, wrapper classes are required.

      Delete
  48. please solve the pattern
    5 5 5 5 5
    4 4 4 4
    3 3 3
    2 2
    1

    ReplyDelete
    Replies
    1. class A
      {
      public void show()
      {
      int i,j;
      for(i=5;i>=1;i--)
      {
      for(j=i;j>=1;j--)
      {
      System.out.print(i+" ");
      }
      System.out.println();
      }
      }
      }

      Delete
  49. Sir..can you pls solve the programs of icse 2012 board ques...sir pls atleast some ques which you think as tuff.....

    icse student appearing 2013

    ReplyDelete
    Replies
    1. Very soon the solved paper will be posted.

      Delete
  50. write a program to accept "n" number of numbers from the user and display if two successive nos. entered happens to be even

    ReplyDelete
    Replies
    1. Your program will be posted very soon in BlueJ category

      Delete
  51. sir please solve this program
    4
    43
    432
    4321

    ReplyDelete
    Replies
    1. class P
      {
      public void show()
      {
      int i,j,x;
      for(i=0;i<4;i++)
      {
      x=4;
      for(j=0;j<=i;j++)
      {
      System.out.print(x);
      x--;
      }
      System.out.println();
      }
      }
      }

      Delete
  52. sir can u please write the program for the pattern
    1
    13
    135
    1357
    13579

    ReplyDelete
    Replies
    1. class Pat
      {
      int i,j,x;
      void show()
      {
      for(i=0;i<5;i++)
      {
      x=1;
      for)j=0;j<=i;j++)
      {
      System.out.print(x);
      x=x+2;
      }
      System.out.println();
      }
      }
      }

      Delete
  53. sir please help me wid these pattern

    JAVA
    AVA
    VA
    A
    fast please!!!!!

    ReplyDelete
    Replies
    1. class J
      {
      String str="JAVA";
      int i,j,len;
      public void show()
      {
      len=str.length();
      for(i=0;i<len;i++)
      {
      for(j=i;j<len;j++)
      {
      System.out.print(str.charAt(j));
      }
      System.out.println();
      }
      }
      }

      Delete
  54. sir ,plz kindly solve my program i.e
    write a program in java to store 10 no.'s in a single dimensonal array and sort it in ascending order and display the sorted array.

    ReplyDelete
  55. sir can u plz solve my problem as i am getting confused with the foll. pattern of latin square

    1234
    2341
    3412
    4123

    ReplyDelete
    Replies
    1. public class sud
      {
      void main()
      {
      String str="1234";
      for(int i=0;i<str.length();i++)
      {
      System.out.println(str.substring(i)+str.substring(0,i));
      }
      }
      }

      Delete
  56. sir please solve this:
    write a program to count the number of uppercase,lowercase,digit and special characters in a given string using character class

    ReplyDelete
  57. Sir,please rectify the error of the program:
    Write a program to count the number of uppercase,lowercase,digit and special characters in a given string using character class.


    class countchar
    {
    public static void countchar(String str)
    {
    int cup=0,clo=0,cdig=0,space=0,csp=0;
    char a[]=str.toCharArray();
    int l=str.length();
    for(int i=0;i<l;i++)
    {
    if (Char.isUpperCase(a[i])))
    cup++;
    if(Char(is.LowerCase(a[i])))
    clo++;
    if(Char(is.Digit(a[i])))
    cdig++;
    if(Char.isWhitespace(a[i])))
    space++;
    if(!Char(is.LetterorDigit() && !Char(is.Whitespace(a[i]))))
    csp++;
    }
    System.out.println("The appearance of Uppercase characters are "+cup);
    System.out.println("The appearance of Lowercase characters are "+clo);
    System.out.println("The appearance of Digits are "+cdig);
    System.out.println("The appearance of Uppercase characters are "+space);
    System.out.println("The appearance of Special characters are "+csp);
    }
    }

    ReplyDelete
    Replies
    1. Class name is Character and not 'Char'. You have used wrong method names also. isLowerCase(), isDigit() etc are the method names.

      Delete
  58. sir please solve this:
    Write a program and print even numbers using scanner class.


    import java.util.Scanner;
    public class ParseString
    {
    public static void main()
    {
    Scanner scanner=new Scanner("1 2 3 4 5 6 7 8 9 10");
    while(scanner.hasNextInt());
    {
    int num=scanner.nextInt();
    if(num%2==0)
    System.out.println(+num);
    }
    }
    }

    ReplyDelete
    Replies
    1. import java.util.Scanner;
      public class archisman
      {
      public static void main(String args[])
      {
      Scanner scanner=new Scanner("1 2 3 4 5 6 7 8 9 10");
      while(scanner.hasNextInt())
      {
      int num=scanner.nextInt();
      if(num%2==0)
      System.out.println(+num);

      }
      }
      }

      Delete
  59. Wap to check whether a given no. is disarium or not. ICSE student

    ReplyDelete
  60. plz upload a program to print Subhash Chandra ose as S.C.Bose

    ReplyDelete
    Replies
    1. Pl go through the page: http://schooljava.blogspot.com/2011/01/bluej-program-on-string-modification.html

      Delete
  61. wap to accept a non-palindromic word. display the new word after making it a palindrome.
    S.I- I.C.S.E
    S.O-E.S.C.I

    ReplyDelete
    Replies
    1. Not clear, do you want to reverse the word?

      Delete
    2. wap to input a sentence and print the word containing maximum numbers of vowels

      S/I: HAPPPY NEW YEAR
      O/P: YEAR

      Delete
    3. Solution posted yesterday, Pl. check the latest posts.

      Delete
    4. yes, it will be revere of a word

      Delete
    5. import java.io.*;
      class String1
      {
      BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
      String s;
      int i,len;
      public void takeString()throws Exception
      {
      System.out.print("\nEnter the word (I.C.S.E):");
      s=br.readLine();
      len=s.length();
      for(i=len-1;i>=0;i--)
      System.out.print(s.charAt(i));
      }
      public static void main(String args[])throws Exception
      {
      String1 ob=new String1();
      ob.takeString();
      }
      }

      Delete
  62. wap to accept a word and print the following pattern
    S/I: INDIA
    O/P:INDIA
    INDI
    IND
    IN
    I

    ReplyDelete
  63. write a menu driven program to do the following.
    sub part a:area of the circle.
    sub part b:area of the square.
    sub part c:area of the rectangle.

    ReplyDelete
  64. write a program to remove a double letter.

    ReplyDelete
  65. 1. Wap to accept a word & print it in the following pattern(the length of the word should be add)


    D
    R D E
    O R D E R

    2. Wap to accept a sentence and print in the following format

    Sample input: This
    This is
    This is an
    This is an example

    3. wap to accept a sentence and print all the character except the vowels. In case of vowels print the character next to two places of it.


    4. wap to accept a sentence and print the middle word provided the number of words are add.

    5. Wap in java to find the no. of zero’s in the following.
    I=3040

    ReplyDelete
  66. Sir, what will be the value stored in z after the following operation if y is initially 10
    int z=(++y*(y++ +5)); (using the norms of operator precedence and associativity)

    ReplyDelete
  67. wap to accept a multidigit number and check whether it is weakarm number or not.

    ReplyDelete
  68. wap to accept a multidigit number and check whether it is prime palindrome or not.

    ReplyDelete
    Replies
    1. Check the program on this link: http://schooljava.blogspot.com/2014/05/program-on-palindrome-and-prime-number.html

      Delete
  69. wap to print all the automorphic numbers within a given range provided by the user.

    ReplyDelete
    Replies
    1. Check this link: http://schooljava.blogspot.com/2012/08/display-automorphic-numbers-from-1-to.html

      Delete
  70. WAP TO PRINT INITIALS OF A NAME EXCEPT SURNAME
    INPUT SUBHAS CHANDRA BOSE
    OUTPUT S.C.BOSE

    ReplyDelete
    Replies
    1. This program is already posted in this site. Check the program in this link: http://schooljava.blogspot.com/2011/01/bluej-program-on-string-modification.html

      Delete
  71. sir how to invoke a fucnction.

    is it necessary to create objects and invoke - student icse

    ReplyDelete
    Replies
    1. You have to understand encapsulation first to know how a function is invoked. Functions are members of an object and objects members are accessed using the object (if the members are instance members, static members are invoked using the class name e.g 'Integer.parseInt()')

      You can download my eBook on BlueJ: http://imojo.in/4wxacb

      Delete
  72. i am not able to score good marks in computer how can i improve my marks and score 100

    ReplyDelete
    Replies
    1. If you are from Burdwan, I can help you directly otherwise go through this site and very soon you will get BlueJ study material in my 'Download eBook'

      Delete
  73. wap to accept a string and print the longest word

    ReplyDelete
  74. 1.enter a sentence in string and print the longest word among them
    2.enter a sentence in string and print the words cotaining vovels

    ReplyDelete

Subscribe via email

Enter your email address:

Delivered by FeedBurner