- X 2
1.Which of the following methods is not defined in the java.util.Vector class?
2.Which of the following methods is used while passing or returning a java object from the native method?
3.Which of the following exceptions is not a checked exception?
4.Which of the following is a valid constructor for the DataInputStream class?
DataInputStream(FileInputStream fin, int size)
5.Which of the following methods is available in the StringBuffer class but not in the String class?
6.How many methods are defined by the serializable Interface?
7.____________ is a highly optimized set of instructions designed to be executed by the Java run-time system.
8.There are _____ types of Comments in Java.
9.Which of the following statements are true about coupling and cohesion? Each correct answer represents a complete solution. Choose all that apply
High cohesion is necessary to create a well-defined application.
Loose coupling is necessary to create a well-defined application.
High coupling is necessary to create a well-designed application.
Low coupling is necessary to create a well-designed application.
10.Sam works as a software developer for Amrtech info. He writes code using assert as an identifier for a class named KeyTest. Which of the following will he use to compile the KeyTest class successfully?
Javac –source 1.4 KeyTest.java
Javac –source 1.5 KeyTest.java
Javac –source 5 KeyTest.java
11.The ability of an object to store data beyond the life time of the object is called __________
12.Which of the following are the classes from which another class inherits its behavior.
13.Overloaded methods are a form of _____________ time polymorphism and overridden methods are form of __________- time polymorphism.
14.The statement that calls the constructor of the superclass should be the last statement in the constructor of a subclass.
15.The capacity of the string buffer can be changed with the ___________ method provided in the class.
16._______________ modifier reduces the amount of data being serialized and improves performance.
17.An assertion can be placed at any location where control will not be reached.
18.An assert statement checks a Boolean expression during runtime execution.
19.Requesting for missing files is a common example of ________________ exception.
20.A single method can throw only one exception.
21.___________________ modifier allows the content of a variable to be synchronized across all running threads and ___________________ modifier can be applied only to methods of a class and indicates that the implementation of the method is outside the class.
22.AssertionError contains a default constructor and _________ single-parameter constructors.
23.Which of the following statements are true regarding Assertion?
A. An assertion tells the user of the program that something went wrong.
B. An assertion documents some assumption about the program.
C. When an assertion fails, it points out a bug in the programming logic.
D. Assertions are created to deal with problems that might occur during the course of execution of the program.
E. Assertions are written to state assumptions made by the program.
A, B, E
B, C, E
C, D, E
A, B, C, D
24.Identify the correct answer.
Statement 1: Class variables are initialized only when the class is instantiated.
Statement 2: Instance variables are assigned a default value even before the class is instantiated.
Statement 1 is True, Statement 2 is False.
Statement 1 is False, Statement 2 is True.
Both the statements are True.
Both the statements are False.
25.Which of the following are not the disadvantages of static methods?
Static method can be invoked by using the class name directly.
Static methods can be used to implement behaviors that are not influenced by the state of any instances.
A static method cannot be overridden, although it can be hidden.
Non-static attributes of the class cannot be accessed from within a static method.
26.Which of the following are the advantages of Instance methods?
Instance methods can be overridden and overloaded.
They can be accessed by using an instance of the class using the dot operator.
Static variables cannot be accessed from the instance methods.
Methods having private access in a class are not inherited.
27.Which of the following statements are not true with respect to the finalize method?
Is used to clean external resources such as files and streams that are open.
Garbage collector need not call the finalize method before it collects an instance of an object.
None of the above statements is applicable.
28.Which of the following statements are true about static method?
Static methods state that the method can be called without an object.
Static methods can use only static data and methods.
Static methods cannot be inherited or overridden.
29.Which of the following statements are not true regarding synchronized method modifier?
It is used with a method while implementing threads.
It permits only one thread access to a block of code at a time.
It permits only two thread access to a block of code at a time
It permits any number of thread access to a block of code at a time.
What do you think the answers are? We don't just hand out answers on this site - we're more interested in helping people learn for themselves. A lot of those questions can be answered by reading the documentation, so I'd suggest you start there.
If you don't understand why the answers are what they are, that's where we can help out.
Most of the questions you ask can be answered by studying the Java API documentation. Please look at that documentation and try to answer the questions yourself. If you have more specific questions, please ask them here.
Also, please QuoteYourSources. These questions look like they have been copied from a book or somewhere else. Please tell us where you copied them from.
Santanu kumar Acharya wrote:1.Which of the following methods is not defined in the java.util.Vector class?
Look at the API documentation of class java.util.Vector.
Santanu kumar Acharya wrote:2.Which of the following methods is used while passing or returning a java object from the native method?
Lookup these methods in the API documentation of class java.lang.System.
Santanu kumar Acharya wrote:3.Which of the following exceptions is not a checked exception?
Do you know what a checked exception is? Lookup the API documentation for each of these exception classes.
Santanu kumar Acharya wrote:4.Which of the following is a valid constructor for the DataInputStream class?
Lookup the API documentation of class DataInputStream.
Please answer these questions
1) Are you taking our test?
2) Do you have a problem in your application?
3) If the answer to the above question is yes than what is the problem???