1Which of the following range of
short is correct?
-27 -- 27-1
0 -- 216-1
–215 -- 215-1
–231 -- 231-1
(c)
2Which declarations of identifiers are legal?
A. $persons
B. TwoUsers
C. *point
D. this
E. _endline
(a,b,e)
3Which statement of assigning a long type variable to a hexadecimal
value is correct?
A. long number = 345L;
B. long number = 0345;
C. long number = 0345L;
D. long number = 0x345L.
(d)
4Which of the following fragments might cause errors?
A. String s = "Gone with the wind";
String t = " good ";
String k = s + t;
B. String s = "Gone with the wind";
String t;
t = s[3] + "one";
C. String s = "Gone with the wind";
String standard = s.toUpperCase();
D. String s = "home directory";
String t = s - "directory".
(b,d)
5class Person {
private int a;
public int change(int m){ return m; }
}
public class Teacher extends Person {
public int b;
public static void main(String arg[]){
Person p = new Person();
Teacher t = new Teacher();
int i;
// point x
}
}
Which are syntactically valid statement at // point x?
A. i = m;
B. i = b;
C. i = p.a;
D. i = p.change(30);
E. i = t.b.
(d,e)
6Which layout manager is used when the frame is resized the buttons's
position in the Frame might be changed?
A. BorderLayout
B. FlowLayout
C. CardLayout
D. GridLayout
(b)
7Given the following code fragment:
1) public void create() {
2) Vector myVect;
3) myVect = new Vector();
4) }
Which of the following statements are true?
A. The declaration on line 2 does not allocate memory space for the
variable myVect.
B. The declaration on line 2 allocates memory space for a reference
to a Vector object.
C. The statement on line 2 creates an object of class Vector.
D. The statement on line 3 creates an object of class Vector.
E. The statement on line 3 allocates memory space for an object of
class Vector
(abde)
8Which of the following answer is correct to express the value 8 in
octal number?
A. 010
B. 0x10
C. 08
D. 0x8
(a)
9Which are not Java keywords?
A. TRUE
B. sizeof
C. const
D. super
E. void
(ab)
10Which of the following statements are true?
A. The equals() method determines if reference values refer to the
same object.
B. The == operator determines if the contents and type of two separate
objects match.
C. The equals() method returns true only when the contents of two
objects match.
D. The class File overrides equals() to return true if the contents
and type of two separate objects match.
(ad)
|