1.
JTable has which of the following functions?
Correct Answer
B. It renders data
Explanation
JTable has the function of rendering data. This means that it is capable of displaying data in a visually appealing and organized manner. It can format and present the data in various ways, such as through columns and rows, making it easier for users to view and understand the information. Additionally, JTable also allows for customization, allowing developers to modify the appearance and behavior of the table to suit their needs.
2.
Statement.executeUpdate(); method is used for fetching the data from the database from netbeans?
Correct Answer
B. False
Explanation
The statement.executeUpdate() method is not used for fetching data from the database in NetBeans. It is used to execute SQL statements that modify the data in the database, such as INSERT, UPDATE, or DELETE statements. To fetch data from the database, the statement.executeQuery() method is used.
3.
Statement.executeUpdate(); method is used for fetching the data from the database from netbeans?
Correct Answer
B. False
Explanation
The statement.executeUpdate() method is not used for fetching data from the database in NetBeans. This method is typically used for executing SQL statements that modify data in the database, such as INSERT, UPDATE, or DELETE statements. To fetch data from the database in NetBeans, other methods like statement.executeQuery() or PreparedStatement.executeQuery() are typically used.
4.
JOptionPane.showInputDialog() will return?
Correct Answer
B. String
Explanation
The JOptionPane.showInputDialog() method is used to display a dialog box that prompts the user for input. It returns a String value, which is the user's input. Therefore, the correct answer is String.
5.
Which of the following needs to be imported for java jdbc connectivity JFrame project from netbeans?
Correct Answer
B. Java.sql.*;
Explanation
The correct answer is "java.sql.*;". This is because the java.sql package contains the necessary classes and interfaces for using JDBC (Java Database Connectivity) to connect to a database in a Java program.
6.
You want to take the input of Hobbies from the user, ie Sports, Movies , Traveling etc which of the following controls would be the most suitable?
Correct Answer
B. Check Box
Explanation
A check box would be the most suitable control for taking input of hobbies from the user. This is because a check box allows the user to select multiple options from a list, which is ideal for selecting multiple hobbies. A radio button, on the other hand, only allows the user to select one option, which would not be suitable for selecting multiple hobbies. A text field is used for entering free-form text, so it would not be appropriate for selecting hobbies from a predefined list. A combo box is a drop-down list that allows the user to select one option, so it would not be suitable for selecting multiple hobbies either.
7.
Which of the following SQL objects will store the data retrieved through a Query?
Correct Answer
D. ResultSet
Explanation
The ResultSet object in SQL stores the data retrieved through a query. It is used to hold the result set of a query and allows for easy access and manipulation of the data. The ResultSet object can be used to iterate over the rows of the result set and retrieve the values of each column in a specific row.
8.
Which of the following needs to be imported for java jdbc connectivity JFrame project from netbeans?
Correct Answer
B. Java.sql.*;
Explanation
The correct answer is "java.sql.*;". This is because the "java.sql" package contains classes and interfaces that are essential for JDBC (Java Database Connectivity) connectivity in a Java JFrame project. The other options, "javax.sql.*;", "javac.sql.*;", and "java.sql;", are incorrect as they either do not exist or do not provide the necessary classes for JDBC connectivity.
9.
Class.forName() method is used for?
Correct Answer
C. Registering the Driver
Explanation
The Class.forName() method is used for registering the driver. In Java, before establishing a connection to a database, the driver needs to be registered. The Class.forName() method is used to dynamically load the driver class and register it with the DriverManager. This allows the driver to be available for establishing the connection to the database.
10.
round and pow are methods of?
Correct Answer
B. Math package
Explanation
The methods "round" and "pow" are part of the Math package in Java. The Math package provides mathematical functions and operations, including rounding numbers and raising a number to a power.
11.
Which keyword is used for implementing inheritance in java?
Correct Answer
B. Extends
Explanation
The keyword "extends" is used for implementing inheritance in Java. Inheritance allows a class to inherit the properties and methods of another class, known as the superclass. The "extends" keyword is used to create a subclass that inherits the attributes and behaviors of the superclass. By using "extends", the subclass can access and use the methods and variables of the superclass, allowing for code reuse and creating a hierarchical relationship between classes.
12.
Combination of two or more different kinds of inheritances is called?
Correct Answer
B. Hybrid Inheritance
Explanation
Hybrid inheritance refers to a combination of two or more different types of inheritances. This means that a class can inherit properties and methods from multiple base classes. It allows for greater flexibility and reusability of code, as it combines the benefits of different types of inheritances.
13.
Calender is a static class?
Correct Answer
A. True
Explanation
The statement is true because the Calendar class in Java is a static class. This means that it can be accessed directly without creating an instance of the class. The methods and fields in the Calendar class are also static, allowing them to be accessed without creating an object of the class.
14.
Java is object oriented language because it supports classes and encapsulation?
Correct Answer
A. True
Explanation
Java is considered an object-oriented language because it supports the concept of classes and encapsulation. In Java, everything is treated as an object, and objects are instances of classes. Classes define the properties and behaviors of objects, and encapsulation allows for the bundling of data and methods within a class, providing data hiding and abstraction. These features are fundamental to object-oriented programming, making Java an object-oriented language.
15.
Which of the following is used to add or delete from a JList?
Correct Answer
A. DefaultListModel
Explanation
DefaultListModel is used to add or delete elements from a JList. It is a class that extends the AbstractListModel and provides methods such as addElement() and removeElement() to modify the contents of the JList. ListModel is an interface that provides methods to access the elements of a list but does not have methods to add or delete elements. Therefore, the correct answer is DefaultListModel.
16.
for using date and calender which package should be imported?
Correct Answer
B. Util
Explanation
To use date and calendar in a program, the "Util" package should be imported. This package contains classes and methods that provide functionality for working with dates and calendars. By importing the "Util" package, we can access and use the classes and methods related to date and calendar operations in our program.
17.
The overloaded methods are distinguished by both the return type and signature of the method?
Correct Answer
B. False
Explanation
Overloaded methods are distinguished solely by the signature of the method, which includes the number, type, and order of the parameters. The return type of the method does not play a role in distinguishing overloaded methods. Therefore, the statement in the question is incorrect.
18.
How many types of dialogs are supported by jOptionPane?
Correct Answer
D. 4
Explanation
jOptionPane supports four types of dialogs.
19.
Each row of a JTable in java is added using?
Correct Answer
B. Object
Explanation
In Java, each row of a JTable is added using an Object. This is because JTable is a flexible component that can display data of any type. By using an Object, we can store and display different types of data in each row of the JTable.
20.
Which of the following methods is used by DefaultTableModel class to add rows to table.
Correct Answer
C. AddRow(Object newrow)
Explanation
The DefaultTableModel class uses the addRow(Object newrow) method to add rows to a table. This method takes an object parameter representing the new row to be added to the table.
21.
Arrange the events in the order they need to be carried out
1. Extract data from result set
2. import the sql package
3. Execute Query
4.Open a connection
Correct Answer
D. 2,4,3,1
Explanation
The correct order of events to be carried out is as follows:
1. Import the sql package
2. Open a connection
3. Execute Query
4. Extract data from result set.
22.
The MySql service is available by default at which of the following ports?
Correct Answer
D. 3306
Explanation
The correct answer is 3306. This is the default port for the MySql service. Ports are used to establish communication between different services or applications. In the case of MySql, port 3306 is used to establish connections and transfer data between the MySql server and client applications.
23.
The Statement.executeQuery() will return?
Correct Answer
D. ResultSet
Explanation
The Statement.executeQuery() method in Java returns a ResultSet object. This object represents a set of database query results, which can be used to retrieve and manipulate data from the database. The ResultSet object contains methods to navigate through the result set, retrieve data from the columns, and perform various operations on the data. Therefore, the correct answer is ResultSet.
24.
Super keyword is used for which of the two purposes?
Correct Answer(s)
A. Refer to base class members with same name as in derived class in the derived class
D. Passing parameters to base class constructor
Explanation
The super keyword is used in Java to refer to base class members with the same name as in the derived class. This allows the derived class to access and use the base class members without any ambiguity. Additionally, the super keyword is also used to pass parameters to the base class constructor when creating new objects of the base class.
25.
The Statement.executeUpdate() will return?
Correct Answer
A. Int
Explanation
The Statement.executeUpdate() method in Java returns an integer value. This value represents the number of rows affected by the SQL statement that was executed. Therefore, the correct answer is "int".
26.
The overloaded methods are distinguished by both the return type and signature of the method?
Correct Answer
B. False
Explanation
The statement is false because overloaded methods are distinguished only by the signature of the method, not the return type. Overloaded methods can have the same return type but different parameters, or they can have different return types but the same parameters. The return type alone does not differentiate between overloaded methods.
27.
How many types of dialogs are supported by jOptionPane?
Correct Answer
D. 4
Explanation
jOptionPane supports four types of dialogs. These dialogs are used to display messages or prompt the user for input. The four types include plain message dialog, information message dialog, warning message dialog, and error message dialog. Plain message dialog is used to display a simple message. Information message dialog is used to display an informational message. Warning message dialog is used to display a warning message. Error message dialog is used to display an error message.
28.
JDBC can be used only from java?
Correct Answer
A. True
Explanation
JDBC (Java Database Connectivity) is a Java API that allows Java programs to interact with databases. It provides a set of classes and interfaces that enable developers to connect to a database, execute SQL queries, and retrieve and manipulate data. Since JDBC is a Java API, it can only be used from Java programming language. Other programming languages may have their own APIs or libraries for interacting with databases. Therefore, the statement "JDBC can be used only from Java" is true.
29.
Each row of a JTable in java is added using?
Correct Answer
B. Object
Explanation
In Java, each row of a JTable is added using an Object. This is because JTable is a flexible component that can display data of any type. By using an Object, we can store and display different types of data in each row of the JTable. This allows for a wide range of data to be displayed in a tabular format.
30.
ODBC can be used from any front end?
Correct Answer
A. True
Explanation
ODBC (Open Database Connectivity) is a standard programming interface that allows applications to access data in database management systems. It provides a consistent way for different front-end applications to communicate with various database systems. Therefore, ODBC can indeed be used from any front end, making the statement "True" correct.
31.
JOptionPane.showConfirmDialog() will return which of the following?
Correct Answer
A. Int
Explanation
The JOptionPane.showConfirmDialog() method returns an integer value. This value represents the user's choice from the dialog box, which can be one of three options: YES_OPTION, NO_OPTION, or CANCEL_OPTION. Therefore, the correct answer is int.
32.
Which of the following methods is used by DefaultTableModel class to add rows to table.
Correct Answer
C. AddRow(Object newrow)
Explanation
The DefaultTableModel class uses the addRow(Object newrow) method to add rows to a table. This method takes an object representing the new row as a parameter and adds it to the table.
33.
Savepoints need to be named?
Correct Answer
A. True
Explanation
Savepoints in a database are used to mark a specific point in a transaction where it can be rolled back to in case of an error or failure. Naming savepoints allows for better management and identification of savepoints within a transaction. It provides a way to reference specific savepoints when performing rollback or commit operations. By naming savepoints, it becomes easier to track the sequence of savepoints and their purpose within a transaction, making it a good practice to name them.
34.
By default autocommit is on?
Correct Answer
A. True
Explanation
By default, the autocommit feature is turned on in most database management systems. This means that any changes made to the database are automatically saved and committed without the need for explicit commit statements. This can be convenient for simple operations where immediate persistence of data is desired. However, it can also lead to unintended consequences if not managed properly, such as accidental data modifications. Therefore, it is important to be aware of the autocommit setting and adjust it as needed for specific use cases.
35.
Arrange the events in the order they need to be carried out
1. Extract data from result set
2. import the sql package
3. Execute Query
4.Open a connection
Correct Answer
D. 2,4,3,1
Explanation
The correct order of events is as follows:
1. Import the sql package (2)
2. Open a connection (4)
3. Execute Query (3)
4. Extract data from result set (1)
36.
Till a user commits a transaction other users can not see the changed value during the progress of the transaction , which of the ACID properties does the above specify?
Correct Answer
C. I
Explanation
The given answer, "I", refers to the ACID property of Isolation. Isolation ensures that until a transaction is committed, the changes made by that transaction are not visible to other concurrent transactions. This property guarantees that each transaction is executed in isolation from other transactions, preventing interference and ensuring data consistency.
37.
The MySql service is avialable by default at which of the following ports?
Correct Answer
D. 3306
Explanation
The correct answer is 3306. This port number is the default port for the MySQL service.
38.
One transaction can have only one DML statement?
Correct Answer
B. False
Explanation
False. One transaction can have multiple DML (Data Manipulation Language) statements. DML statements are used to modify, insert, or delete data in a database. In a transaction, multiple DML statements can be executed together as a single unit of work, ensuring that all changes are either committed or rolled back together. This allows for data consistency and integrity within the database.
39.
Any DDL statement will automatically commit a tracnsatcion under progress?
Correct Answer
A. True
Explanation
DDL (Data Definition Language) statements in SQL, such as CREATE, ALTER, and DROP, are automatically committed by default. This means that any changes made by these statements are immediately permanent and cannot be rolled back. Unlike DML (Data Manipulation Language) statements, which can be rolled back using the ROLLBACK command, DDL statements do not require an explicit COMMIT statement to make the changes permanent. Therefore, any DDL statement will automatically commit a transaction that is in progress.
40.
Which of the following are the two advantages of Inheritence?
Correct Answer(s)
A. Code Reuse
C. Models Real World
Explanation
Inheritance allows for code reuse, as it allows a subclass to inherit the properties and methods of its superclass. This means that common functionality can be defined in a superclass and reused in multiple subclasses, reducing code duplication. Additionally, inheritance allows for modeling real-world relationships, as subclasses can inherit characteristics from their superclass that reflect real-world relationships between objects. This can make the code more intuitive and easier to understand.
41.
Protected data members are accessible outside the class in which defined?
Correct Answer
B. False
Explanation
Protected data members are only accessible within the class in which they are defined and in the derived classes. They are not accessible outside of the class.
42.
Which of the following two are determinants of the Signature of a class?
Correct Answer(s)
C. Datatype of parameters
D. Number of Parameters
Explanation
The datatype of parameters and the number of parameters are both determinants of the Signature of a class. The Signature of a class refers to the unique combination of the method's name, number of parameters, and the types of those parameters. Therefore, the datatype of parameters and the number of parameters are important factors in determining the signature of a class.
43.
JOptionPane.showConfirmDialog() will return which of the following?
Correct Answer
A. Int
Explanation
The correct answer is int. The JOptionPane.showConfirmDialog() method returns an integer value that represents the user's choice in a confirmation dialog box. The returned value can be used to determine which button the user clicked, such as "Yes", "No", or "Cancel".
44.
Class level variables are declared ?
Correct Answer
C. In the beginning of the class definition
Explanation
Class level variables are declared in the beginning of the class definition. This means that they are declared outside of any specific method or constructor in the class. By declaring variables at the class level, they become accessible to all methods within the class. This allows the variables to be shared and used throughout the class, rather than being limited to a specific method or constructor.
45.
Savepoints need to be named?
Correct Answer
A. True
Explanation
Savepoints need to be named in order to be referenced later in the transaction. By assigning a name to a savepoint, it becomes possible to rollback to that specific savepoint if needed. This allows for more granular control over the transaction and enables the ability to undo specific portions of the transaction while preserving the changes made after the savepoint. Without naming savepoints, it would be difficult to identify and rollback to specific points in the transaction.
46.
do -- while loop is exit controlled loop?
Correct Answer
A. True
Explanation
A do-while loop is an exit-controlled loop because the condition is checked at the end of the loop. This means that the loop will always execute at least once before checking the condition. If the condition is true, the loop will continue to execute, otherwise, it will exit.
47.
By default autocommit is on?
Correct Answer
A. True
Explanation
By default, autocommit is set to "on" in many database management systems. This means that each individual SQL statement is treated as a transaction and is automatically committed to the database once it is executed. This can be convenient for small or simple operations where you don't need to manually manage transactions. However, in more complex scenarios, it may be necessary to turn off autocommit and manually manage transactions to ensure data consistency and integrity.
48.
Durability of a transaction means?
Correct Answer
C. Permanance of changes made
Explanation
Durability of a transaction refers to the permanence of the changes made during the transaction. It ensures that once a transaction is committed, the changes made are permanent and will not be lost, even in the event of system failures or crashes. This is typically achieved by writing the changes to a persistent storage medium, such as a disk, so that they can be recovered and restored in case of any failure.
49.
Till a user commits a transaction other users can not see the changed value during the progress of the transaction , which of the ACID properties does the above specify?
Correct Answer
C. I
Explanation
The given answer is "I" which stands for Isolation. This property of ACID ensures that until a transaction is committed, the changes made by that transaction are not visible to other users. This allows for concurrent transactions to be executed without interfering with each other and ensures data consistency.
50.
You make payment for your air reservation through your mobile, this is an example of?
Correct Answer
B. M-commerce
Explanation
Making a payment for an air reservation through a mobile device falls under the category of m-commerce, which stands for mobile commerce. M-commerce refers to any financial transaction or commercial activity conducted through a mobile device, such as a smartphone or tablet. In this scenario, the use of a mobile device to make a payment for an air reservation demonstrates the convenience and accessibility of m-commerce in modern-day transactions.