Friday, 6 December 2013

Computer science

The RGB values of Color.GREEN are _________________
A) 255,0,0
B) 0,255,0
C) 0,0,0
2.
Which package is the Graphics class part of? _________________ .
A) javax.awt
B) java.awt
C) java swing
D) javax swing
3.
Selecting a radio button generates _________________ .
A) Both an ActionEvent and an ItemEvent
B) An ItemEvent only
C) An ActionEvent only
4.
What are the 2 methods of the MouseEvent class that enable us to retrieve the x and y coordinates of the mouse?
A) getX and getY
B) getCoordX and getCoordY
C) x and y
5.
Insertion Sort uses a ______
A) Triple Loop
B) Single Loop
C) Double Loop
6.
When calling the constructor of a superclass from the constructor of the subclass, the call to that superclass constructor must be the first statement in the subclass constructor.
A) True
B) False
7.
protected fields and methods are inherited
A) True
B) False
8.
Overriding a method and overloading a method means the same thing
A) True
B) False
9.
The length method of the String class takes no argument and returns an int
A) True
B) False
10.
private fields and methods are inherited.
A) True
B) False
11.
By convention, class names start with a capital letter
A) True
B) False
12.
What is the concatenation operator?
A) +
B) .
13.
Assuming the class B inherits from class A and method foo belongs to class A, what do we mean by overriding method foo in class B?
A) We are not using method foo in class B
B) We are coding another version of method foo in class B
C) We are calling method foo in class B
14.
The argument list of a default constructor is empty
A) True
B) False
15.
Pressing the Enter key in a text field generates an _________________ .
A) enter event
B) action event
C) command event
16.
What keyword do you use in order to be able to use a Java class inside a program? _________________ .
A) class
B) include
C) import
17.
Which applet method is called automatically when the applet needs to redraw itself? _________________ .
A) init
B) paint
C) exit
D) applet
E) main
18.
What package does the ActionEvent class belong to?
A) java event
B) java.awt
C) java.awt.event
D) javaxswing
19.
public fields and methods are inherited.
A) True
B) False
20.
The DecimalFormat can be used to format a number by specifying a number of digits after the decimal point
A) True
B) False
21.
The first index of a String is 1
A) True
B) False
22.
Which interface do the methods mouseDragged and mouseMoved belong to?
A) MouseMotionListener
B) Mouse
C) MouseListener
23.
What is the output of the following code fragment?
String test = “abcdefghijk”;
String word = test.substring(2,6);
System.out.println(word.length());
A) 5
B) 1
C) 4
D) 0
24.
A JTextArea displays a single line field.
A) True
B) False
25.
If an array has n elements, then the last index is ______.
A) n – 1
B) n
C) n + 1
26.
It is good OOP design to separate the functionality of a game from the GUI that enables a user to play that game
A) True
B) False
27.
How many areas inside a window does a BorderLayout control?
A) 4
B) 2
C) 3
D) 1
E) 5
28.
Selecting an item in a list generates a _________________ .
A) An ItemEvent only
B) An ActionEvent only
C) A ListSelectionEvent only
29.
In what package is the class DecimalFormat?
A) java number
B) java lang
C) java text
D) java format
30.
Using a null object reference to call a method will not generate an error
A) True
B) False
31.
In what package is the class NumberFormat?
A) java text
B) java util
C) java number
D) java format
E) java lang
32.
To preselect an item (the default item selected) in that combo box list.
A) True
B) False
33.
What Java keyword do we use in the constructor of a class inheriting from another class if we want to call the constructor of the inherited class?
A) clone
B) call
C) super
D) constructor
34.
Selecting an item in a combo box generates a _________________ .
A) ListSelectionEvent
B) Both an ActionEvent and an ItemEvent
C) ItemEvent
D) ActionEvent
E) CheckEvent
35.
The RGB values of Color.ORANGE are _________________
A) 255,255,255
B) 255,200,0
C) 255,0,0
36.
The repaint method automatically calls the paint method.
A) True
B) False
37.
What is the value of the expression Math.sqrt( 4 )?
A) 0.0
B) 2.0
C) 4.0
D) 1.0
38.
The data type of System.out is _________________
A) Print Stream
B) Out
C) Print
D) System
39.
Selecting a checkbox generates _________________ .
A) An ActionEvent only
B) Both an ActionEvent and an ItemEvent
C) An ItemEvent only
40.
What keyword do we use in the class header that inherits from an interface?
A) interfaces
B) inherits
C) implements
D) modifies  CLICK HERE FOR MORE ON THIS TOPIC

No comments:

Post a Comment