September 11, 2007

Java Objective Questions - 6

51. what is the value of 111%13?
a. 11
b. 5
c. 6
d. 7(*)


52. which of the following are methods of the graphics class?
a. drawrect() (*)
b. drawimage() (*)
c. drawpoint()
d. drawstring() (*)


53. if you run the following program, which lines would be included in its output?
class question {
public static void main(string[] args) {
int i=1;
int j=2;
outer: while(i
++i;
inner: do {
++j;
if (j%3==0) continue outer;
if (i%3==0) break inner;
if (i%3==1) break outer;
system.out.println(i*j);
} while (j <>
system.out.println(i+j);
}
}
}
a. 5
b. 6
c. 7(*)
d. the program does not display any output.

54. what is the output of the following program?
class s1{
public static void main(string[] args) {
new s2();
}
s1() {
system.out.pritn("s1");
}
}
class s2 extends s1 {
s2() {
system.out.print("s2");
}
}

a. s1
b. s2
c. s1s2(*)
d. s2s1

55. what is the range of char type?
a. 0 to 2^16
b. 0 to 2^16-1(*)
c. 0 to 2^15
d. 0 to 2^15-1

56. which of the following methods are methods of math class?
a. absolute()
b. cosine()
c. sine()
d. log() (*)

57. which of the following are true about local inner classes?
a. they are not associated with any instance of an outer class.(*)
b. they may access final initialized variables and parameters that are in the scope of the statement block in which the class is declared(*)
c. they may be declared public, protected or private
d. they may not implement an interface

58. when a thread blocks on I/O, which of the following are true?
a. the thread enters the ready state.
b. the thread enters the dead state
c. no other thread may perform I/O
d. the thread enters the waiting state(*)

59. what is the output of the following program when it is invoked using the command line java Test this is a test?
class Test {
public static void main(String arg[]) {
system.out.println(arg[1]);
}
}
a. this
b. is(*)
c. a
d. test?

60. a frame's background color is set to color.yellow and button's background color is set to colr.blue. suppose the button is added to a panel, which is added to the frame. what background color will be used wth the panel?
a. color.yellow(*)
b. color.blue
c. color.green
d. color.white

No comments:

Post a Comment