Sunday, May 30, 2010

ICSE Board Guess Question And Answer on BlueJ(3)

Today's topic icse computer applications sample papers.

What is a class?
Class means user defined new type. class is the template or blue print which defines the nature and behavior of it’s instance – object. In class definition we normally the fields of it’s instance are declared and the methods are defined.

What is a constructor
Constructor is a special type of function which is needed to create an object. Without the execution of a constructor, object can’t be created. Constructor is a special method for several reasons
(i) Class name and it’s constructor name must be same
(ii) Constructor has no return type not even void
(iii) Constructor can’t use any return statement.
(iv) Constructor execution is a must
Normally constructor initializes the data members of an object.

Why do we use functions?
Function or methods are mini programs which perform a specific job. By using function we can reduce the complexity of a program. Without knowing the details we can invoke function to perform any specific job. This is an example of abstraction.

What will be the output

Class name
{
int a=15,b=35,c;
public void prac()
{
c=a+b;
System.out.println(c);
}
}

Output will be 50
What will be the output
Class out
{
public void oe( )
{
int a=26;
String s=”rajat”
Int ac=s+a;
}
}

Output rajat26

Consider the following class

Class all
{
public static int a=5;
public float=7.5
}

i) how many class variables are present
ii) how many instance variables are present

One class variable public static int a=5; and one instance variable public float=7.5is present in the class

Explain call by reference and call by value

Values are passed from program to functions. Values can be passed in two ways. It may be either call by value or call by reference.
Call by value means when variables are passed as arguments from the program and function creates variables, called function variables to store the values. As the variables are passed as arguments in case of call by value, the function body is getting the reference of the value or values that are passed as argument. So any modification done on the values in the function will have no impact on the actual value.

When objects are passed from calling program to a function as function arguments, it is called call by reference. In such case the variables of the function which will hold the passed values must be pointer variables. Here any modifications performed on the values within the function will have the same effect in the actual value of the calling program


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.

Similar post can be found in Indiastudychannel

12 comments:

  1. COMPUTER IS QUITE INTERESTING IF UNDERSTUD..............

    ReplyDelete
  2. sir please give the program as the usser had pass the no. of days passed in a year and print the next day in dd/mm/yy format

    ReplyDelete
  3. hello sir could you please post a sample program for call by value and help us understanding through that??

    ReplyDelete
  4. Sir,i have a confusion about how to write functions and call them as i have just begun java.Can you please explain how to write functions and call them.thankyou

    ReplyDelete
  5. sir can you please explain call by value and call by refernce by a program??

    ReplyDelete
  6. Tomorrow I will post on this topic.

    ReplyDelete
  7. Posted on 1 March. Please check.

    ReplyDelete
  8. thanks a lot sir ! much appreciated :)

    ReplyDelete
  9. Sir, it would be great if you could update a few programs on constructors as it is a little tricky understanding them ! Thank you. :)

    ReplyDelete
  10. Specify the programs, I will post them as required by you.

    ReplyDelete

Subscribe via email

Enter your email address:

Delivered by FeedBurner