September 11, 2007

Java Objective Questions - 2

11. which font attributes are available through the FontMetrics class?
a. ascent(*)
b. leading(*)
c. case
d. height(*)


12.which of the following are true?
a. component extends container
b. menuitem extends component
c. container extends component(*)
d. menucomponent extends component


13. what is the ovtal equivalent of the decimal value 123?
a. 0173(*)
b. 123
c. 0x123
d. 0x173


14. in order for the public class Myclass to successfully compile, which of the following are true?
a. myclasss must have a correctly formed main method
b. myclass must be defined in the file myclass.java(*)
c. myclass must be defined in the myclas package.
d. myclass must be imported


15. which of the following are true?
a. any unicode character is represented using 16 bits
b. seven bits are needed to represent any ASCII character
c. UTf-8 characters are represented using only eight bits.
d. UTF-16 characters are represented using only 16 bits.


16. which of the following are true about a dead thread?
a. the thread's object is discarded.
b. the thread must wait until all other threads execute before it is restarted
c. the thread cannot be restarted(*)
d. the thread is synchornized


17. what is the output displayed by the following program?
class question {
public static void main(String args[]) {
int n=7;
n<<=3;
n=n&n+1|n+2^n+3;
n>>=2;
System.out.println(n);
}
}
a. 0
b. -1
c. 14(*)
d. 64


18. which of the following are true?
a. a component may handle its own events by adding itself as an even listener(*)
b. a component may handle its own events by overriding its event-dispatching method.(*)
c. a component may not handle its own events
d. a component may handle its own events only if it implements the handleEvent() method


19. what can contain objects that have a unique key field of string type, if it is required to retrieve the objects using that key field as an inded?
a. map(*)
b. set
c. list
d. collection
e. enumeration


20. what output is displayed by the following program?
import java.io.*;
public class TestIOApp {
public static void main(String args[]) throws IOException{
StringReader stringin = new StringReader("test")
LineNumberReader in = new LineNumberReader(stringin);
PrintWriter out = new PrintWriter(System.out);
out.println(in.readLine());
out.flush();
}
}
a. test(*)
b. 1. test
c. 1: test
d. 1 test

1 comment: