Java Quiz 20 A+ Questions and Answers

If you want to make a component opaque or transparent, what method do you use?
A) setOpaque
B) opaque
C) transparent
D) SetTransparent
2.
To access the number of columns in row i of a two-dimensional array named grades, we use _________________.
A) grades.length
B) grades( i ).length
C) grades( i ).size
D) grades{ i }.length
E) grades[ i ].length
3.
When class B inherits from class A?
A) A is the subclass and B is the superclass
B) A is the superclass and B is the subclass
4.
To access the number of rows in a two-dimensional array named grades, we use _________________.
A) grades.size( )
B) grades
C) grades.length( )
D) grades.size
E) rades.length
5.
The header of a method that potentially generates an exception when called contains the keyword _______________ .
A) generates
B) excepts
C) throws
6.
When creating a GUI application class, which class do we typically extend?
A) Container
B) Component
C) JFrame
D) Window
7.
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 coding another version of method foo in class B
B) We are calling method foo in class B
C) We are not using method foo in class B
8.
Typically, _________________.
A) Recursion uses selection and iteration uses looping
B) Recursion uses looping and iteration uses selection
9.
Binary search applies to ________________.
A) Either an unsorted or a sorted array
B) An unsorted array
C) A sorted array
10.
What method is used to set the width and height of a window?
A) setSize
B) setHeightWidth
C) setWindow
D) setWidthHeight
11.
What keyword do we use in the class header that inherits from another class?
A) modifies
B) extends
C) protected
D) inherits
12.
What is the function of a GUI component?
A) Display information only
B) All of the above
C) Enable user interaction only
13.
If you want to disable a component, what method do you use?
A) Enabled
B) setEnabled
C) Disabled
D) SetDisabled
14.
Assuming the class B inherits from class A, then
A) An object of class B is an object of class A
B) All of the above
C) None of the above
D) An object of class A is an object of class B
15.
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
16.
To access the element at row i and column j of a two-dimensional array named grades, we use _________________.
A) grades( i )( j )
B) grades[ i ][ j ]
C) grades[ j ][ i ]
D) grades( j )( i )
E) grades
17.
A linked list ________________.
A) Can grow and shrink as items are added or deleted
B) Can shrink but not grow, i.e., items can be deleted but not added
C) Has fixed size
D) Can grow but not shrink, i.e., items can be added but not deleted
18.
Which package does the JFrame class belong to?
A) javax,swing
B) java.swing
C) java.awt
D) javax.awt
19.
Constructors
A) Are not inherited and cannot be accessed
B) Are accessible but are not inherited
C) Are inherited and can be accessed
D) Are inherited but cannot be accessed
20.
In order to handle an exception, we use a _________________ construct.
A) try and finally
B) try and catch
C) catch and finally

Download All 20 Answers : Click HERE

TYPE SOME PART OF QUESTION YOU ARE LOOKING FOR

.

.
acc week