1 A ____________ inherited by a sub-class has indirect access to all of the private members of the super class.
Protected nested class
2 The _________ internally creates a runtime system that helps the execution of code by loading the .class file, managing the memory, and performing garbage collection.
3 The ___________ method of the string class returns the index of the first occurrence of the specified character or string within a string.
4 The _______ method of the StringTokenizer class returns true if there is atleast one token in the string after the current position
5 The _________ allows an overriding method to return an object whose type is a sub-class of the type returned by the overridden method in the superclass.
Covariant return types
6 The _________ string class method returns the string representation of the specified argument.
7 Constructor overloading can be achieved with (chọn nhiều câu)
Same number of parameters and different data types.
Different number of parameters with same data type.
Same number of parameters and data types
Different number of parameters with data types
8 The advantages of Instance Methods are:
1. Instance methods can be overridden and overloaded.
2. Overridden instance methods can have a different return type provided that the new type is a sub-class of the declared return type of the overridden method
3. Instance methods can only be accessed by using an instance of the class using the dot operator.
4. Static variables can be accessed from the instance methods.
Statement 1, 2, 3
Statement 2, 3, 4
Statements 1, 2, 3, 4
9 Learn Java By Example
A format specifier always starts with a percent sign. Which of the following is the syntax for a format specifier?
1. %[arg_index$] [flags] [width] [precision] conversion character
2. %[arg_index$] [flags] [width] [.precision] conversion character
3. %[arg_index$] [width] [.precision] conversion character
4. %[arg_index$] [flags] [.precision] conversion character
10 Learn Java By Example
When ______________ statements are used, there are no conflicts between the case constants in inner switch with those in the outer switch.
11 Learn Java By Example
What is a function of a while statement?
Test the result of the boolean expression
Avoid the conflicts between inner and outer switches
Repeat a block of code while the condition is true
12 Learn Java By Example
Java provides some statements that will change the flow of control based on conditions. __________ statement stops the execution of the innermost loop in the program and starts processing the next line of code after the block.
13 Learn Java By Example
The _______________ statement causes the current iteration of the innermost loop to cease and the next iteration of the same loop to start.
14 Learn Java By Example
_______________ usually tests the loop control variable against a targeted value in a FOR statement.
15 Learn Java By Example
What is the function of a labeled statement?
To indicate the nested loop to continue with the next iteration.
To transfer the control directly to the conditional expression that controls the loop.
To stop the execution of the remaining body of the loop
16 Learn Java By Example
What is known as a base case?
Stopping recursion to save the memory
Calling a recursive method
Creating actual objects
Assigning values to element
17 Learn Java By Example
Every recursive method has some characteristics. When the method calls itself and pushes values on the stack, then this phase is known as ______________.
18 Learn Java By Example
_______________ is an enumerated type with a fixed set of possible values and does not vary at the time of execution.
Dynamic enumerated type
Static enumerated type
Stable enumerated type
Still enumerated type
19 Learn Java By Example
_________________ indicates that the heap space they occupy needs to be recycled so that the space is available for subsequent new objects.
20 Learn Java By Example
You can keep track of the objects that are referenced by the executing program so as to finalize and free unreferenced objects by using _______________.
Garbage Collected Heap
Java Virtual Machine
21 Learn Java By Example
________________ method returns the number of Unicode code points between two indices in the String.
22 Learn Java By Example
What is the function of valueOf()?
Converts the characters in the String to lower case.
Returns the string representation of the specified argument.
Copies the content of the String to a new character array.
Compares two strings and returns a boolean value.
23 Learn Java By Example
What is the function of gerChars()?
Returns the character value at the specified index.
Deletes a character at the specified position.
Copies specified number of character into an array
Returns the total number of characters from the StringBuilder object.
24 ________ is a process that converts an object’s internal state into a binary stream of bytes.
25 All ___________ in a class must be placed after the package statement and before the class declaration.
mình vừa lấy được từ thằng bạn. bạn nào làm được thì cho mình cái đáp án nhé.