Home / Programming Questions / JAVA MCQs / Page 4

JAVA MCQs with answers Page - 4

Dear candidates you will find MCQ questions of JAVA here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. Which one of the following annotations is not used in Hibernate?

(A) @Basic
(B) @Entity
(C) @Query
(D) @Column

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. Annotations which are applied to other annotations are called meta annotations.

(A) False
(B) True
(C) ---
(D) ---

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. Automatic type conversion in Java takes place when 

(A) Two type are compatible and size of destination type is shorter than source type.
(B) Two type are compatible and size of destination type is equal of source type.
(C) Two type are compatible and size of destination type is larger than source type.
(D) All of the above

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. Which of the following automatic type conversion will be possible? 

(A) short to int
(B) byte to int
(C) int to long
(D) long to int

M

Manisha Agrawal • 9.32K Points
Tutor III

Q. What is the output of the following program? 

Code:
class A{
        public static void main(String args[]){
	        byte b;
   	        int i = 258;
	        double d = 325.59;

	        b = (byte) i;
	        System.out.print(b);

	        i = (int) d;
	        System.out.print(i);

                b = (byte) d;
                System.out.print(b);
        }
}
(A) 258 325 325
(B) 258 326 326
(C) 2 325 69
(D) Error

K

Kirti • 10.32K Points
Tutor II

Q. Which of the following is not pre defined annotation in Java?

(A) @FunctionInterface
(B) @SafeVarags
(C) @Overriden
(D) @Deprecated

K

Kirti • 10.32K Points
Tutor II

Q. Annotation type definition looks similar to which of the following?

(A) Interface
(B) Field
(C) Class
(D) Method

K

Kirti • 10.32K Points
Tutor II

Q. Which version of Java introduced annotation?

(A) Java 8
(B) Java 7
(C) Java 5
(D) Java 6

Login

Forgot username? click here

Forgot password? Click here

Don't have account? Register here.