Friday, September 14, 2012

Computer application guess paper on theoretical questions for 2013 ICSE students



 Here are few theoretical questions for students appearing in ICSE 2013 examination. Please go through this solution paper and I think this will help the ICSE students.

Give the difference between actual parameter and formal parameter.

Ans: Actual parameter are the values which are used in function calling statement and formal parameter are those variables or objects declared in argument list of function definition.


What is an identifier?

Identifiers are named space location where values can be stored. Identifier names are user defined which has certain rules and conventions.

Rules are as follows:
Identifier or variable name should start with a alphabet and then numeric value or underscore may appear.
No keywords can be used as identifier name.

Conventions of identifiers:
Identifier names are normally written in lower case characters.
Names are kept meaningful.

  Write an expression in Java for cos x + 2 2 a b . 

What is the result produced by 2 – 10*3 + 100/11? Show the steps.

Ans: -19

10*3 is evaluated first yielding 30. The next evaluated part is 100/11, result is 9 so expression becomes 2-30+9 and the result is -19.


What is the difference between local variable and instance variable?

Ans: Local variables are those which are declared within a function body whereas instance variables are declared inside the class body and not inside any function body. Local variables can accessed within the function body only and they have no relationship with the objects where as instance variables are known as object variables and they can accessed through out the program.


 int x =20, y = 10, z;
What is the value of z in
z = ++x * (y – –) – y ?
Show the steps.

Ans: 201

++x is prefix operator so ‘x’ becomes 21.
y—postfix so before decrement of ‘y’ the multiplication between ‘x’ and ‘y’ takes place yielding the value 201. After that the decremented value of ‘y’ i,e 9 is subtracted from 210.

 What is the purpose of default in a switch?

Default is optional is switch which is normally placed at the bottom of the switch body. If no match is found in any case constants then the control enters the default body, if there is default in the switch.

  Give the difference between linear search and binary search.

Linear search can be applied on an array without making any change but binary search can be applied after the array is sorted.
Linear search can be used for unique value search as well as category wise search. Binary search can be used only in unique value search.
Linear search can be used in Collection group of classes in java as well as in array but binary search can be used only on array.

What will be the output of the following code?

double x = 7.87;
System.out.println(Math.ceil(x);
System.out.println(Math.floor(x);

Ans: 8 and 7

 State the difference between if-else if ladder and switch...case.

There are number of differences between if-else if ladder or else if ladder and switch case. The differences are listed below:
if-else if ladder or else if ladder can work on any type of values but switch can work on only int and char type of values.
Else is the optional stamen is else if ladder which is placed at the bottom of the ladder. In switch case default is optional and it is placed normally at the bottom but can be placed anywhere in the body.

Explain the concept of constructor overloading with an example.

Constructor overloading means defining number of constructors with different argument lists.

Suppose Ab is a class and two instance variables are int x,y; The class has two overloaded version of constructors like:

Ab()
{
X=2;
Y=3;
}
And
Ab(int a, int b)
{
 X=a;
Y=b;
}

The zero argument constructor creates the object and initialize the data members with constant values where the second overloaded version creates the object and at the same time sets values send from outside to the object members.

 What will be the output of the following program segments?

(i) String s = “application”;
int p = s.indexOf(“a);
System.out.println(p);
System.out.println(p+s);

Ans:
0
0application


 String st = “PROGRAM”;
System.out.println(st.indexOf(st.charAt(4)));

Ans: 1

(iii) int a = 0;
if(a>0 && a<20 o:p="o:p">
a++;
else a-- ;
System.out.println(a);

Ans: -1

 int a= 5, b = 2,c;
if (a>b || a ! = b)
c = ++a+--b;    
System.out.print(c+ “ ”+a+ “ ”+b);

Ans: 7  6  1


int i = 1;
while(i++<=1)
{
i++;
System.out.print(i + “ ” );
}
System.out.print(i);


Ans: 3  4

 Differentiate between isUpperCase(char) and toUpperCase(char).

Ans: Return type of toUpperCase(char) function is char value, it returns the uppercase version of the argument character if it is in lower case. If the argument is in upper case then it returns the same value.

 What is the difference between a constructor function and a member function of a class?

Constructor is a special function whose name and class name must be same. There is no such rule for member function. Constructors are used to create objects and normally data members are initialized through constructor. Member functions are used to execute codes of the program.

What is the difference between a static member function and a member function which is not static?

Static functions are class members which can be called using the class name as well as object name and whose existence comes before creating the object.
Non static functions are known as instance function whose existence comes after creating the object.

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner