ICSE Important Programs

Solved Programs:

A teacher whose aim is to make Java a fun to learn experience for the school students by striving to build clear fundamentals of every concepts and helping students to develop their ability to reason and logically analyze any given programs.

  • int r=(int)t%10;
    s=s+(d*r);
    d–;
    t=t/10;
    explain the working of this statement. if we have to find the sum of the digits or anything such that this kind of logic is often found in the program. how do they work?

    • The logic used for any operations involving digits is:

      For finding sum of every digit the code will be:

      Suppose the number (n) is 945.

      Step 1:
      so, 645 > 0 is true
      therefore, d = 645 % 10 = 5
      so sum = 0 + 5 = 5
      and n = 645/10 = 64

      Step 2:
      so, 64 > 0 is true
      therefore, d = 64 % 10 = 4
      so sum = 5 + 4 = 9
      and n = 64/10 = 6

      Step 3:
      so, 6 > 0 is true
      therefore, d = 6 % 10 = 6
      so sum = 9 + 6 = 15
      and n = 6/10 = 0

      Step 4:
      so, 0 > 0 is false
      so the loop will end and we have the sum stored in the variable sum

  • Which are the most-likely programs for 2014 boards?
    any guess?
    if so, please tell
    thank you!

  • Write a program for foll pattern
    1 2 3 4 5
    6 7 8 9
    10 11 12
    13 14
    15

    • Here is the program:

  • Write a program on following pattern :-
    15 14 13 12 11
    10 9 8 7
    6 5 4
    3 2
    1

    • Here is the program:

  • Write a program to accept a number and display the frequency of each digit present in the number
    SAMPLE INPUT – 341124
    SAMPLE OUTPUT – The frequency of 1 = 2
    The frequency of 4 = 2

  • how we can make a program in which we  have to accept a sentence from a user and print those words which starts with a vowel…

    • thankss…

  • can we convert a string to an array by to char array()and perform operations like append?as we perform on buffer reader.

    • Yes, you can use the “toCharArray()” function of the String class which converts a String into a character array.
      So, if the string is, String s=”JAVA FOR SCHOOL”, then the statement,
      char ch [] = s.toCharArray(); will make a character array like
      ch[]={‘J’, ‘A’, ‘V’, ‘A’, ‘ ‘, ‘F’, ‘O’, ‘R’, ‘ ‘, ‘S’, ‘C’, ‘H’, ‘O’, ‘O’, ‘L’};

  • Is it necessary to use BufferedReader in the programs? Can we use scanner class instead?

  • can complex patterns such as parallelogram and  rhombus using for loop come?

    example                 *

    * * *

    * * * * *

    *  * *

    *

  • which sorting is in icse course.and how to understand string programs..

    • Hello Ayush,
      You have Selection sorting and Bubble Sorting of one dimensional array in the ICSE course.

      Below is an exerpt from the ICSE Scope of Syllabus:

      Arrays

      • Arrays –storing, retrieving and arranging data
      • Arrays and their uses,
      • sorting algorithms – selection sort and bubble sort;
      • Search algorithms – linear search and binary search
      • Example of a composite type.
      • Array creation.
      • Sorting and searching algorithms should be discussed (single dimensional array only).

      Regarding String programs,

      You have to think a String to be just like an array of characters. Like you use every element in the array by writing its index, similarly, in order to access the characters of a String, you need to extract the characters through their index using charAt() function.

      Think of it this way, and if your concept of array is strong, then the working of Strings will be really easy for you.

  • what are arrays

    how do they work

    • An array is a container object that holds a fixed number of values of a single data-type. The length of an array is established when the array is created. After creation, its length is fixed.

      So, if you have to store names of 50 students, then you would require 50 different variables. It is quite inconvenient to remember the names of so many variables. Instead of doing this, we can create an array having 50 elements for storing 50 names. You only have to remain the name of only a single array.

      An array of 10 elements.

      Illustration of an array as 10 boxes numbered 0 through 9; an index of 0 indicates the first element in the array.

      Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the preceding illustration, numbering begins with 0. The 9th element, for example, would therefore be accessed at index 8.
      So if the name of the array is arr[], then to access the 9th element, we have to write arr[8].

      Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the preceding illustration, numbering begins with 0. The 9th element, for example, would therefore be accessed at index 8.

  • A program code is divided into various entities which are known as objects of a class.objects have the data and functions which are also known as characterstics and behaviour .object is a set of related data which can share the information and can interact with each other.

     

  • how do you define an object?

Your Turn To Talk

Your email address will not be published.