In this article students appearing in ICSE 2016 may get suggestions for Computer Application paper. Some of the answers are lengthy but it actually covers answer of two or more questions in one answer. Best of Luck!
1. What
are the access specifiers used in Java
Ans: There are four access
specifiers in java – public, private, protected and default. Members with
public specifers can be accessed from any where, even from outside the package.
Members with private specifers can be accessed from only within the class.
Members with protected specifers can be accessed from sub classes only.
2. Differentiate
between == and equals () method
Ans: == is a relational operator which
is used to check equality of two primitive values. The same operator can be
used on objects to check the equality of references, not value.
The equals () method is a String class
method which is used to check whether the invoking String object and the
argument String objects have same value or not. The method returns boolean
value.
3. Differentiate
between call by value and call by reference
Ans: Both are method calling techniques
while call by value uses variable as arguments and call be reference uses
objects as arguments.
Call by value can not modify actual argument
values after the execution of function but call by reference can modify actual
argument values.
4. What
is actual parameter and formal parameter
Ans: Actual
arguments are the variables or objects used in function calling statement and
formal arguments are the variables or objects declared in argument zone of a
function definition.
5. Between
binary and linear search, which one is better and why
Ans: Linear searching technique is better that binary
search as this technique don’t have any preconditions like binary search.
Linear search can be performed with the elements stored in as it is condition
and this storing technique can be applied for unique value search as well as category
wise search.
6. What
are the preconditions of binary search
For binary search, the elements should be in sorted order
and the middle location value can be accessed directly.
7. What
is instance variable and method
Instance members – both variable and method are those
whose existence comes after creating the object and can be used after creating
object. For each objects of a class, separate copies of instance variables are
created while only one copy of function will be created for any number of
objects.
Download eBook on BlueJ
Download eBook on BlueJ
8. What
is constructor and how it differs from a normal function
Constructor is a special function whose
execution is must for creating object.
Comparison between constructor and
normal function
Constructor
|
Function
|
Constructor name must be the same as the
class name.
|
Function name should not match with the
class name.
|
Constructor has no return type, not even
void.
|
Function must have a return type.
|
If constructor is not defined in a class,
compiler supplies default constructor.
|
There is no such concept of default
function
|
9. What
is default constructor
Default constructor is that constructor which is supplied
by compiler during creation of an object if there is no constructor defined in
a class. Default constructor is always empty body withour argument constructor.
Example of default constructor:
Suppose a class named MyClass is defined, Default
constructor of MyClass looks like:
MyClass ()
{
}
10. What
is difference between default constructor and normal constructor
Default constructor is supplied by
compiler while normal constructors are defined by programmers.
11. What
is exception handling
Exception is run time error and java uses some techniques
to handle the run time abnormality. These techniques are known as exception
handling.
12. What
are different techniques of exception handling
There are four techniques of exception handling in java
and these are throws, try catch, throw and try finally.
13. Comparison
among three loops
For loop
|
While loop
|
Do while loop
|
Entry
control loop
|
Entry
control loop
|
Exit
control loop
|
Control
statement contains three statements, initialisation, conditional statement
and reinitialisation of loop control variable
|
Control
statement contains only conditional statement while initialisation of loop
control variable is done above the loop and reinitialisation of loop control
variable is done within the loop body, normally at the end.
|
Control
statement contains only conditional statement while initialisation of loop
control variable is done above the loop body or within the loop body during
first iteration of the loop and in such case the same statement performs
reinitialisation during other iteration excepting the first one.
|
Loop
control variable is reinitialised by programmer
|
Loop
control variable is normally reinitialised by user
|
Loop
control variable is normally reinitialised by user
|
Loop
may not execute even once if the condition is false
|
Loop
may not execute even once if the condition is false
|
Loop
will execute atleast once if the condition is false
|
14. Different
type of decision making statements
In java there are different decision making statements
and they are – if, if else, else if
ladder, switch statement and conditional statement.
15. Comparison
between else if ladder and switch
Else if ladder
|
switch
|
else
if ladder can work on all type of values even on objects.
|
switch
can work only on int and char calues
|
Logical
operators can be used in else if ladder
|
Logical
operators can not be used in switch
|
Fall
through situation does not arise in else if ladder
|
If break
statement is not used at the end of case body, fall through situation occurs.
|
else
is optional in else if
|
default
is optional in switch
|
16. What
is Wrapper class
Wrapper classes are predefined class stored in java.lang
package. Each primitive type has an equivalent Wrapper class. Wrapper classes
are used to convert a primitive type value into it’s equivalent object. Some of
the Wrapper classes are Integer, Double, Boolean etc.
17. What
are the OOPs principles
There are three OOPs principles – Encapsulation,
Inheritance and Polymorphism.
18. What
is infinite loop
In loop conditional statement is used to terminate the
execution of the loop after certain time but if we set the condition to be true
then it becomes infinite loop. In infinite loop, break statement is necessary
to send the control out of loop body. Example of infinite loops:
for (::)
{
Statements
If(condition)
break;
}
while (true)
{
Statements
If(condition)
break;
}
do
{
Statements
If(condition)
break;
}while(true);
19. Two
types of Java programs
Java applet and stand alone application.
Thanks sir
ReplyDelete