Quiznetik

Java Programming | Set 4

1. The following specifies the advantages of It is lightweight. It supports pluggable look and feel. It follows MVC (Model View Controller) architecture.

Correct : A. Swing

2. Swing is not a part of JFC (Java Foundation Classes) that is used to create GUI application?

Correct : B. False

3. These two ways are used to create a Frame By creating the object of Frame class (association) By extending Frame class (inheritance)

Correct : B. False

4. Which package provides many event classes and Listener interfaces for event handling?

Correct : C. java.awt.event

5. The ActionListener interface is used for handling action events,For example,it's used by a

Correct : D. All of these

6. Which is the container that doesn't contain title bar and MenuBars. It can have other components like button, textfield etc?

Correct : C. Panel

7. Which of these package is used for all the text related modifications?

Correct : C. java.lang.text

8. RMI has which of these protocols implementations?

Correct : D. All mentioned above

9. In RMI which layer defines and supports the invocation semantics of the RMI connection, this layer maintains the session during the method call?

Correct : C. The Remote Reference Layer

10. Which method of the Naming class (found in java.rmi) is used to update the RMI registry on the server machine?

Correct : A. rebind ()

11. In RMI program the following two steps are used to, Either extend the UnicastRemoteObject class, the exportObject() method of the UnicastRemoteObject class,

Correct : A. Provide the Implementation of the remote interface

12. Which is built on the top of socket programming?

Correct : B. RMI

13. In RMI program the following example shows the, import java.rmi.*; public interface Adder extends Remote{ public int add(int x,int y)throws RemoteException; }

Correct : C. Create the remote interface

14. In RMI applications which program obtains a remote reference to one or more remote objects on a server and then invokes methods on them?

Correct : B. Client

15. Which is a one-way communication only between the client and the server and it is not a reliable and there is no confirmation regarding reaching the message to the destination?

Correct : B. UDP

16. In a RMI Client Program, what are the exceptions which might have to handled?

Correct : D. All mentioned above

17. Abbreviate the term DGC?

Correct : B. Distributed Garbage Collection

18. Which of the following is a type of polymorphism in Java?

Correct : A. Compile time polymorphism

19. When does method overloading is determined?

Correct : B. At compile time

20. Which concept of Java is a way of converting real world objects in terms of class?

Correct : C. Abstraction

21. Which component is responsible to optimize bytecode to machine code?

Correct : C. JIT

22. How can we identify whether a compilation unit is class or interface from a .class file?

Correct : A. Java source file header

23. Which of these packages contains abstract keyword?

Correct : A. java.lang

24. Which of these class is used to create an object whose character sequence is mutable?

Correct : B. StringBuffer()

25. Which of these method of class StringBuffer is used to find the length of current character sequence?

Correct : A. length()

26. What is the string contained in s after following lines of code? StringBuffer s new StringBuffer("Hello"); s.deleteCharAt(0);

Correct : B. ello

27. Which of these method(s) is/are used for writing bytes to an outputstream?

Correct : B. print() and write()

28. Which keyword is used by the method to refer to the object that invoked it?

Correct : D. this

29. What is the return type of a method that does not return any value?

Correct : C. void

30. Which of these selection statements test only for equality?

Correct : B. switch

31. Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration?

Correct : D. continue

32. Which of these is the method which is executed first before execution of any other thing takes place in a program?

Correct : C. static method

33. Which of these data type can be used for a method having a return statement in it?

Correct : D. both int and float

34. If an expression contains double, int, float, long, then the whole expression will be promoted into which of these data types?

Correct : C. double

35. Which of the below is invalid identifier with the main method?

Correct : C. private

36. Which of these can not be used for a variable name in Java?

Correct : B. keyword

37. which of the following can be operands of arithmetic operators?

Correct : D. Both Numeric & Characters

38. How to copy contents of array?

Correct : A. System.arrayCopy()

39. Which of these are selection statements in Java?

Correct : A. if()

40. Which of these operators is used to allocate memory for an object?

Correct : C. new

41. Which of these packages contains the exception Stack Overflow in Java?

Correct : A. java.lang

42. Which of this method of class String is used to obtain a length of String object?

Correct : D. length()

43. Which of these methods of a Thread class is used to suspend a thread for a period of time?

Correct : A. sleep()

44. Which of these exceptions will be thrown if we use null reference for an arithmetic operation?

Correct : B. NullPointerException

45. Which of the interface contains all the methods used for handling thread related operations in Java?

Correct : A. Runnable interface

46. Which of these class is used to read and write bytes in a file?

Correct : C. FileInputStream

47. Which of these classes is used for input and output operation when working with bytes?

Correct : A. InputStream

48. Which of these class is a superclass of all other classes?

Correct : D. Object

49. Which of these class is not a member class of java.io package?

Correct : A. String

50. Which of these class is not related to input and output stream in terms of functioning?

Correct : A. File

51. Standard output variable ‘out’ is defined in which class?

Correct : D. System

52. Which of these packages contains all the event handling interfaces?

Correct : C. java.awt.event

53. Which of these keywords is not a part of exception handling?

Correct : C. thrown

54. Which of these exceptions handles the divide by zero error?

Correct : A. ArithmeticException

55. Which of these exceptions will occur if we try to access the index of an array beyond its length?

Correct : D. ArrayIndexOutOfBoundsException

56. What decides thread priority?

Correct : D. Thread scheduler

57. Which of the following will ensure the thread will be in running state?

Correct : C. wait()

58. Which of these is used to read a string from the input stream?

Correct : C. read()

59. Which of these methods can be used to output a string in an applet?

Correct : A. display()

60. Which of these methods is a part of Abstract Window Toolkit (AWT) ?

Correct : A. display()

61. Which of these operators can be used to get run time information about an object?

Correct : C. instanceof

62. Which of these methods can be used to writing console output?

Correct : D. all of the mentioned

63. Which of these class is used to read from a file?

Correct : C. FileInputStream

64. Which of these events is generated by scroll bar?

Correct : D. AdjustmentEvent

65. Which of these methods can be used to obtain the command name for invoking ActionEvent object?

Correct : B. getActionCommand()

66. Which of the following is not a primitive data types?

Correct : B. String.

67. What is the range of the char type?

Correct : D. 0 to 215-1.

68. Literals in java must be preceded by which of these?

Correct : D. both a & b.

69. Object is an _________ of a class.

Correct : A. instance.

70. Class is a ______ entity.

Correct : A. logical.

71. Object is a _______ entity.

Correct : B. physical.

72. ______ can appear anywhere in the body of a java method.

Correct : B. declaration.

73. ______ must be the first non comment statement in the file.

Correct : A. package.

74. _______ is passed to a method by use of call-by-reference.

Correct : B. objects.

75. Every method of a ________ is implicitly final.

Correct : C. final class.

76. A _______ object cannot be modified after it is created.

Correct : C. string.

77. A ____ class may not have any abstract method.

Correct : C. final.

78. What will be the result of the expression 13 & 25?

Correct : C. 9.

79. What will be result of expression 9 | 9?

Correct : C. 9.

80. _________ Operators are overloaded for string objects?

Correct : B. +, =.

81. If an expression contains double, int, float, long, then whole expression will promoted into which of these data types?.

Correct : C. double.

82. ________ is valid for if statement?

Correct : B. A Boolean expression.

83. A package is a collection of ______.

Correct : B. classes and interfaces.

84. ________ statement is valid for array declaration.

Correct : C. float number [];.

85. What is the output of relational operators?.

Correct : B. boolean.

86. Which of these operators can skip evaluating right hand operand?.

Correct : D. &&.

87. Which exception is thrown by the read () method of Input Stream class?

Correct : D. IOException.

88. Which of the following denotes a javadoc comment?

Correct : C. /**.

89. Using the keyword interface you can fully abstract a _________.

Correct : C. class.

90. One interface can inherit another by use of the keyword _____.

Correct : B. extends.

91. An exception is an __________ condition that arises in a code.

Correct : A. abnormal.

92. ______ is at the top of the exception class hierarchy.

Correct : B. throwable.

93. In java thread to thread communication is called _____.

Correct : C. messaging.

94. Which of these access specifiers can be used for an interface?.

Correct : A. public.

95. Java programs perform I/O through _______.

Correct : C. streams.

96. In java a _______ is a sequence of characters.

Correct : A. string.

97. The String is defined in _______ namespace.

Correct : A. java.Lang.

98. __________ is a special member function.

Correct : D. constructor.

99. Keyword _____ is always a reference to the object.

Correct : B. this.

100. ________ is the mechanism that binds together the code and the data.

Correct : B. encapsulation.