Home

Java Programming 1000+ MCQ with answer for IBPS SO

Thursday 9th of March 2023

Sharing is caring

1. In RMI before running the client program we must start RMI Registry.
A. True.
B. False.
C.
D.
Answer : A
2. The programmer must explicitly create the system .in and system .out objects.
A. True
B. False
C.
D.
Answer : B
3. When we implement an interface method, it should be declared as public.
A. True
B. False
C.
D.
Answer : A
4. 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
5. A string object can not be modified after it is created.
A. True
B. False
C.
D.
Answer : A
6. Java is fully object oriented programme.
A. true
B. false
C.
D.
Answer : A
7. A method declared as static can not access non-static class members.
A. True
B. False
C.
D.
Answer : A
8. Which of the following methods belong to the String class?
A. length()
B. compareTo()
C. substring()
D. all of the them
Answer : D
9. A variable declared inside the for loop control can not be referenced out side the loop.
A. True
B. False
C.
D.
Answer : A
10. putValue(...) method takes _____________________-
A. Two arguments of object type
B. First one is of a character type and second one is of an object type
C. First one is of an object type and second one is of a character type
D. None of the above.
Answer : A
11. The setBackground() method is part of the class
A. Applet
B. Component
C. Container
D. Object
Answer : B
12. Which of the following classes are available in the java.lang package?
A. Random
B. Stack
C. String Buffer
D. Vector
Answer : A
13. The methods wait() and noify() are defined in
A. java.lang.Thread
B. java.lang.Runnable
C. java.lang.Object
D. java.lang.ThreadGroup
Answer : C
14. 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
15. A package is a collection of
A. classes
B. interface
C. editing tools
D. classes and interfaces
Answer : D
16. When the string objects are compared with ==, the result is true If the strings contain the same values.
A. True
B. False
C.
D.
Answer : B
17. The import statement is always the first no comment statement in a Java program files.
A. True
B. False
C.
D.
Answer : B
18. 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
19. It is perfectly legal to assign a subclass object to a supper class reference.
A. True
B. False
C.
D.
Answer : A
20. What is wrong in the following class definitions? 
abstract class print { 
abstract show();
}
class Display extends print {
}

A. Nothing is wrong
B. Wrong Method show() should have a return type
C. Wrong Methods show() is not implemented in Display
D. Wrong Display does not contain any members.
Answer : C
21. Message-Driven beans act as a listener for the Java Message Service API, processing messages synchronously
A. True
B. False
C.
D.
Answer : B
22. Which of the following represent legal flow control statements?
A. break;
B. break();
C. continue(inner);
D. all of the above
Answer : A
23. All methods in an abstract class must be declared abstract.
A. True
B. False
C.
D.
Answer : B
24. When present, package must be the first no comment statement in the file.
A. True
B. False
C.
D.
Answer : A
25. To delete a file, we can use an instance of class file.
A. True
B. False
C.
D.
Answer : A
26. EJBs can be of the following type(s)
None of the above

A. Entity Bean
B. Session Bean
C. Message-driven bean
D. All of the above
Answer : D
27. Which of the following methods can be used to change the size of a
size() *
resize()

A. component
B. dimension()
C. setSize()
D. size()
Answer : C
28. Any class may be inherited by another class in the same package.
A. True
B. False
C.
D.
Answer : B
29. Submit button always fires doPost(...)
A. True
B. False
C.
D.
Answer : B
30. If you want to assign a value of 99 to the variable year, then which of the following lines can be used within an <applet> tags?
A. number=getParameter(99)
B. <number==99>
C. D. <param = radius value ==99>
Answer : C
31. Any method in a supper class can be over ridden in its subclass.
A. True
B. False
C.
D.
Answer : B
32. 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
33. Connection, Statement are interfaces and ResultSet is a class.
A. True.
B. False.
C.
D.
Answer : B
34. DriverManager.getConnection("jdbc:odbc:dsn_name") method does not depend on the class.forName(...) method.
A. True.
B. False.
C.
D.
Answer : B
35. Frames and applets cannot be used together in the same program.
A. True
B. False
C.
D.
Answer : B
36. What is error in the following class definitions? 
abstract class xy { 
abstract sum(int x, int y) {
}
}

A. class header is not define properly
B. constructor is no defined
C. method is not defined properly
D. no error
Answer : C
37. A JSP file can be stored_________________
A. With the extension .jsp in servlets folder of the jws
B. With the extension .html in public_html folder of the jws
C. With the extension .jsp in public_html folder of the jws
D. None of the above.
Answer : C
38. 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
39. We can over load methods with differences only in their return type.
A. True
B. False
C.
D.
Answer : B
40. Which javadoc tag is used to denote a comment for methods parameters?
A. @method
B. @parameter
C. @argument
D. @param
Answer : D
41. Java always provides a default constructor to a class.
A. True
B. False
C.
D.
Answer : B
42. Declaring a method synchronized guarantees that the deadlock cannot occur.
A. True
B. False
C.
D.
Answer : A
43. It is an error to have a method with the same signature in both the super class and its subclass.
A. True
B. False
C.
D.
Answer : B
44. 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
45. 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
46. 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
47. A final class may not have any abstract method.
A. True
B. False
C.
D.
Answer : A
48. What does the following line of code do?
TextField text=new TextField(10);

A. Creates text object that can hold 10 rows of text.
B. Creates text object that can hold 10 columns of text.
C. Creates the object text and initializes it with the value 10.
D. The code is illegal.
Answer : B
49. Servlet has ___________
A. init method
B. doGet(------) method
C. All of the above methods.
D.
Answer : C
50. The name of a Java program file must match the name of the class with the extension Java.
A. True
B. False
C.
D.
Answer : A

Sharing is caring