Quiz
Java (Multimedia Approach) Ch 6,7,9
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (38)
1The name of the method and the data types of the method's return type and the types of its parameters is described as the method's signature.
- ATrue
- BFalse
2A class inherits the constructors of its superclass.
- ATrue
- BFalse
3In Java, it is not possible to create an object instance of an abstract class.
- ATrue
- BFalse
4If I wish to create a variable FICA which has the value 0.062 and the value of the variable is not allowed to change, we can declare it as ____________.
- Aprivate double FICA = 0.062;
- Bfinal double FICA = 0.062;
- Cpublic double FICA = 0.062;
- Dprotected double FICA = 0.062;
- Econst double FICA = 0.062;
5If a class is created primarily to create subclasses, it should be declared as ____________.
- Asuper
- B final
- Cprivate
- Doverload
- E abstract
6A subclass of an abstract class must implement all abstract methods in its parent class.
- ATrue
- BFalse
7True or False? Final methods can be overloaded.
- ATrue
- BFalse
8Allowing an object to select to select a particular behavior is best associated with ________.
- Aoverloading a method
- Bmultilevel inheritance
- Chierarchical inheritence
- Doverriding a method
- Epolymorphism
9In order for a object of a subclass type to access the superclass' variables directly, the variables must be declared as _______.
- A private, public, or protected
- Bprotected
- Cprivate
- Dpublic or protected - but not private
- Epublic
10True or False? A panel can contain other panels.
- ATrue
- BFalse
11True or False? The FlowLayout class can be used to create a layout in which all components are placed in a single column within the container.
- ATrue
- BFalse
12The content pane is obtained using the getContentPane method of the ______ class.
- AJPanel
- BJButton
- CJFrame
- DJComponent
- EJayZ
13In order to get a row of buttons, one can use the ______ layout manager.
- ABorderLayout
- BFlowLayout
- CBoxLayout
- DGridLayout
- ELayabout
14When a user clicks on a push button on the GUI it generates an ActionEvent.
- ATrue
- BFalse
15The setBackground method is a method of the JFrame class.
- ATrue
- BFalse
16It is possible to create Border objects for a panel by using the _______ class.
- ABorderFactory
- BBorderLayout
- CGridLayout
- Dnone of these
- EGrid
17Before events can be captured it is necessary to add a/an ______ to the component.
- A ActionCommand
- Bmouse object
- CActionListener
- Dnone of these
- Egraphics object
18Within a set of check buttons representing options, only one can be selected.
- ATrue
- BFalse
19The JFileChooser() class is an example of a class which can generate a dialog.
- ATrue
- BFalse
20To create a Java program that uses a GUI interface, which of the following must be done?
- Aall of these
- Bimplement listener classes
- Cestablish relationships between the listeners and the components
- Dcreate and set up components
- Enone of these
21Which of the following method will retrieve the text displayed on a object of the JButton class?
- Anone of these
- BgetValue
- CgetText()
- Dall of these
- EgetActionCommand()
22Within a set of check buttons representing options, only one can be selected.
- ATrue
- BFalse
23True or False? The size of an array can be printed out using the length method.
- ATrue
- BFalse
24The JSlider class fires a ________ event when it is manipulated.
- AActionEvent
- BItemEvent
- CNone of these
- DChangeEvent
- EClickEvent
25Which of the following statements creating an array is valid?
- A int[] array = new int(10);
- Bint[] array = new int[10];
- Carray = {10, 20, 40};
- Dint array = new int[10];
26True or False? An existing array can be populated with an initializer list.
- ATrue
- BFalse
27True or False? Arrays of only primitive types, and not reference types, can be sorted using the sort method in the java.util.Arrays class.
- ATrue
- BFalse
28What is the output of the following program?
public enum Planets {
MERCURY,
EARTH,
MARS,
JUPITER;
public static void main(String[] args) {
Planets planet;
planet = MARS;
System.out.println(planet.ordinal());
}
}- A1
- B2
- C3
- D4
29True or False? An existing array can be populated with an initializer list.
- ATrue
- BFalse
30True or False? Arrays of only primitive types, and not reference types, can be sorted using the sort method in the java.util.Arrays class.
- ATrue
- BFalse
31True or False? It is not possible to create an object of an enum using the new operator.
- ATrue
- BFalse
32True or False? If I have an array
char[] charArr = {'J','a','v','a'};
I can convert it to a string by using the following constructor:
String str1 = new String(charArr);- ATrue
- BFalse
33Which of the following structures would be best to use if we wish to store information about a chess board?
- Aan ArrayList
- Ba two-dimensional array
- Ca Point
- Dan enum
34Suppose I have an ArrayList declared as follows:
ArrayList list = new ArrayList();
I wish to print out the number of elements in list. Which statement would do this?- ASystem.out.println(list.size);
- BSystem.out.println(list.size());
- CSystem.out.println(list.length());
- Dany of these
- ESystem.out.println(list.length);
35Suppose I have the following Strings:
String s1 = "A string";
String s2 = new String("A string");
String s3 = new String("A string");
which of the following comparisons will yield a true?- Anone of these will be true.
- Bs2 == s3
- C s1 == s3
- D s1 == s2
- Eall of these will be true
36True or False? It is possible to change the size of an ArrayList object at run time by using the .add method.
- ATrue
- BFalse
37True or False? To find out how many elements there are in an ArrayList use the size() method.
- ATrue
- BFalse
38In order to check to see that two String objects contain the same string (the same characters in the same order) it is best to _______.
- Anone of these.
- Bcompare using the substring method.
- Cuse the length() method to compare the sizes of both strings.
- Duse the .equals method
- Ecompare them with the == operator.
Information
- Description
- C2 Java Programming Quiz on Java (Multimedia Approach) Ch 6,7,9, created by johnrclark12 on 07/11/2014.
- Author
- johnrclark12
- Language
- English
- Views
- 14
- Tags
- Rating
- No ratings yet Rate this quiz