JAVA APTITUDE QUESTIONS PDF
5) Difference between method overloading and method overriding in java? . .. 9. 6) Difference . Core java Interview questions on Coding Standards. Latest JAVA Aptitude Interview Questions for Freshers. If you going for interview then prepare for JAVA aptitude using these questions and get help to solve. Question: What are the two parts of a value of type double? Answers: Question: Page in the Course Pack has a set of rules for Java.
|Language:||English, Spanish, French|
|Genre:||Science & Research|
|ePub File Size:||22.89 MB|
|PDF File Size:||17.56 MB|
|Distribution:||Free* [*Regsitration Required]|
Java Aptitude Questions in cittadelmonte.info for more Java Aptitude Questions to download in pdf format. PDF | This book is intended to serve those who have just started in the “gaps” by answering several „wh y‟ and „how to‟ questions in Java. Java Programming questions and answers with explanation for interview, download Java Programming quiz questions with answers as PDF files and eBooks.
The Java interpreter is used for the execution of the source code. True False Ans: A class and the main method declarations. Two parts in executing a Java program are: Java Compiler and Java Interpreter. The Java Compiler is used for compilation and the Java Interpreter is used for execution of the application. Is the Mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse.
Oral quiz questions and answers. People-soft Certification Questions answers. Practice Test Exam Questions and Answers. Model Questions on Aptitude Tests. Solaris Admin Interview Questions Answers. SQL interview question with answer. Data Structures Aptitude question with answer. UnixLinux Basic interview question. Technical question ans on Networking. Technical question ans Operating Systems.
Technical question ans Operating Systems I. The Worst Interview Questions. Microprocessor and Electronics FAQ. Microprocessor Technical Question Answer. Windows Interview question answers. Windows Unix Interview Questions and Answers. See Also……. Which method is used to calculate the absolute value of a number? What are E and PI?
E is the base of the natural logarithm and PI is the mathematical value pi. Which of the following are true? The Class class is the superclass of the Object class. The Object class is final. The Class class can be used to load other classes. The ClassLoader class can be used to load other classes. Which of the following methods are methods of the Math class? Which of the following are true about the Error and Exception classes? Both classes extend Throwable. The Error class is final and the Exception class is not.
The Exception class is final and the Error is not. Both classes implement Throwable. The Void class extends the Class class. The Float class extends the Double class. The System class extends the Runtime class. The Integer class extends the Number class. Min Can't convert java lang Integer d 10 followed by 1 Ans: A Stream is an abstraction that either produces or consumes information.
There are two types of Streams. They are: Byte Streams: Byte Streams provide a convenient means for handling input and output of bytes. Character Streams: Character Streams provide a convenient means for handling input and output of characters. Byte Stream classes: Byte Streams are defined by using two abstract classes. InputStream and OutputStream. Character Stream classes: Character Streams are defined by using two abstract classes.
Reader and Writer. Which of the following statements are true? UTF characters are all 8-bits. UTF characters are all bits. Unicode characters are all bits. Bytecode characters are all bits. When you construct an instance of File, if you do not use the filenaming semantics of the local machine, the constructor will throw an IOException.
When you construct an instance of File, if the corresponding file does not exist on the local file system, one will be created. When an instance of File is garbage collected, the corresponding file on the local file system is deleted.
None of the above. The File class contains a method that changes the current working directory. It is possible to use the File class to list the contents of the current working directory.
Readers have methods that can read and return floats and doubles. You execute the code below in an empty directory. What is the result? A new directory called dirname is created in the current working directory. A new file called filename is created in directory dirname. A new directory called dirname and a new file called filename are created, both in the current working directory.
A new file called filename is created in the current working directory. No directory is created, and no file is created. What is the purpose of the File class? The File class is used to create objects that provide access to the files and directories of a local file system.
What interface must an object implement before it can be written to a stream as an object? An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object. What is the difference between the File and RandomAccessFile classes?
The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file. What class allows you to read objects directly from a stream? The ObjectInputStream class supports the reading of objects from input streams. What value does read return when it has reached the end of a file?
What value does readLine return when it has reached the end of a file? The readLine method returns null when it has reached the end of a file.
UTF-8 represents characters using 8, 16 and bit patterns. UTF uses bit and larger bit patterns. The InputStream and OutputStream classes are byte-oriented. The Reader and Writer classes are character-oriented. The Reader and Writer classes are the preferred solution to serialized object output. Filters are supported on input, but not on output. Filters read from one stream and write to another.
A filter may alter data that is read from one stream and written to another. Any Unicode character is represented using bits. UTF-8 characters are represented using only 8-bits. UTF characters are represented using only bits. The Serializable interface is used to identify objects that may be written to an output stream.
The Externalizable interface is implemented by classes that control the way in which their objects are serialized. The Serializable interface extends the Externalizable interface. The Externalizable interface extends the Serializable interface. Which of the following are true about the File class?
A File object can be used to change the current working directory. A File object can be used to access the files in the current directory. When a File object is created, a corresponding directory or file is created in the local file system. File objects are used to access files and directories on the local file system.
File objects can be garbage collected. When a File object is garbage collected, the corresponding file or directory is deleted. How do you create a Reader object from an InputStream object? Use the static createReader method of InputStream class.
Use the static createReader method of Reader class. Writer classes can be used to write characters to output streams using different character encodings. Writer classes can be used to write Unicode characters to output streams. Writer classes have methods that support the writing of the values of any Java primitive type to output streams. Writer classes have methods that support the writing of objects to output streams.
The isFile method returns a boolean value depending on whether the file object is a file or a directory. The System. What is meant by StreamTokenizer? StreamTokenizer breaks up InputStream into tokens that are delimited by sets of characters. It has the constructor: StreamTokenizer Reader inStream. Here inStream must be some form of Reader. What is Serialization and deserialization?
Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects. The File class does not support directly changing the current directory. A component subclass that has executed enableEvents to enable processing of a certain kind of event cannot also use an adapter as a listener for the same kind of event. What is the highest-level event class of the event-delegation model?
The java. What interface is extended by AWT event listeners? All AWT event listeners extend the java. EventListener interface.
What class is the top of the AWT event hierarchy? What event results from the clicking of a button? The ActionEvent event is generated as the result of the clicking of a button. What is the relationship between an event-listener interface and an event-adapter class?
An event-listener interface defines the methods that must be implemented by an event handler for a particular kind of event. An event adapter provides a default implementation of an event-listener interface.
In which package are most of the AWT events that support the event-delegation model defined? The AWTEvent class is defined in the java.
What is the advantage of the event-delegation model over the earlier event-inheritance model? The event-delegation has two advantages over the event-inheritance model. It enables event handling by objects other than the ones that generate the events. It performs much better in applications where many events are generated.
This performance improvement is due to the fact that the event-delegation model does not have to repeatedly process unhandled events, as is the case of the event-inheritance model. What is the purpose of the enableEvents method? The enableEvents method is used to enable an event for a particular object. The event-inheritance model has replaced the event-delegation model. The event-inheritance model is more efficient than the event-delegation model.
The event-delegation model uses event listeners to define the methods of event-handling classes.
The event-delegation model uses the handleEvent method to support event handling. Which of the following is the highest class in the event-delegation model? EventListener java. EventObject java. AWTEvent java. AWTEvent Ans: When two or more objects are added as listeners for the same event, which listener is first invoked to handle the event? The first object that was added as listener. The last object that was added as listener.
There is no way to determine which listener will be invoked first. It is impossible to have more than one listener for a given event. Which of the following components generate action events?
Buttons Labels Check boxes Windows Ans: A TextField object may generate an ActionEvent. A TextArea object may generate an ActionEvent. A Button object may generate an ActionEvent. A MenuItem object may generate an ActionEvent. The MouseListener interface defines methods for handling mouse clicks. The MouseMotionListener interface defines methods for handling mouse clicks. The MouseClickListener interface defines methods for handling mouse clicks. The ActionListener interface defines methods for handling the clicking of a button.
Suppose that you want to have an object eh handle the TextEvent of a TextArea object t. How should you add eh as the event handler for t? Add one or more event listeners to handle the events. Have the object override its processEvent methods. Have the object override its dispatchEvent methods. A component may handle its own events by adding itself as an event listener.
A component may handle its own events by overriding its event-dispatching method. A component may not handle oits own events. A component may handle its own events only if it implements the handleEvent method.
Should applets have constructors? Applet is a dynamic and interactive program that runs inside a Web page displayed by a Java capable browser.
How can I arrange for different applets on a web page to communicate with each other? Ask the applet for its applet context and invoke showDocument on that context object. Not Directly. The applets will exchange the information at one meeting place either on the local file system or at remote system. How do Applets differ from Applications?
Stand Alone Applet: Execution starts with main method. Execution starts with init method. May or may not be a GUI Applet: Use the getSize method, which the Applet class inherits from the Component class in the Java. The getSize method returns the size of the applet as a Dimension object, from which you extract separate width, height fields.
The applet stub interface provides the means by which an applet and the browser communicate. Your code will not typically implement this interface. It is essential to have both the. Name , value. Explain them? Returns a string describing the applet, its author ,copy right information, etc. All Applets are subclasses of Applet. All Applets must import java. What are the steps involved in Applet development? Applets are executed by the console based Java run-time interpreter.
Which classes and interfaces does Applet class consist? Applet class consists of a single class, the Applet class and three interfaces: What is the sequence for calling the methods by AWT for applets?
Latest JAVA Aptitude Test Interview Questions And Answers For Freshers For Job
When an applet begins, the AWT calls the following methods, in this sequence. Every color is created from an RGB value. False Ans: The code below draws a line. What color is the line? What does the following code draw? RED ; g. Which of the statements below are true? A polyline is always filled. What code would you use to construct a point bold serif font? What does the following paint method draw? A Canvas object provides access to a Graphics object via its paint method.
What are the Component subclasses that support painting. The Canvas, Frame, Panel and Applet classes support painting. What is the difference between the paint and repaint method?
The paint method supports painting via a Graphics object. The repaint method is used to cause paint to be invoked by the AWT painting method. What is the difference between the Font and FontMetrics classes?
The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of a Font object. Which of the following are passed as an argument to the paint method? Which of the following methods are invoked by the AWT to support paint and repaint operations? Which of the following classes have a paint method? Canvas Image Frame Graphics Ans: Which of the following are methods of the Graphics class?
Which Font attributes are available through the FontMetrics class? The AWT automatically causes a window to be repainted when a portion of a window has been minimized and then maximized. The AWT automatically causes a window to be repainted when a portion of a window has been covered and then uncovered. The AWT automatically causes a window to be repainted when application data is changed.
The AWT does not support repainting operations. Which method is used to size a graphics object to fit the current size of the window? What are the methods to be used to set foreground and background colors?
The string "Dolly" will be displayed at the centre of the frame b An error at compilation complaining at the signature of the paint method c The lower part of the word Dolly will be seen at the top of the form, with the top hidden. Background pink ; d s. Controls are componenets that allow a user to interact with your application.
The AWT supports the following types of controls: You want to construct a text area that is 80 character-widths wide and 10 character-heights tall.
What code do you use? A text field has a variable-width font. It is constructed by calling new TextField "iiiii". What happens if you change the contents of the text field to "wwwww"? Bear in mind that is one of the narrowest characters, and w is one of the widest. The text field becomes wider. The text field becomes narrower. The CheckboxGroup class is a subclass of the Component class. TextField and TextArea 7 Which method of the component class is used to set the position and the size of a component?
By associating Checkbox objects with a CheckboxGroup. A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more List items.
A Scrollbar is a Component, but not a Container. A Scrollpane is a Container and handles its own events and performs its own scrolling. Usage is TextArea rows, columns 21 Which of the following creates a List with 5 visible items and multiple selection enabled?
JAVA Questions and Answers
The validate method is used to cause a Container to be laid out and redisplayed. The add method is used to add a Component to a Container. The getComponent method is used to access a Component that is contained in a Container.
Suppose the Button is added to a Panel, which is added to the Frame. What background color will be used with the Panel?
Java Programming Questions and Answers
Yellow Color. Blue Color. Green Color. White Ans: The Container class has three major subclasses. TextField and TextArea. Non-exclusive Checkboxes. Radio buttons. Java supports two types of Checkboxes. Exclusive and Non-exclusive. In case of exclusive Checkboxes, only one among a group of items can be selected at a time. I f an item from the group is selected, the checkbox currently checked is deselected and the new selection is highlighted.
The exclusive Checkboxes are also called as Radio buttons. The non-exclusive checkboxes are not grouped together and each one can be selected independent of the other. A layout Manager is an object that is used to organize components in a container. The different layouts available in java. Adding a component to a container automatically removes it from any previous parent container.
Use setBounds, setSize, or setLocation methods to implement this.