Java ProgrammingPrograming & IT Mcqs 100+ MCQ & Answer Java programming | page-02 |Computer Engineering MCQ And Answer January 27, 2025 DSN MARATHI 11. Which of the following creates a List of 3 visible items and multiple selections abled? A. new List(false, 3) B. new List(3, true) C. new List(true, 3) D. new List(3, false) Answer Option : B 12. Which of the following for loop declaration is not valid? A. for ( int i = 99; i >= 0; i / 9 ) B. for ( int i = 7; i <= 77; i += 7 ) C. for ( int i = 20; i >= 2; – -i ) D. for ( int i = 2; i <= 20; i = 2* i ) Answer Option : A 13. Which method of the Class.class is used to determine the name of a class represented by the class object as a String? A. getClass() B. intern() C. getName() D. toString() Answer Option : 3 14. In which process, a local variable has the same name as one of the instance variables? A. Serialization B. Variable Shadowing C. Abstraction D. Multi-threading Answer Option : B 15. Which package contains the Random class? A. java.util package B. java.lang package C. java.awt package D. java.io package Answer Option : A 16. What do you mean by nameless objects? A. An object created by using the new keyword. B. An object of a superclass created in the subclass. C. An object without having any name but having a reference. D. An object that has no reference. Answer Option : D 17. An interface with no fields or methods is known as a __ A. Runnable Interface B. Marker Interface C. Abstract Interface D. CharSequence Interface Answer Option : B 18. Which of the following is an immediate subclass of the Panel class? A. Applet class B. Window class C. Frame class D. Dialog class Answer Option : A 19. Which option is false about the final keyword? A. A final method cannot be overridden in its subclasses B. A final class cannot be extended. C. A final class cannot extend other classes. D. A final method can be inherited. Answer Option : C 20. Which of these classes are the direct subclasses of the Throwable class? A. RuntimeException and Error class B. Exception and VirtualMachineError class C. Error and Exception class D. IOException and VirtualMachineError class Answer Option : C
11. Which of the following creates a List of 3 visible items and multiple selections abled? A. new List(false, 3) B. new List(3, true) C. new List(true, 3) D. new List(3, false) Answer Option : B
12. Which of the following for loop declaration is not valid? A. for ( int i = 99; i >= 0; i / 9 ) B. for ( int i = 7; i <= 77; i += 7 ) C. for ( int i = 20; i >= 2; – -i ) D. for ( int i = 2; i <= 20; i = 2* i ) Answer Option : A
13. Which method of the Class.class is used to determine the name of a class represented by the class object as a String? A. getClass() B. intern() C. getName() D. toString() Answer Option : 3
14. In which process, a local variable has the same name as one of the instance variables? A. Serialization B. Variable Shadowing C. Abstraction D. Multi-threading Answer Option : B
15. Which package contains the Random class? A. java.util package B. java.lang package C. java.awt package D. java.io package Answer Option : A
16. What do you mean by nameless objects? A. An object created by using the new keyword. B. An object of a superclass created in the subclass. C. An object without having any name but having a reference. D. An object that has no reference. Answer Option : D
17. An interface with no fields or methods is known as a __ A. Runnable Interface B. Marker Interface C. Abstract Interface D. CharSequence Interface Answer Option : B
18. Which of the following is an immediate subclass of the Panel class? A. Applet class B. Window class C. Frame class D. Dialog class Answer Option : A
19. Which option is false about the final keyword? A. A final method cannot be overridden in its subclasses B. A final class cannot be extended. C. A final class cannot extend other classes. D. A final method can be inherited. Answer Option : C
20. Which of these classes are the direct subclasses of the Throwable class? A. RuntimeException and Error class B. Exception and VirtualMachineError class C. Error and Exception class D. IOException and VirtualMachineError class Answer Option : C