Home

Java Programming MCQ Solved Paper for SSC JE

Thursday 9th of March 2023

Sharing is caring

1. Servlet has ___________
A. init method
B. doGet(------) method
C. All of the above methods.
D.
Answer : C
2. class.forName(...) creates an instance of java ODBC driver
A. True
B. False
C.
D.
Answer : A
3. Java always provides a default constructor to a class.
A. True
B. False
C.
D.
Answer : B
4. Which of the following represent legal flow control statements?
A. break;
B. break();
C. continue(inner);
D. all of the above
Answer : A
5. A class may be both abstract and final.
A. True
B. False
C.
D.
Answer : B
6. The break statement is required in the default case of a switch selection structure.
A. True
B. False
C.
D.
Answer : B
7. Which of the following will produce a value of 10 if x = 9.7?
A. floor(x)
B. abs(x)
C. rint(x)
D. round(x)
Answer : D
8. 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
9. 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
10. A constructor must always invoke its supper class constructor in its first statement.
A. True
B. False
C.
D.
Answer : B
11. With javadoc, which of the following denotes a javadoc comment?
A. //#
B. /*
C. /**
D. //**
Answer : C
12. The programmer must explicitly create the system .in and system .out objects.
A. True
B. False
C.
D.
Answer : B
13. We can over load methods with differences only in their return type.
A. True
B. False
C.
D.
Answer : B
14. 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
15. When present, package must be the first no comment statement in the file.
A. True
B. False
C.
D.
Answer : A
16. Consider the following code snippet:
try 
{
int x=0; int y=50/x;
System.out.println("Division by zero");
}
catch(ArithmeticException e)
{
System.out.println("catch block");
}

What will be the output?

A. Error. Won't compile
B. Division by zero
C. Catch block
D. Division by zero catch block
Answer : C
17. A catch can have comma-separated multiple arguments.
A. True
B. False
C.
D.
Answer : B
18. Any method in a supper class can be over ridden in its subclass.
A. True
B. False
C.
D.
Answer : B
19. 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
20. Members of a class specified as private are accessible only to the methods of the class.
A. True
B. False
C.
D.
Answer : A
21. All the bitwise operators have the same level of precedence in Java.
A. True
B. False
C.
D.
Answer : A
22. In RMI before running the client program we must start RMI Registry.
A. True.
B. False.
C.
D.
Answer : A
23. Submit button always fires doPost(...)
A. True
B. False
C.
D.
Answer : B
24. Given the code
String s = new String("abc");
Which of the following calls are valid?

A. s.toUpperCase()
B. s.append("xyz")
C. s.setCharAt(1<'A')
D. all of the above
Answer : A
25. Frames and applets cannot be used together in the same program.
A. True
B. False
C.
D.
Answer : B
26. Throwing an exception always causes program termination.
A. True
B. False
C.
D.
Answer : B
27. Declaring a method synchronized guarantees that the deadlock cannot occur.
A. True
B. False
C.
D.
Answer : A
28. 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
29. Which of the following are keywords?
A. integer
B. default
C. Boolean
D. Object
Answer : B
30. It is perfectly legal to assign a subclass object to a supper class reference.
A. True
B. False
C.
D.
Answer : A
31. In order to connect to a database through java program we must create _______-
A. Connection, Statement, ResultSet
B. Connection, ResultSet
C. Statement< ResultSet
D. Connection, Statement
Answer : D
32. For all insert, update, delete, query operations on a database, ResultSet object creation is mandatory.
A. True.
B. False.
C.
D.
Answer : B
33. Declarations can appear anywhere in the body of a Java method.
A. True
B. False
C.
D.
Answer : A
34. 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
35. In RMI we invoke client method from remote server
A. True
B. False
C.
D.
Answer : B
36. 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
37. 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
38. Objects are passed to a method by use of call-by-reference.
A. True
B. False
C.
D.
Answer : A
39. 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
40. The import statement is always the first no comment statement in a Java program files.
A. True
B. False
C.
D.
Answer : B
41. Which of the following represent legal flow control statements?
A. break();
B. continue(inner);
C. return;
D. exit();
Answer : C
42. A variable declared inside the for loop control can not be referenced out side the loop.
A. True
B. False
C.
D.
Answer : A
43. Which are the valid ways to create DataInputStream streams?
A. new DataInputStream(new File("in.dat"));
B. new DataInputStream(new FileInputStream("in.dat"));
C. new DataInputStream("in.dat");
D. new DataInputStream("in.data","r");
Answer : B
44. 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
45. The name of the RMI compiler is ___________
A. rmicom
B. rmic
C. jrmi
D. none of the above
Answer : B
46. 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
47. Which of the following are not keywords?
A. NULL
B. Implements
C. Protected
D. None of the above
Answer : A
48. Which of the following statements are valid array declarations?
A. int number();
B. float average[];
C. double[] marks;
D. counter int[];
Answer : B
49. The keywords reserved but not used in the initial version of Java re:
A. Synchronized
B. Boolean
C. union
D. goto
Answer : D
50. Message-Driven beans act as a listener for the Java Message Service API, processing messages synchronously
A. True
B. False
C.
D.
Answer : B

Sharing is caring