Model Test Paper 9 (Unsolved) : Section)
Model Test Paper 9 (Unsolved) : Section)
SECTION A
(Attempt all questions from this Section)
Question 1
20
Choose the correct answers and write the correct
option.
) Declaration is not to declare "value" to a variable; it is to declare the of the variable.
(a) Type (b) Range (c) Size (d) None of these
(ii) Which of the following is NOT reserved
a
keyword in Java?
(a) abstract (6) extends (c) transient
(d) None of these
(ii) Which of the following be
method signature of the method area with two int
can a
(b) It returns a String object based on the input whose contents are the number.
(c) Returns float that is the
a same as the input but of double data type.
(d) None of these
(vi) What does the method new do?
(a) It creates a new integer
(b) It creates an of the type following
object new keyword and returns its reference
(c) It resets all data members to 0 or null (d) It returns a null object reference
(vii) What header files must you import in order to be able to use:
Point ptl= new Point(100,100);
(a) Java.math.* (b) java.util. *
(c) java.awt.Point (d) java.lang.math
(viii) Which method is used to remove the leading and trailing whitespace?
(a) trim() (b) troll() (c) cut() (d) toTrim()
84 Coal'h ICSCc.
What is the output of the following code?
(ix) tring str This is a string";
Str
(d) System.out.println(str.CharAt()).
(c) System.out.println(str.char(1):
TRANSPARENT
(a) Transparent (b) transparent (c)
ho
metnous.
variables, classes and
are Java rescrved words or titles given to
(1) eitne (d) Identifiers
(c) Punctuators
(a) Keywords (b) Operators does.
the method
collection of statements that define what
function, the contains a
(iv) In a
(b) Parameters list
(a) Return statement
dimensional So must ,
(a) It is 2
Not as new int[6].
elements
values to fill in the
b) It does not know what use.
initialization. You can directly
variable does not need
(c) The subscripted
(d) None of these search?
search terminate in one
In which case would binary element is the target
(xvii)
is the target
(b) If the first
middle element
(a) If the (d) In all cases
element is the target
(c) If the last collector solve?
the garbage
(xix) Which problem does Java program
between objects in a
c o m m o n memory
It makes use of when not used anymore
(a) new and reclaim memory
variables created using
(b) It looks at all (d) None of these
to allocate memory
(c) It uses the heap memory
function do in Java?
below call to a
(xx) What does the
chrt (double a);
(b) It returns the cube root of a
root of a
the square
(a) It returns
(d) None of these
the cube of a
(c) It returns
Question 2 121
the Java expression:
i) Gives the valuc of ("opi")
("abc") & Optim".beginsWith
abracad".endsWith
85
(1) What is the difference in the effect of the calling the functions at (1) and (2) in the below code,
codes
assuming the
are written correctly inside the functions?
public static void
21
main (String[1 args)
1nt a 3, b 7
Integer g new Integer (a);
Integer h =
new
Integer (b);
Swapl (a, b);
Swap2 (g, h);
(vii) What kind of statement is left blank in the below correct function definition'?
[21
public int add(int a, int b)
(1)
(vii) Of the below method calls in the main) method, which method call is likely to work? 121
public static void main (String [] args)
int a = 3
(ix) Suppose that there is an aray in code with the name ar. How can you deduce the highest valued index of the array?12]
(x) Is the below line vaid? 121
String str = abcde'";
SECTIONB
Question 3 15
Consider the sentence as given below:
below. write a
program to print the statement into a coded
For example:
messagc
If a string is YORO HAS SMILIED Uhen, the coded nessage is cYUY RKJ /ON
Question 5 15
Define a c l a s s to input a string and convert it into uppercase and print thc pair o f vowels and numDcr p
Question 6 15
Design a class to overload a function compare ( ) as follows
the greater of the two integers.
(a) void compare (int, int) - to compare two integer values and print
value
character with higher numeric
(b) void compare (char, char) - to compare the numeric value of two
and print the longer of the two.
(C) void compare (String, String) to compare the length of the two strings
-
|15
Question 7
is more than any other digit in the
A Clarit number is a number such that the number of zeroes in the number
numbers are Clarit numbers or not.
number. Write a class to take as input numbers and declare whether the
For example:
201 (Not)
2003 (Is)
120300 (is)
3211 (Not)
Question 8 [15
and prints all the factors of the number smaller than itself.
Define a class that accepts an integer
n