JAVA HIHI|Questions With Correct Answers|Verified C.private, protected, default, public - ✔With respect to access modifier overridden, the
right order is:
A.private, default, protected, public B.default, private, protected, public C.private, protected, default, public D.public, protected, default, private
A.transient - ✔Which modifiers on instance variables will announce to the compiler that these variables are not stored as part of its object's persistent state.A.transient B.public C.native D.volatile E.synchronized
- Accessing an element of an array. - ✔Select an operation which may cause an
unchecked exception.A.Accessing an element of an array.B.Accessing data in a file.C.Accessing a remote resource.D.Accessing data in a database.E.Controlling the state of a running thread.
A.[Modifier] {Return type] Identifier (Parameters) throws TypeOfException - ✔Select the correct syntax for throwing an exception when declaring a method.A.[Modifier] {Return type] Identifier (Parameters) throws TypeOfException B.[Modifier] {Return type] Identifier (Parameters) throw TypeOfException C.[Modifier] {Return type] Identifier (Parameters) {throw TypeOfException ; D.[Modifier] {Return type] Identifier (Parameters) {throws TypeOfException ; E.None of the others
A.1, 4, 5 - ✔Select incorrect Java program entry point declarations.(1) public static void main() (2) public static void main(String [] args) (3) public static void main(String args[]) (4) public static void main(string [] args) (5) public static void main(String args)
A.1, 4, 5
B.1, 2, 3
C.2, 3, 4
D.3, 4, 5
E.All of the others.
A.1, 3 - ✔Select correct statements. 1 / 2
(1) A public member of a class can be accessed in all classes.(2) A default member of a class can be accessed in all classes.(3) A protected member of a class can be accessed in the package containing this class.(4) A private member of a class can be accessed in the package containing this class.
A.1, 3
B.1, 2
C.1, 4
D.1, 2, 3
E.2, 3, 4
A.3, 4 - ✔Which of the following Java operations cause compile-time errors?int m=5, n=7; float x = m; //1 double y= n; //2 m = y; // 3 n = x; // 4
A.3, 4
B.1, 3
C.2, 4
D.1, 2, 3, 4
- ArrayIndexOutOfBoundsException - ✔If the following code is executed. What is the
output?int[] a= {1,2,3,4}; System.out.println(a[6]); A.ArrayIndexOutOfBoundsException B.A compile-time exception because they must be put in the try catch block.C.0 D.A non-predictable value.
A.The option "-source 1.4" must be specified when it is compiled. - ✔If a Java source code contains an assert as an identifier and it will be compiled with JDK version 1.4 or higher, ....A.The option "-source 1.4" must be specified when it is compiled.B.The option "-source 1.4 version" must be specified when it is compiled.C.The option "-enableassertion" must be specified when it is run.D.None of the others.
B.Only statement 2. - ✔U02-Q006 Which of the following statements are true?1)An abstract class can not have any final methods.2)A final class may not have any abstract methods.A.Only statement 1.B.Only statement 2.C.Both statement 1 and 2
- / 2