

MCQOPTIONS
Saved Bookmarks
This section includes 1671 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.
651. |
JUnits are used for which type of testing? |
A. | Unit Testing |
B. | Integration Testing |
C. | System Testing |
D. | Blackbox Testing |
Answer» B. Integration Testing | |
652. |
Which of the following reference types cannot be generic? |
A. | Anonymous inner class |
B. | Interface |
C. | Inner class |
D. | All of the mentioned |
Answer» B. Interface | |
653. |
Which of these is an correct way of defining generic class? |
A. | class name(T1, T2, …, Tn) { /* … */ } |
B. | class name { /* … */ } |
C. | class name[T1, T2, …, Tn] { /* … */ } |
D. | class name{T1, T2, …, Tn} { /* … */ } |
Answer» C. class name[T1, T2, …, Tn] { /* … */ } | |
654. |
Which of these type parameters is used for a generic class to return and accept a number? |
A. | K |
B. | N |
C. | T |
D. | V |
Answer» C. T | |
655. |
Which of these type parameters is used for a generic class to return and accept any type of object? |
A. | K |
B. | N |
C. | T |
D. | V |
Answer» D. V | |
656. |
Why are generics used? |
A. | Generics make code more fast |
B. | Generics make code more optimised and readable |
C. | Generics add stability to your code by making more of your bugs detectable at compile time |
D. | Generics add stability to your code by making more of your bugs detectable at run time |
Answer» D. Generics add stability to your code by making more of your bugs detectable at run time | |
657. |
Which of these package is used for invoking a method remotely? |
A. | java.rmi |
B. | java.awt |
C. | java.util |
D. | java.applet |
Answer» B. java.awt | |
658. |
Which of these class allows us to get real time data about private and protected member of a class? |
A. | java.io |
B. | GetInformation |
C. | ReflectPermission |
D. | MembersPermission |
Answer» D. MembersPermission | |
659. |
Which of these package is used for handling security related issues in a program? |
A. | java.security |
B. | java.lang.security |
C. | java.awt.image |
D. | java.io.security |
Answer» B. java.lang.security | |
660. |
Which of these package is used for analyzing code during run-time? |
A. | java.applet |
B. | java.awt |
C. | java.io |
D. | java.lang.reflect |
Answer» E. | |
661. |
Which of these package is used for graphical user interface? |
A. | java.applet |
B. | java.awt |
C. | java.awt.image |
D. | java.io |
Answer» C. java.awt.image | |
662. |
Can “abstract” keyword be used with constructor,Initialization Block, Instance Initialization and Static Initialization Block? |
A. | True |
B. | False |
Answer» C. | |
663. |
What happens when we access the same variable defined in two interfaces implemented by the same class? |
A. | Compilation failure |
B. | Runtime Exception |
C. | The JVM is not able to identify the correct variable |
D. | The interfaceName.variableName needs to be defined |
Answer» E. | |
664. |
What happens when constructor is defined for an interface? |
A. | Compilation failure |
B. | Runtime Exception |
C. | The interface compiles successfully |
D. | The implementing class will throw exception |
Answer» B. Runtime Exception | |
665. |
What will happen if we provide concrete implementation of method in interface? |
A. | The concrete class implementing that method need not provide implementation of that method |
B. | Runtime exception is thrown |
C. | Compilation failure |
D. | Method not found exception is thrown |
Answer» D. Method not found exception is thrown | |
666. |
What type of methods an interface contain by default? |
A. | abstract |
B. | static |
C. | final |
D. | private |
Answer» B. static | |
667. |
What does an interface contain? |
A. | Method definition |
B. | Method declaration |
C. | Method declaration and definition |
D. | Method name |
Answer» C. Method declaration and definition | |
668. |
What type of variable can be defined in an interface? |
A. | public static |
B. | private final |
C. | public final |
D. | static final |
Answer» E. | |
669. |
All methods must be implemented of an interface. |
A. | True |
B. | False |
Answer» B. False | |
670. |
Which of the following is correct way of implementing an interface A by class B? |
A. | class B extends A{} |
B. | class B implements A{} |
C. | class B imports A{} |
D. | None of the mentioned. |
Answer» C. class B imports A{} | |
671. |
Which of the following access specifiers can be used for an interface? |
A. | Protected |
B. | Private |
C. | Public |
D. | Public, protected, private |
Answer» B. Private | |
672. |
Which of the following is correct way of implementing an interface salary by class manager? |
A. | class manager extends salary {} |
B. | class manager implements salary {} |
C. | class manager imports salary {} |
D. | none of the mentioned |
Answer» C. class manager imports salary {} | |
673. |
Which of these keywords is used by a class to use an interface defined previously? |
A. | import |
B. | Import |
C. | implements |
D. | Implements |
Answer» D. Implements | |
674. |
Which of these can be used to fully abstract a class from its implementation? |
A. | Objects |
B. | Packages |
C. | Interfaces |
D. | None of the Mentioned |
Answer» D. None of the Mentioned | |
675. |
Which of these keywords is used to define interfaces in Java? |
A. | interface |
B. | Interface |
C. | intf |
D. | Intf |
Answer» B. Interface | |
676. |
What is the output of this program? package pkg; class output { public static void main(String args[]) { StringBuffer s1 = new StringBuffer("Hello"); s1.setCharAt(1, x); System.out.println(s1); } } |
A. | xello |
B. | xxxxx |
C. | Hxllo |
D. | Hexlo |
Answer» D. Hexlo | |
677. |
What is the output of this program? package pkg; class display { int x; void show() { if (x > 1) System.out.print(x + " "); } } class packages { public static void main(String args[]) { display[] arr=new display[3]; for(int i=0;i |
A. | 0 |
B. | 1 |
C. | 2 |
D. | 0 1 2 |
Answer» D. 0 1 2 | |
678. |
Which of the following package stores all the standard java classes? |
A. | lang |
B. | java |
C. | util |
D. | java.packages |
Answer» C. util | |
679. |
Which of the following is incorrect statement about packages? |
A. | Package defines a namespace in which classes are stored |
B. | A package can contain other package within it |
C. | Java uses file system directories to store packages |
D. | A package can be renamed without renaming the directory in which the classes are stored |
Answer» E. | |
680. |
Which of the following is correct way of importing an entire package ‘pkg’? |
A. | import pkg. |
B. | Import pkg. |
C. | import pkg.* |
D. | Import pkg.* |
Answer» D. Import pkg.* | |
681. |
Which of these access specifiers can be used for a class so that it’s members can be accessed by a different class in the different package? |
A. | Public |
B. | Protected |
C. | Private |
D. | No Modifier |
Answer» B. Protected | |
682. |
Which of this access specifies can be used for a class so that its members can be accessed by a different class in the same package? |
A. | Public |
B. | Protected |
C. | No Modifier |
D. | All of the mentioned |
Answer» E. | |
683. |
Which of these is a mechanism for naming and visibility control of a class and its content? |
A. | Object |
B. | Packages |
C. | Packages |
D. | None of the Mentioned. |
Answer» C. Packages | |
684. |
Which of these keywords is used to define packages in Java? |
A. | pkg |
B. | Pkg |
C. | package |
D. | Package |
Answer» D. Package | |
685. |
Which of these package provides the ability to read and write in Zip format? |
A. | java.lang |
B. | java.io |
C. | java.util.zip |
D. | java.util.zar |
Answer» D. java.util.zar | |
686. |
Which of these interfaces is implemented by TimerTask class? |
A. | Runnable |
B. | Thread |
C. | Observer |
D. | ThreadCount |
Answer» B. Thread | |
687. |
Which of these classes can schedule task for execution in future? |
A. | Thread |
B. | Timer |
C. | System |
D. | System |
Answer» C. System | |
688. |
Which of these methods is called when observed object has changed? |
A. | setChanged() |
B. | update() |
C. | notifyObserver() |
D. | all of the mentioned |
Answer» E. | |
689. |
Which of these methods calls update() method? |
A. | notify() |
B. | observeObject() |
C. | updateObserver() |
D. | notifyObserver() |
Answer» E. | |
690. |
Which of these methods is used to notify observer the change in observed object? |
A. | update() |
B. | notify() |
C. | check() |
D. | observed() |
Answer» B. notify() | |
691. |
What is use of Observable class? |
A. | It is used to create global subclasses |
B. | It is used to create classes that other part of program can observe |
C. | It is used to create classes that can be accessed by other parts of program |
D. | It is used to create methods that can be accessed by other parts of program |
Answer» C. It is used to create classes that can be accessed by other parts of program | |
692. |
Which of these is a method can generate a boolean output? |
A. | retbool() |
B. | getBool() |
C. | nextBool() |
D. | nextBoolean() |
Answer» E. | |
693. |
Which of these method of Locale class can be used to obtain country of operation? |
A. | getCountry() |
B. | whichCountry() |
C. | DisplayCountry() |
D. | getDisplayCountry() |
Answer» E. | |
694. |
Which of these class can generate pseudorandom numbers? |
A. | Locale |
B. | Rand |
C. | Random |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
695. |
Which of these methods is not a Locale class? |
A. | UK |
B. | US |
C. | INDIA |
D. | KOREA |
Answer» D. KOREA | |
696. |
Which of these class produce objects with respect to geographical locations? |
A. | TimeZone |
B. | Locale |
C. | Date |
D. | SimpleTimeZone |
Answer» C. Date | |
697. |
What is the signature of Math.random() method? |
A. | public static double random() |
B. | public void double random() |
C. | public void double random() |
D. | public void int random() |
Answer» B. public void double random() | |
698. |
What would be the output of following code snippet? int a = random.nextInt(7) + 4; |
A. | Random number between 4 to 7, including 4 and 7 |
B. | Random number between 4 to 7, excluding 4 and 7 |
C. | Random number between 4 to 10, excluding 4 and 10 |
D. | Random number between 4 to 10, including 4 and 10 |
Answer» E. | |
699. |
What would be the output of following code snippet? int a = random.nextInt(15) + 1; |
A. | Random number between 1 to 15, including 1 and 15 |
B. | Random number between 1 to 15, excluding 15 |
C. | Random number between 1 to 15, excluding 1 |
D. | Random number between 1 to 15, excluding 1 and 15 |
Answer» B. Random number between 1 to 15, excluding 15 | |
700. |
How many bits are used for generating random numbers? |
A. | 32 |
B. | 64 |
C. | 48 |
D. | 8 |
Answer» D. 8 | |