Tuesday, November 29, 2011

Suggestions on Computer paper for ICSE stidents of 2012


In this post few questions with answers, theory part are posted for ICSE students of 2012. Read these answers and if any doubt, post your comments.

  1. What is private and public specifier in Java?
public and private are access specifiers used before variable declaration and function definition. ‘public’ members, whether used in function or variable can be accessed from outside the class body even outside the package while ‘private’ members can be accessed from only within the class body.

  1. Difference between ‘==’ and equals ()’.

‘==’ is an operator, relational operator used to compare equality of two primitive values and when this operator is used on objects, it compares the references of the objects for equality.
‘euqals ()’ is a String class function and prototype of this function is ‘boolean equals(String s)’. This function takes a String object as argument and compares the argument object and invoking object values for equality. This is a case sensitive function.

  1. Compare switch with else-if ladder.

Both switch and else-if are decision making statements which can operate successfully on multiple options. There are some differences between these two decision making statements.
else-if can work on any type of primitive values and objects while switch can work only on character and integer value.

In switch statement, logical operator can not be used while in else-if ladder, logical operators are used.
The statement ‘break’ is required at the end of each case body to send the control out of switch body while in case of else-if ladder, no such break statement is required.
else is optional part of else-if ladder and default is option part of switch statement. In else-if ladder, else has to be placed at the end of the ladder and in switch, default is normally placed at the end but it can be placed anywhere in the switch body.
Switch works

 4. Define ‘substring ()’ and ‘charAt()’ function.

‘substring ()’ is a function of String class and return type of this function is String. This function has two overloaded versions. The prototypes are ‘String substring (int start)’ and ‘String substring (int start, int number)’.
‘charAt ()’ is a function of String class and prototype of the function is ‘char charAt(int i)’. This function returns the character of the specified location ‘I’ of the invoking string object.

  1. Comparision between break and continue

Both are jumoing statements while braek is used in loop and switch statements, continue is used on in loops. Break is used in loops for premature termination of the loop and the same statement is used in case body of switch statement to send the control out of switch body.
Continue is used in loops for premature iteration of the loop, means loop body starts executing skipping a part of statements in the loop body.

  1. Use of ‘this’ keyword.
‘this’ is a keyword used in java to refer the current object.

  1. Define entry control and exit control loop
 In entry control loops, the control statement appears before the body of the loop and in exit control loop, it is just the reverse. In exit control loop, body is first executed and then the condition is evaluated.

2 comments:

  1. hii sir this is anshu please sent some guess papers that could help me in the exams for ICSC

    ReplyDelete
    Replies
    1. My last post is on ICSE 2012 examination. Very soon I will post another two such. Please follow.

      Delete

Subscribe via email

Enter your email address:

Delivered by FeedBurner