Home

1000+ Java Programming MCQ for SSC CHSL [Solved]

Thursday 9th of March 2023

Sharing is caring

1. Which of the following represent legal flow control statements?
A. break();
B. continue(inner);
C. return;
D. exit();
Answer : C
2. For all insert, update, delete, query operations on a database, ResultSet object creation is mandatory.
A. True.
B. False.
C.
D.
Answer : B
3. Which key word can protect a class in package from accessibility by the classes outside the package?
A. private
B. protected
C. final
D. don't use any keyword at all(make it default)
Answer : D
4. It is an error if a class with one or more abstract methods is not explicitly declared abstract.
A. True
B. False
C.
D.
Answer : A
5. When we implement an interface method, it should be declared as public.
A. True
B. False
C.
D.
Answer : A
6. A Java monitor must either extend thread class or implement Runnable interface.
A. True
B. False
C.
D.
Answer : B
7. The keywords reserved but not used in the initial version of Java re:
A. Synchronized
B. Boolean
C. union
D. goto
Answer : D
8. All methods in an abstract class must be declared abstract.
A. True
B. False
C.
D.
Answer : B
9. 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
10. A final class may not have any abstract method.
A. True
B. False
C.
D.
Answer : A
11. The programmer must explicitly create the system .in and system .out objects.
A. True
B. False
C.
D.
Answer : B
12. 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
13. A static class method can be invoked by simply using the name of the method alone.
A. True
B. False
C.
D.
Answer : B
14. Members of a class specified as private are accessible only to the methods of the class.
A. True
B. False
C.
D.
Answer : A
15. 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
16. 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
17. DriverManager.getConnection("jdbc:odbc:dsn_name") method does not depend on the class.forName(...) method.
A. True.
B. False.
C.
D.
Answer : B
18. It is perfectly legal to refer to any instance variable inside of a static method.
A. True
B. False
C.
D.
Answer : B
19. Which of the following classes are available in the java.lang package?
A. Random
B. Stack
C. String Buffer
D. Vector
Answer : A
20. In RMI we invoke client method from remote server
A. True
B. False
C.
D.
Answer : B
21. Throwing an exception always causes program termination.
A. True
B. False
C.
D.
Answer : B
22. A catch can have comma-separated multiple arguments.
A. True
B. False
C.
D.
Answer : B
23. Objects are passed to a method by use of call-by-reference.
A. True
B. False
C.
D.
Answer : A
24. 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
25. The break statement is required in the default case of a switch selection structure.
A. True
B. False
C.
D.
Answer : B
26. In evaluating a logical expression of type 'Boolean expression 1&& Boolean expression 2', both the Boolean expressions are not always evaluated.
A. True
B. False
C.
D.
Answer : A
27. Every call to wait has a corresponding call to notify that will eventually end the wafting.
A. True
B. False
C.
D.
Answer : A
28. 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
29. 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
30. forName() is a static factory method
A. True
B. False
C.
D.
Answer : A
31. class.forName(...) creates an instance of java ODBC driver
A. True
B. False
C.
D.
Answer : A
32. 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
33. 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
34. 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
35. Java is fully object oriented programme.
A. true
B. false
C.
D.
Answer : A
36. Which of the following are the wrapper classes?
A. Random
B. Vector
C. Byte
D. all of the above
Answer : C
37. 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
38. Which of the following methods can be used to draw the outline of a square?
A. fillRect()
B. drawLine()
C. drawString()
D. all of the above
Answer : B
39. The expression (x == y && a<b) is true If either x == y is true or a<b is true.
A. True
B. False
C.
D.
Answer : B
40. Submit button always fires doPost(...)
A. True
B. False
C.
D.
Answer : B
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. A package is a collection of
A. classes
B. interface
C. editing tools
D. classes and interfaces
Answer : D
43. 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
44. The check box group class is a subclass of the component class.
A. True
B. False
C.
D.
Answer : B
45. 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
46. Frames and applets cannot be used together in the same program.
A. True
B. False
C.
D.
Answer : B
47. 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
48. Every method of a final in class is implicitly final.
A. True
B. False
C.
D.
Answer : A
49. Any method in a supper class can be over ridden in its subclass.
A. True
B. False
C.
D.
Answer : B
50. 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

Sharing is caring