Home

SSC MTS - Java Programming 1000+ MCQ [Solved] PDF Download

Thursday 9th of March 2023

Sharing is caring

1. Java is fully object oriented programme.
A. true
B. false
C.
D.
Answer : A
2. 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
3. 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
4. Every call to wait has a corresponding call to notify that will eventually end the wafting.
A. True
B. False
C.
D.
Answer : A
5. forName() is a static factory method
A. True
B. False
C.
D.
Answer : A
6. The break statement is required in the default case of a switch selection structure.
A. True
B. False
C.
D.
Answer : B
7. Two methods cannot have the same name in Java.
A. True
B. False
C.
D.
Answer : B
8. Which of the following are not keywords?
A. NULL
B. Implements
C. Protected
D. None of the above
Answer : A
9. Which exception is thrown by the read() method of InputStream class?
A. IOException
B. FileNotFoundException
C. ReadException
D. None of the above
Answer : A
10. Consider the following statements:
int x = 10, y = 15; 
x = ((x < y) ? (y + x) : (y - x);

What will be the value of x after executing these statements?

A. 25
B. 15
C. 5
D. Error can't be executed.
Answer : A
11. 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
12. 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
13. 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
14. A Java monitor must either extend thread class or implement Runnable interface.
A. True
B. False
C.
D.
Answer : B
15. 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
16. The check box group class is a subclass of the component class.
A. True
B. False
C.
D.
Answer : B
17. 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
18. Declaring a method synchronized guarantees that the deadlock cannot occur.
A. True
B. False
C.
D.
Answer : A
19. 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
20. Servlet has ___________
A. init method
B. doGet(------) method
C. All of the above methods.
D.
Answer : C
21. 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
22. A method declared as static can not access non-static class members.
A. True
B. False
C.
D.
Answer : A
23. 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
24. When we invoke repaint () for a Component, the AWT invokes the method:
A. draw()
B. update()
C. show()
D. paint()
Answer : B
25. When we implement an interface method, it should be declared as public.
A. True
B. False
C.
D.
Answer : A
26. When present, package must be the first no comment statement in the file.
A. True
B. False
C.
D.
Answer : A
27. For all insert, update, delete, query operations on a database, ResultSet object creation is mandatory.
A. True.
B. False.
C.
D.
Answer : B
28. Which of the following statements are valid array declarations?
A. int number();
B. float average[];
C. double[] marks;
D. counter int[];
Answer : B
29. Frames and applets cannot be used together in the same program.
A. True
B. False
C.
D.
Answer : B
30. 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
31. We can over load methods with differences only in their return type.
A. True
B. False
C.
D.
Answer : B
32. In RMI we invoke client method from remote server
A. True
B. False
C.
D.
Answer : B
33. Which of the following keywords are used to control access to a class member?
A. default
B. protected
C. interface
D. None of the above
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. The name of the RMI compiler is ___________
A. rmicom
B. rmic
C. jrmi
D. none of the above
Answer : B
36. A panel can not be added to another panel.
A. True
B. False
C.
D.
Answer : B
37. We can add more than one class(es) at the time of compilation Java Beans.
A. True.
B. False.
C.
D.
Answer : A
38. A constructor must always invoke its supper class constructor in its first statement.
A. True
B. False
C.
D.
Answer : B
39. Which of the following classes are available in the java.lang package?
A. Random
B. Stack
C. String Buffer
D. Vector
Answer : A
40. When X is a positive number the operations x>> 2 and x>>>2 both produce the same result.
A. True
B. False
C.
D.
Answer : A
41. The setBackground() method is part of the class
A. Applet
B. Component
C. Container
D. Object
Answer : B
42. Throwing an exception always causes program termination.
A. True
B. False
C.
D.
Answer : B
43. A final class may not have any abstract method.
A. True
B. False
C.
D.
Answer : A
44. The modulus operator (%) can be used only with Integer operands.
A. True
B. False
C.
D.
Answer : B
45. A variable declared inside the for loop control can not be referenced out side the loop.
A. True
B. False
C.
D.
Answer : A
46. 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
47. 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
48. 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
49. Which of the following represent legal flow control statements?
A. break();
B. continue(inner);
C. return;
D. exit();
Answer : C
50. 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

Sharing is caring