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