Computer Paper 2
Computer Paper 2
The time given at the head of this Paper is the time allowed for writing the answers.
SECTIONA
(ii) Which method is used to find the length of the specified string?
(b) length0 (c) long) (d) StrLength)
(a) len)
What the two methods of the String class to search a string?
(iv) are
(b) Indexof() and Lastindexof()
(a) indexOf) and lastlndexOf)
both correct (d) None of these
(c) Either (a) or (b) are
****** ..*
static int x, y;
void access ()
int a, b
academic student = new a c a d e m i c( ) ;
(a) Find first index position containing 'a' (b) Find last index position containing
*a
(c) Find first index position of any character (d) Find last index position of any character
(xix) What would the following code do?
int index 0
index =
text.lastIndexOf ( a');
(a) Find first index position containing 'a (b) Find last index position containing 'a'
(c) Find first index position of any character (d) Find last index position of any character
(xx) How many parameters does the following parameter list contain?
int add (int X, intt y)
(a) One (b) Twob (c) Threee (d) Four
Questionn2
Double d = 858.48
String s =
Double.toString (d) ;
2
(vi) What is the difference between:
int i
String sl i
Or
String s2= String.valueOf (i);
121
(vii) What is the use of the java.io class packages?
121
(vii) What is the Object class?
what are the values of x and y? 21
(ix) If int n[] (1,2,3, 5,7,9, 13, 16),
n[2]);
Math.pow (n [4]1,
Math.sqrt (n [5] +n [7])
two lines.
121
the below
(x) Find the value of phrase based on
Too many";
String phraSe
the broth";
phraset=
"
cooks spoil
103
Pucstin Paper with MTP Class 10
SECTION B