1.
Give the abbreviation of AWT?
Correct Answer
B. Abstract Windowing Toolkit
Explanation
The correct answer is "Abstract Windowing Toolkit". AWT is a set of Java libraries that provide the foundation for creating graphical user interfaces (GUIs) in Java. It includes components such as buttons, menus, and text fields, as well as layout managers for organizing these components on a window. AWT is platform-independent, meaning that it can be used to create GUIs that run on different operating systems.
2.
Which is the container that contain title bar and can have MenuBars. It can have other components like button, textfield etc.?
Correct Answer
B. Frame
Explanation
A Frame is a container that contains a title bar and can have MenuBars. It can also have other components like buttons and text fields.
3.
The following specifies the advantages of It is lightweight. It supports pluggable look and feel. It follows MVC (Model View Controller) architecture.
Correct Answer
A. Swing
Explanation
Swing is the correct answer because it has several advantages over AWT. It is lightweight, meaning it consumes less memory and is faster in performance. It supports pluggable look and feel, allowing developers to customize the appearance of their applications. It also follows the MVC architecture, which helps in separating the data, presentation, and logic components of an application. AWT, on the other hand, does not have these advantages, making Swing a better choice for developing graphical user interfaces.
4.
The Following steps are required to perform 1) Implement the Listener interface and overrides its methods 2) Register the component with the Listener
Correct Answer
C. Event Handling
Explanation
The given steps describe the process of implementing event handling in a program. In event handling, the Listener interface is implemented and its methods are overridden to define the desired behavior when an event occurs. The component that needs to handle the event is then registered with the Listener. This allows the program to respond to events and perform the necessary actions based on the event. Therefore, the correct answer is Event Handling.
5.
Which is the container that doesn't contain title bar and MenuBars but it can have other components like button, textfield etc?
Correct Answer
C. Panel
Explanation
A Panel is a container that does not contain a title bar and menu bars, but it can have other components like buttons and text fields. Panels are often used to group related components together and provide a way to organize and layout the components within a larger container, such as a window or frame.
6.
Which method is used to set the graphics current color to the specified color in the graphics class?
Correct Answer
B. Public abstract void setColor(Color c)
Explanation
The correct answer is "public abstract void setColor(Color c)". This method is used to set the graphics current color to the specified color in the graphics class. It takes a Color object as a parameter and sets the current color to that specified color. This allows the programmer to change the color of the graphics being drawn on the screen.
7.
Which class is used for this Processing Method processActionEvent( )?
Correct Answer
A. Button,List,MenuItem
Explanation
The correct answer is Button, List, MenuItem. These classes are used for the Processing Method processActionEvent(). The processActionEvent() method is used to handle action events generated by these components.
8.
The Swing Component classes that are used in Encapsulates a mutually exclusive set of buttons?
Correct Answer
B. ButtonGroup
Explanation
ButtonGroup is the correct answer because it is a Swing component class that is used to encapsulate a mutually exclusive set of buttons. It allows only one button to be selected at a time within the group, providing a way to create radio button-like behavior for a set of buttons. This class is often used in situations where the user needs to choose only one option from a group of options.
9.
The following way is used to create a frame is by creating the object of Frame class?
Correct Answer
B. Association
Explanation
The correct answer is association because creating an object of the Frame class is a form of association. In object-oriented programming, association represents a relationship between two or more classes where each class has its own existence and can exist independently. In this case, the Frame class is associated with the object that is created from it, allowing the object to have its own properties and behaviors.
10.
Which are the techniques for defining the structure of a specific type of XML documents?
Correct Answer(s)
A. Schema
C. Both A & B
Explanation
The correct answer is "Schema, Both A & B." This is because both Schema and DTD are techniques used for defining the structure of XML documents. Schema is a more modern and flexible approach, while DTD (Document Type Definition) is an older and more rigid method. Therefore, both options A (Schema) and B (DTD) are valid techniques for defining the structure of XML documents.
11.
Implement the Listener interface and overrides its methods is required to perform in event handling?
Correct Answer
A. True
Explanation
To perform event handling, it is necessary to implement the Listener interface and override its methods. The Listener interface provides a set of methods that need to be implemented in order to handle events. By implementing this interface and overriding its methods, the necessary code can be written to respond to specific events when they occur. Therefore, the correct answer is True.
12.
Which object can be constructed to show any number of choices in the visible window?
Correct Answer
C. List
Explanation
A "List" object can be constructed to show any number of choices in the visible window. Lists are designed to display multiple items or options that users can select from, and they can be configured to show a scrollable list if there are more choices than can fit in the visible area. Labels, Choices (drop-down menus), and Checkboxes have different uses and typically display a limited number of options at a time.
13.
Which is used to store data and partial results, as well as to perform dynamic linking, return values for methods, and dispatch exceptions?
Correct Answer
C. Frame
Explanation
A frame is used to store data and partial results, as well as to perform dynamic linking, return values for methods, and dispatch exceptions. It is a component in a graphical user interface (GUI) that acts as a container for other components. Frames provide a way to organize and display multiple components within a window. They are commonly used in applications to create the main window or the top-level container.
14.
The setBackground() method is part of the following class in java.awt package:
Correct Answer
B. GrapHics
Explanation
The setBackground() method is part of the Graphics class in the java.awt package. This method is used to set the background color of a graphical component or container. By calling this method, we can change the background color of a graphic object or a graphical user interface element to the specified color.
15.
Which object of HttpSession can be used to view and manipulate information about a session?
Correct Answer
D. All mentioned above
Explanation
The correct answer is "All mentioned above" because all of the mentioned objects in HttpSession can be used to view and manipulate information about a session. The session identifier is a unique identifier for each session, the creation time represents the time when the session was created, and the last accessed time indicates the most recent time the session was accessed. By using these objects, developers can easily manage and track session information.
16.
Which case of a session bean obtains the UserTransaction object via the EJBContext using the getUserTransaction() method in EJB transaction management?
Correct Answer
A. Bean-managed transactions
Explanation
In bean-managed transactions, the session bean is responsible for managing its own transactions. It can obtain the UserTransaction object via the EJBContext using the getUserTransaction() method to control the transaction boundaries explicitly. In container-managed transactions, the container handles the transaction management, and the session bean does not have direct access to the UserTransaction object. Therefore, the correct answer is Bean-managed transactions.
17.
Connection Pooling Class manages no of user requests for connections to improve the performance.
Correct Answer
A. True
Explanation
Connection pooling is a technique used to improve the performance of applications that need to establish multiple database connections. The connection pooling class manages a pool of pre-established connections and assigns them to user requests as needed. By reusing connections instead of creating new ones for each request, the overhead of establishing a connection is reduced, resulting in improved performance. Therefore, the statement that the connection pooling class manages the number of user requests for connections to improve performance is true.
18.
Which class provides stream to read binary data such as image etc. from the request object?
Correct Answer
B. ServltInputStream
Explanation
The correct answer is ServltInputStream. This class provides a stream to read binary data, such as images, from the request object in a servlet. The ServletInputStream class is used to read data from the client's request, and it is typically used when handling binary data or when the data needs to be processed in a specific way. The ServletOutputStream class, on the other hand, is used to write data to the response object. Therefore, the correct class to use for reading binary data from the request object is ServletInputStream.
19.
The performance of the application will be faster if you use PreparedStatement interface because query is compiled only once.
Correct Answer
A. True
Explanation
Using the PreparedStatement interface in an application can result in faster performance because the query is compiled only once. This means that if the same query is executed multiple times, the database does not need to recompile it each time, leading to improved efficiency. PreparedStatement also allows for the use of parameterized queries, which can further optimize performance by reducing the need for query parsing and planning. Overall, using PreparedStatement can help enhance the speed and efficiency of an application's database operations.
20.
Which type of validation we must implement the Validateable interface (or extend ActionSupport class) and provide the implementation of validate method?
Correct Answer
C. By Custom Validation
Explanation
To implement the Validateable interface or extend the ActionSupport class and provide the implementation of the validate method, we must be using custom validation. This means that we want to define our own validation logic and rules for the input data. This allows us to have more control over the validation process and customize it according to our specific requirements.
21.
An RMI Server is responsible for
Correct Answer
D. All mentioned above
Explanation
An RMI Server is responsible for creating an instance of the remote object, exporting the remote object, and binding the instance of the remote object to the RMI registry. All of these tasks are necessary for the RMI Server to function properly and allow clients to access and interact with the remote object.
22.
How many steps are used to connect any java application using JDBC?
Correct Answer
B. 5
Explanation
To connect any Java application using JDBC, typically five steps are involved. These steps include loading the JDBC driver, establishing a connection to the database, creating a statement object, executing SQL queries or updates, and finally closing the connection. These steps ensure that the Java application can interact with the database using JDBC effectively.
23.
In the elements of Hibernate architecture is a factory of session and client of ConnectionProvider, It holds the second level cache (optional) of data is
Correct Answer
B. SessionFactory
Explanation
The correct answer is SessionFactory. In Hibernate architecture, SessionFactory is responsible for creating sessions and acts as a client of ConnectionProvider. It also holds the optional second level cache of data. The SessionFactory is a crucial component as it provides a thread-safe way to create and manage sessions, allowing efficient interaction with the database.
24.
Which tag is used to execute java source code in JSP?
Correct Answer
C. Scriptlet tag
Explanation
The scriptlet tag is used to execute Java source code in JSP. It allows the embedding of Java code directly into the JSP page, which can be used to perform various operations and generate dynamic content. The code within the scriptlet tag is executed at the server-side during the rendering of the JSP page.
25.
Which was the first most widely used programming interface for accessing relational databases and it offers the ability to connect all the databases on all the platforms.?
Correct Answer
B. ODBC API
Explanation
ODBC API (Open Database Connectivity Application Programming Interface) was the first most widely used programming interface for accessing relational databases. It offers the ability to connect all databases on all platforms, making it a popular choice for developers. JDBC API (Java Database Connectivity Application Programming Interface) is also widely used, but it came after ODBC and is specific to Java programming language. Therefore, the correct answer is ODBC API.
26.
Which method compares the given object to 'this' object?
Correct Answer
A. Public boolean equals(Object obj)
Explanation
The method public boolean equals(Object obj) is used to compare the given object to the current object. It returns true if the objects are equal and false otherwise. This method is commonly used to compare objects for equality in Java.
27.
Which methods are commonly used in ServerSocket class?
Correct Answer
B. Public Socket accept()
Explanation
The correct answer is "public Socket accept()". This method is commonly used in the ServerSocket class to accept a connection from a client. It waits until a client connects to the server and returns a Socket object that represents the connection. This allows the server to establish communication with the client and exchange data. The other methods listed, getOutputStream() and close(), are not specific to the ServerSocket class and are used for different purposes.
28.
Which constructor of DatagramSocket class is used to creates a datagram socket and binds it with the given Port Number?
Correct Answer
B. DatagramSocket(int port, InetAddress address)
Explanation
The constructor DatagramSocket(int port, InetAddress address) is used to create a datagram socket and bind it with the given port number. This constructor allows the user to specify both the port number and the IP address of the local machine to which the socket should be bound. By using this constructor, the user can ensure that the socket is bound to the desired port number and IP address before any data transfer takes place.
29.
Which is not a XML function?
Correct Answer
B. Style information
Explanation
The given options are all related to XML functions except for "Style information." XML functions typically involve manipulating or querying XML data, such as transporting, storing, or defining the structure of the data. However, "Style information" does not directly relate to XML functions as it refers to the presentation or formatting of the XML data, which is typically handled by CSS (Cascading Style Sheets) in web development.