Home

1000+ Java Programming MCQ for IBPS Clerk [Solved]

Thursday 9th of March 2023

Sharing is caring

1. executeUpdate automatically updates data because___________
A. auto commit is on, by default
B. It performs a hidden commit statement as well
C. Does not commit
D. None of the above.
Answer : A
2. When present, package must be the first no comment statement in the file.
A. True
B. False
C.
D.
Answer : A
3. A package is a collection of
A. classes
B. interface
C. editing tools
D. classes and interfaces
Answer : D
4. We would like to make a member of a class visible in all subclasses regardless of what package they are in. Which one of the following keywords would achieve this?
A. private
B. protected
C. public
D. private protected
Answer : D
5. A constructor must always invoke its supper class constructor in its first statement.
A. True
B. False
C.
D.
Answer : B
6. Throwing an exception always causes program termination.
A. True
B. False
C.
D.
Answer : B
7. Session bean
A. Represents a single client inside the application server
B. Can not be shared
C. Is not persistent
D. Satisfies all of the above conditions
Answer : D
8. For all insert, update, delete, query operations on a database, ResultSet object creation is mandatory.
A. True.
B. False.
C.
D.
Answer : B
9. We can over load methods with differences only in their return type.
A. True
B. False
C.
D.
Answer : B
10. Message-Driven beans act as a listener for the Java Message Service API, processing messages synchronously
A. True
B. False
C.
D.
Answer : B
11. Which javadoc tag is used to denote a comment for methods parameters?
A. @method
B. @parameter
C. @argument
D. @param
Answer : D
12. A thread can make second thread ineligible for execution by calling the suspend (-) method on second thread.
A. True
B. False
C.
D.
Answer : A
13. Java always provides a default constructor to a class.
A. True
B. False
C.
D.
Answer : B
14. The setBackground() method is part of the class
A. Applet
B. Component
C. Container
D. Object
Answer : B
15. It is perfectly legal to refer to any instance variable inside of a static method.
A. True
B. False
C.
D.
Answer : B
16. It is an error to catch the same type of exception in two different catch blocks associated with a particular try block.
A. True
B. False
C.
D.
Answer : A
17. Which of the following are not keywords?
A. NULL
B. Implements
C. Protected
D. None of the above
Answer : A
18. DriverManager.getConnection("jdbc:odbc:dsn_name") method does not depend on the class.forName(...) method.
A. True.
B. False.
C.
D.
Answer : B
19. Every method of a final in class is implicitly final.
A. True
B. False
C.
D.
Answer : A
20. What is java -g used for?
A. Using the jdb tool
B. Executing a class with optimization turned off
C. To provided information about deprecated methods
D. Non of the above
Answer : B
21. JSP files creates ________________
A. html files
B. html files and java files
C. java files and class files
D. None of the above.
Answer : C
22. Give file is a file object, which of the following are legal statements to create a new file.
A. file.create();
B. FileOutputStream fos=new FileOutputStream(file);
C. FileInputStream fis=new FileInputStream(file);
D. all of the above
Answer : B
23. The length of a string object 's1' can be obtained using the expression s1.length.
A. True
B. False
C.
D.
Answer : B
24. In RMI before running the client program we must start RMI Registry.
A. True.
B. False.
C.
D.
Answer : A
25. DataInput is
A. An abstract class defined is java.io.
B. A class we can use to read primitive data types.
C. An interface that defines methods to open files.
D. An interface that defines methods to read primitive data types.
Answer : D
26. If m and n are int type variables, what will be the result of the expression
'm % n' when m = -14 and n = -3?

A. 4
B. 2
C. -2
D. -4
Answer : C
27. We can add more than one class(es) at the time of compilation Java Beans.
A. True.
B. False.
C.
D.
Answer : A
28. The keywords reserved but not used in the initial version of Java re:
A. Synchronized
B. Boolean
C. union
D. goto
Answer : D
29. Which of the following string can be used as mode string for creating a RandomAccessFile object?
A. "rw"
B. "wr"
C. "0"
D. 'w''
Answer : A
30. Servlet has ___________
A. init method
B. doGet(------) method
C. All of the above methods.
D.
Answer : C
31. Which of the following statements are true?
A. UTF characters are all 24 bits.
B. Reader class has methods that can read integers and floats.
C. Unicode characters are all 16 bits.
D. all of the above
Answer : C
32. forName() is a static factory method
A. True
B. False
C.
D.
Answer : A
33. All methods in an abstract class must be declared abstract.
A. True
B. False
C.
D.
Answer : B
34. If a=10 and b= 15, then the statement x =(a>b)?a:b; assigns the value 15 to x.
A. True
B. False
C.
D.
Answer : A
35. When we implement an interface method, it should be declared as public.
A. True
B. False
C.
D.
Answer : A
36. When we implement the Runnable interface, we must define the method
A. start()
B. init()
C. runnable()
D. run()
Answer : D
37. Consider the following class definition.
Class Student extends String
{
}
What happens when we try to compile this class?

A. Will not compile because class body is not defined
B. Will not compile because class is not declared public
C. Will compile successfully.
D. Will not compile because String is abstract
Answer : D
38. An EJB is a server-side component that encapsulates the business logic of an application
A. True
B. False
C.
D.
Answer : A
39. The modulus operator (%) can be used only with Integer operands.
A. True
B. False
C.
D.
Answer : B
40. Which of the following classes are available in the java.lang package?
A. Random
B. Stack
C. String Buffer
D. Vector
Answer : A
41. Which of the following represent legal flow control statements?
A. break;
B. break();
C. continue(inner);
D. all of the above
Answer : A
42. Which of the following statements are true?
A. An abstract class may not have any final methods?
B. A final class may not have any abstracts methods.
C. Transient variables must be static.
D. all of the above
Answer : B
43. executeUpdate(------------) returns ___________
A. Nothing
B. Returns a ResultSet object
C. Returns an integer value to show the no. of updated rows
D. None of the above.
Answer : C
44. JdbcOdbcDriver is an object of Object class
A. True
B. False
C.
D.
Answer : B
45. Servlet can have ___________
A. get method and post method
B. get method or post method
C. Either of the above
D.
Answer : C
46. A static class method can be invoked by simply using the name of the method alone.
A. True
B. False
C.
D.
Answer : B
47. Which of the following will produce a value of 22 if x=22.9:
A. Ceil(x)
B. Round(x)
C. Rint(x)
D. Abs(x)
Answer : C
48. A Java monitor must either extend thread class or implement Runnable interface.
A. True
B. False
C.
D.
Answer : B
49. Which of the following are keywords?
A. integer
B. default
C. Boolean
D. Object
Answer : B
50. The use of protected keyword to a member in a class will restrict its visibility as follows:
A. Visibility only in the class and its subclasses in the same package.
B. Visibility only inside the same package.
C. Visibility in all classes in the same package and subclasses in other packages.
D. Visibility only in the class where it is declared.
Answer : C

Sharing is caring