Explore topic-wise MCQs in Java.

This section includes 4 Mcqs, each offering curated multiple-choice questions to sharpen your Java knowledge and support exam preparation. Choose a topic below to get started.

1.

If an expression contains double, int, float, long, then the whole expression will be promoted into which of these data types?

A. long
B. int
C. double
D. float
Answer» B. int
2.

b cannot contain value 100, limited by its range

A. * operator has converted b * 50 into int, which can not be converted to byte without casting
B. b cannot contain value 50
C. No error in this code
Answer» B. b cannot contain value 50
3.

prototype( )

A. prototype(void)
B. public prototype(void)
C. public prototype( )
Answer» C. public prototype( )
4.

Which of these is necessary condition for automatic type conversion in Java?

A. The destination type is smaller than source type
B. The destination type is larger than source type
C. The destination type can be larger or smaller than source type
D. None of the mentioned
Answer» C. The destination type can be larger or smaller than source type