MCQOPTIONS
Saved Bookmarks
This section includes 6 Mcqs, each offering curated multiple-choice questions to sharpen your Java knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Are enums are type-safe? |
| A. | True |
| B. | False |
| Answer» B. False | |
| 2. |
Which class does all the Enums extend? |
| A. | Object |
| B. | Enums |
| C. | Enum |
| D. | EnumClass |
| Answer» D. EnumClass | |
| 3. |
Which method returns the elements of Enum class? |
| A. | getEnums() |
| B. | getEnumConstants() |
| C. | getEnumList() |
| D. | getEnum() |
| Answer» C. getEnumList() | |
| 4. |
If we try to add Enum constants to a TreeSet, what sorting order will it use? |
| A. | Sorted in the order of declaration of Enums |
| B. | Sorted in alphabetical order of Enums |
| C. | Sorted based on order() method |
| D. | Sorted in descending order of names of Enums |
| Answer» B. Sorted in alphabetical order of Enums | |
| 5. |
Can we create an instance of Enum outside of Enum itself? |
| A. | True |
| B. | False |
| Answer» C. | |
| 6. |
What is the order of variables in Enum? |
| A. | Ascending order |
| B. | Descending order |
| C. | Random order |
| D. | depends on the order() method |
| Answer» B. Descending order | |