Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Complete IIT AIEEE ICSE ISC PMT help forum

Complete help forum for students preparing for icse iit aieee cbse pmt and other related exams.Stay updated about all 2011 exams.
 
HomeHome  PortalPortal  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  India NewsIndia News  
Keywords
YEAR RESULT prelim CASE SELECT UNION paper physics science computer 2006 graph 2004 ICSE question 2009 2010 CLASS 2007 papers
Latest topics
» Nitration of aniline - IIT JEE 2018 Advanced - solved
More Computer questions EmptyFri Jun 08, 2018 2:34 am by adianadiadi

» Diamagnetic - Paramagnetic - Ni(CO)4, [Ni(CN)4]2- and [NiCl4
More Computer questions EmptyFri Apr 06, 2018 1:05 am by adianadiadi

» IIT JEE chemistry solved interactive question paper
More Computer questions EmptySun Oct 29, 2017 12:11 pm by adianadiadi

» IIT JEE 2015 SOLVED QUESTION PAPER
More Computer questions EmptyWed Oct 19, 2016 1:44 pm by adianadiadi

» IIT JEE chemistry solved questions
More Computer questions EmptySat Jul 18, 2015 6:15 pm by adianadiadi

» General Description of Chinese Market for Foaming Agent ADC
More Computer questions EmptyFri May 09, 2014 2:09 pm by happybaicaitou

» How to get Lowest Cost MBBS Admission?
More Computer questions EmptyMon Feb 24, 2014 6:39 pm by MENTOR 2014

»  girl boy vashikaran specialist agori baba ji +91-9461165
More Computer questions EmptyTue Jan 21, 2014 6:00 pm by krshastri

»  STRONG LOST LOVE SPELL +91-9461165176
More Computer questions EmptyTue Jan 21, 2014 6:00 pm by krshastri

Top posters
abhas
More Computer questions Vote_lcapMore Computer questions Voting_barMore Computer questions Vote_rcap 
Anu..i luv icse...:)
More Computer questions Vote_lcapMore Computer questions Voting_barMore Computer questions Vote_rcap 
G-7
More Computer questions Vote_lcapMore Computer questions Voting_barMore Computer questions Vote_rcap 
siya
More Computer questions Vote_lcapMore Computer questions Voting_barMore Computer questions Vote_rcap 
Candy
More Computer questions Vote_lcapMore Computer questions Voting_barMore Computer questions Vote_rcap 
jOhNy
More Computer questions Vote_lcapMore Computer questions Voting_barMore Computer questions Vote_rcap 
Apurva
More Computer questions Vote_lcapMore Computer questions Voting_barMore Computer questions Vote_rcap 
WinRrule
More Computer questions Vote_lcapMore Computer questions Voting_barMore Computer questions Vote_rcap 
ambili
More Computer questions Vote_lcapMore Computer questions Voting_barMore Computer questions Vote_rcap 
saif
More Computer questions Vote_lcapMore Computer questions Voting_barMore Computer questions Vote_rcap 



Search if you can't find it here

More Computer questions

View previous topic View next topic Go down
AuthorMessage
admin
Admin
Admin
admin


More Computer questions Vide
PostSubject: More Computer questions More Computer questions EmptyFri Nov 23, 2007 11:45 am

Source
http://www.luckybakshi.blogspot.com
Posted by Page for Students
--------------------------------------------------



Q1. How are the local scope of variables different from global scope of variables?
Ans: Java allows variables to be defined in a block enclosed in curly braces { }, which gives the scope and lifetime to a variable.
The variables defined within main class are called global variables, and have scope and lifetime till the class is executing.
The variables defined within the method it is local variables, which have scope only till that particular method starts and ends. It also protects that variable from unauthorised access from outside the scope.(i.e. its method).

Q2. What is default and parameterized constructors?
Ans : Constructors are the special functions for automatic initilisation of object during creation.
Default constructors : If a constructor for a class is not explicitly defined, then java creates default constructor. It does not take arguments or initilisation values from user. For eg.
public class circus
{
int p, int b, int tot;
public circus( ) {
p = 0;
b= 0;
tot = 10;
}
Parameterized constructor : The constructor that take arguments are called parameterized constructors. They accept parameters and initialize the data members based on arguments passed to it. For eg.
public class circus
{
int p, int b, int tot;
public circus( int a, int x, int c) {
p = a;
b= x;
tot = c;
}

Q3. What is function call and function definition ?
Ans: Function call : Once function is written in a program it can be called anywhere and reused any number of times in the program to solve specific problem is called function call.
For eg.
public class circus
{
public void mn( ) {
int var;
public int addi ( int x, int y){
return x+y;
}
var=addi(7,Cool;
System.out.println(“the value is :”+var);
}}
Calling function function Call
public void mn( ) addi ( int x, int y){
{ --------- ----------
} return x+y; }
var=addi(7,Cool;
-------
-------

Function definition : Function is a set of instructions given to computer in order to perform specific task. Function definition is shown in following form.
Access specifier type fun_name (parameters)
{
--------
--------
body of the function;
}
where as :
access specifier is public or private.
type specifies the data type of function return. If function does not return any value then void.
Function name gives name to function with rules for identifiers.
parameter list specifies the list of arguments.
body of function are statements for manipulation.

Q4. What is difference between actual parameters and formal parameters?
Ans : Actual parameters : An argument passed to a function when it is invoked.
For eg. var = addi(7,Cool;
here 7 and 8 are the arguments passed in the function when the value of var is to be calculated actually.
Formal parameters : The parameters passed to a function which receives value when method is called , is the formal parameter.
For eg.
public int addi ( int x, int y){
return x+y;
}
Here function addi takes up the aruguments x and y which are formal parameters.

Q5. What is StringBuffer?
Ans : Two string_support classes are available in java.lang. String and StringBuffer.

Class StringBuffer supports the Strings which can be modified. It has operations that can modify the string or change its length which is not available for only string class once declared.
StringBuffer class contains following constructors.
StringBuffer( )
StringBuffer( int size)
StringBuffer( String str)
length( )
capacity( )

Q6. Name two ways by which parameters are passed to function?
Ans : Parameters are passed to function in two ways like :
Call by value Call by reference
Call by value : This method copy the entire arguments passed to the function. It copies the value of an argument into the formal parameters of the subroutine. As a copy of arguments is made and passed to the function, any change made to the parameters inside the function do not affect the original arguments.
For eg.
class extraa
{
public void mn( )
{ int y, int x=20;
System.out.println(“the original value is :”+x);
y=valuechang(x);
System.out.println(“the original value is :”+y);
}
public int valuechang(int t)
{
int p=t;
return p;
}
}
Call by reference: This method reference to the arguments is passed as parameter. The value of an argument is not passed to the function, so any change made to the object inside the function will be reflected to the object passes as the original arguments. Call by reference used dot operator (.) to call the object.
For eg.
class extraa{
int x,y;
public extraa(int i,int j){
x=i;
y=j; }
public void tentimes(extraa ob){
ob.x*=10;
ob.y*=10; }
public void printo()
{
System.out.println(" x is :"+x);
System.out.println("y is :"+y);
}
public void main()
{
extraa as1=new extraa(20,30);
as1.printo();
System.out.println("the changed values are :");
as1.tentimes(as1);
as1.printo();
}
}
Back to top Go down
nirant




More Computer questions Vide
PostSubject: Help Needed: Call By Reference: Object Declaration Not Clear More Computer questions EmptyTue Mar 03, 2009 10:01 pm

public void tentimes(extraa ob)

In the above line is the object created or what is actually happening?? As the object is no where in prog created using new keyword, I may assume that it is created here.
Please help asap.

Thanks in advance.
Back to top Go down
Anirudh The Conquerer
Active member
Active member
Anirudh The Conquerer


More Computer questions Vide
PostSubject: Re: More Computer questions More Computer questions EmptyWed Mar 04, 2009 1:44 pm

nirant we are passing object as parameter
here the new keyword is used to create as1
this as1's address is copied to object ob and thus
the values will change for x & y

i am a little lazy at typing i am sorry i did not explain in detail
Back to top Go down
pavan
Active member
Active member



More Computer questions Vide
PostSubject: Re: More Computer questions More Computer questions EmptyWed Mar 04, 2009 2:14 pm

ley.............aniroooooooodh
thnx
Back to top Go down
pavan
Active member
Active member



More Computer questions Vide
PostSubject: Re: More Computer questions More Computer questions EmptyWed Mar 04, 2009 3:06 pm

heeyyyy.........can ny1 tel me the output of abov progrmz so tht icn undrstd betr
Back to top Go down
nirant




More Computer questions Vide
PostSubject: Re: More Computer questions More Computer questions EmptyThu Mar 05, 2009 8:23 am

Thanks a lot Anirudh.....I understood it quite well. And I really didn't mind your laziness, it worked well 4 me. Thanks again.
Back to top Go down
Arya Nair
Active member
Active member
Arya Nair


More Computer questions Vide
PostSubject: Re: More Computer questions More Computer questions EmptyThu Mar 05, 2009 8:58 am

thanks
Back to top Go down
Sponsored content




More Computer questions Vide
PostSubject: Re: More Computer questions More Computer questions Empty

Back to top Go down

More Computer questions

View previous topic View next topic Back to top
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Complete IIT AIEEE ICSE ISC PMT help forum :: Computer :: Computer help forum-