Monday, October 1, 2018

300+ Advance Java Interview Question Answer

Advance Java Interview Question Answer

Advance Java
Advance Java









Page No:-4

Amazon Best Offer

                           Answer Below the page

151. The queue is a data structure, which is based on?

a. FIFO ( first in first out ) property.   
b. LIFO (last in first out) property.
c. Both a&b.
d. None of Above 

152. How do you create mutable string objects in java?

a. By StringBuffer classes
b. By StringBuilder classes
c. Both a&b are used to create mutable String in java
d. None of Above

153. Which access specifier is used for describing Applet Class?

a.Private
b.Public   
c.Protected
d.None of Above

154. In Java, if any line starts with /* and ends with */ is known as?

a. Single line comment
b. Multi-line comment
c. Both A & B.
d. None of the above

155. How will you convert string to char array?

a.By toCharArray() method.   
b.By toChar() method.
c.By CharArray() method.
d.None of Above

156. Which stream is used for Object Serialization in java?

a.ObjectWriter
b.DataInputStream
c.ObjectOutputStream   
d.DataOutputStream 

157. Which of the following is the default Layout Manager for an Applet?

a.FlowLayout    
b.BorderLayout
c.GridLayout
d.CardLayout

158. Which of the following is a perfect example of compile-time polymorphism?

a. Constructor overloading
b. Method overriding
c. Method overloading
d. None of the above

159. Which of the following is a small unit of the process?

a. method
b. thread
c. applet
d. Constructor

160. When A variable declared inside the class but outside the body of the method, is called?

a. Instance variable    
b. Local Variable
c. Static variable
d. None of the above

161. If we want to block a single line in Java, so what we have to use?

a. Two forward slashes ( // )  
b. slash and a star ( /* )
c. System.out.println
d. System.out.print

162. How many objects will be created in the below code?  
String str1= new String("Avi");
String str2= new String("Avi");

a. Three objects will be created, two in heap memory and one in String constant pool.  
b. Two objects will be created here, One in heap memory and one in String constant pool.
c. Three objects will be created here, Three in heap memory.
d. One object will be created, in String constant pool.


163. A JSP page consists of?


a. HTML tags

b. JSP tags

c. Both A & B.

d. None of this


164.Bellow which language is Architecture-Neutral?


a. C++

b. Java,

c. C

d. None of above

165. Which of the following do not represent legal flow control in java?

a. exit();  
b. return;
c. break;
d. continue ;

166. Which of the following method belongs to the String class?

a. CompareTo()
b. equals()
c. length()
d. All of the above  

167. What will happen if we define a concrete method in an interface?

a. Compile-time error   
b. Run-time error
c. The program will be run
d. None of the above

168. Adapter classes are used for which purpose.

a. code redundancy
b. code reduction
c. code organization
d. None of the above

169.The default value of a static integer variable in Java?

a. 0   
b. 1 
c. Garbage value 
d. Null

170. The ActionListener interface is used for handling action events.

a. True
b. False

171. Which type of inheritance where one super-class has more than one sub-class?

a. Multilevel inheritance
b. Single inheritance
c. Multiple inheritances
d. Hierarchical inheritance   

172.math error in java that's called?

a. ArithmaticException  
b. NumberFormatException
c. DivisionByZeroException  
d. IOException

173. Why String is declared final or immutable in java?

a. String pool
b. Thread Safe
c. Security
d. ClassLoading
e. Above all reason are true.   

174. Which of the following stream is used to handle primitive data types in java?

a. FileOutputStream
b. DataInputStream   
c. BufferedOutputStream 
d. FileInputStream

175. What is the value of Math.rint(3.5)?

a. 4.0  
b. 3
c. 4.5
d. 3.0

176. What is Truncation is Java?

a. Integer value assigned to floating type
b. The floating-point value assigned to an integer type
c. The floating-point value assigned to a Floating type.
d. None of the above

177. The stack is a data structure, which is based on?

a. FIFO ( first in first out ) property.   
b. LIFO (last in first out) property.
c. Both a&b.
d. None of Above 

178.string is a  _____  data type?

a. primitive type
b. derived type
c. both a&b
d.  None of Above

179.Full form of ODBC? 

a. Object Data Binding Connectivity
b. Open Database Console
c. Open Database Connectivity
d. Object Database Command

180. Which method is used to create an exact copy of an object?

a. copyCon() 
b. clone() method   
c. both a&b
d. None of the above

181. What is the lifecycle of a servlet technology?

a. Servlet class is loaded.
b. Servlet instance is created.
c. The init method is invoked.
d. the service method is invoked.
e. destroy method is invoked.
f. All mentioned above   

182.which of the following statement is true?

a. public static void main(string[] args)
b. public static void Main(String[] args)
c. public static void main(String[] args) 
d. None of the above

183. Which of the following method is invoked first? when you run an applet.

a. The init() method
b. The applet's default constructor
c. The stop()method
d. The destroy() method

184. Which of the following statements is true?

a. Static methods may be declared abstract. 
b. Constructors can be abstract.
c. An abstract class cannot be instantiated.   
d. None of the above

185.ArrayList uses _______ array to store elements internally?

a. dynamic array. 
b. Static array.

186. Which method is executed after the init () method in an applet?

a. destroy()
b. start()   
c. stop()
e. exit().

187. How many objects will be created in the following code?

   String s1 = "ABC";
   String s2 = "ABC";
a. One object will be created.   
b. Two objects will be created.
c. No object will be created.
d. None of Above

188.In java Every event object has the ________ method.

a. getWhen() 
b. getTimeStamp() 
c. getActionCommand()
d.  getSource()   

189.In java ______ is a sequence of characters.

a. string
b. group chat
c. arrayChar   
d. object

190. Which of the following is required to run JSP pages?

a. Mail Server
b. Database connection
c. Java Web Server   
d. Applet viewer

191. What is final, finally and finalize in Java?

a. final is a keyword.
b. finally is a block.
c. finalize is a method.
d. All are true.   

192. What will be the answer to the following code?

Textfield java = new Textfield (5);

a. Creates a Java object that can hold 5 columns of text
b. Creates a java object that can hold 5 rows of text
c. Creates the object java and initializes it with the value 5
d. none of the above

193. What is the full form of JMS?

a. Java machine Service
b. Java Message Service
c. Java Mailing service.
d. None of the above

194.ListIterator traverses the elements in _____ directions?

a. forward.
b. backward
c. backward and forward both.  
d. None of the above

195.init( ) method is called ______ times.

a. 1   
b. 2
c. 3
d. multiple

196. How to get UTC time on display?

a. Date.getUTC(); 
d. Time.getUTC();
c. Instant.now();    
d. None of the above

197. Which class is used, when the program can't handle an exception?

a. Final
b. Try
c. Catch
d. Throws  

198. Where exactly the string constant pool is located in the memory?

a. Inside the stack memory
b. Inside the heap memory
c. Inside the heap memory
d. None of Above

199. Why strings are immutable in java?

a. Immutable strings are thread-safe.
b. String objects are used in class loading.
c. Immutable strings increase security.
d. Above all are true   

200. Which of the following is used to initialize the value of the string object?

a. Group literals
b. String literals
c. String group literals
d. Character Literals

[  Ans:-  151.a   152.c   153.b   154.b   155.a   156.c   157.a   158.b   159.b   160.a   161.a   162.a   163.c   164.b   165.a   166.d   167.a   168.b   169.a   170.a   171.d   172.a   173.e   174.b   175.a   176.b   177.a   178.b   179.c   180.b   181.f   182.c   183.b   184.c   185.a   186.b   187.a   188.d   189.c   190.c   191.d   192.a   193.b   194.c   195.a   196.c   197.d   198.b   199.d   200.b  ]
PAGE 1
PAGE 2 

PAGE 3
PAGE 5 

PAGE 6
PAGE 7 

PAGE 8


Disqus Comments