0

programming languages Online Quiz - 329

Description: programming languages Online Quiz - 329
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

Which type of Statements can execute parameterized queries?

  1. O (a) PreparedStatement

  2. O (b) ParameterizedStatement

  3. O (c) ParameterizedStatement and CallableStatement

  4. O (d) All kinds of Statements (i.e. which implement a sub interface of Statement)


Correct Option: A

AI Explanation

To answer this question, we need to understand the concept of parameterized queries and the types of statements that can execute them.

Parameterized queries are SQL statements that contain placeholders for input parameters. These placeholders are then replaced with actual values when the query is executed. Parameterized queries provide several benefits, including improved security and performance.

Now let's go through each option to understand which type of statements can execute parameterized queries:

Option A) (a) PreparedStatement - This option is correct because PreparedStatement is a type of statement that can execute parameterized queries. It allows you to precompile a SQL statement with placeholders and then set the actual parameter values before executing the query. This helps in preventing SQL injection attacks and improves performance by reusing the precompiled statement.

Option B) (b) ParameterizedStatement - This option is incorrect because there is no such type of statement called ParameterizedStatement.

Option C) (c) ParameterizedStatement and CallableStatement - This option is incorrect because while PreparedStatement can execute parameterized queries, CallableStatement is used specifically for executing stored procedures and does not support parameterized queries.

Option D) (d) All kinds of Statements (i.e. which implement a sub interface of Statement) - This option is incorrect because not all types of statements can execute parameterized queries. Only PreparedStatement, which is a sub-interface of Statement, supports parameterized queries.

Therefore, the correct answer is option A) (a) PreparedStatement. This option is correct because PreparedStatement is the type of statement that can execute parameterized queries.

How can you retrieve information from a ResultSet?

  1. O (a) By invoking the method get (..., String type) on the ResultSet, where type is the database

  2. O (b) By invoking the method get (..., Type type) on the ResultSet, where Type is an object

  3. O (c) By invoking the method getValue (...), and cast the result to the desired java type.

  4. O (d) By invoking the special getter methods on the ResultSet: getString (...), get Boolean (...),


Correct Option: D
Explanation:

To retrieve information from a ResultSet, the user needs to know the methods that can be used to access the data. A ResultSet is a table of data that represents the results of a database query.

Now let's go through each option and explain why it is right or wrong:

A. O (a) By invoking the method get (..., String type) on the ResultSet, where type is the database

This option is incorrect because there is no method get (..., String type) in ResultSet. The method get() can be used to retrieve data from the ResultSet, but it requires the index or the name of the column. The String type parameter is not valid.

B. O (b) By invoking the method get (..., Type type) on the ResultSet, where Type is an object

This option is incorrect because there is no method get (..., Type type) in ResultSet. The method get() can be used to retrieve data from the ResultSet, but it requires the index or the name of the column. The Type type parameter is not valid.

C. O (c) By invoking the method getValue (...), and cast the result to the desired java type.

This option is incorrect because there is no method getValue() in ResultSet. The method get() can be used to retrieve data from the ResultSet, but it requires the index or the name of the column. Additionally, the method get() returns an object that needs to be cast to the desired data type.

D. O (d) By invoking the special getter methods on the ResultSet: getString (...), get Boolean (...),

This option is correct. ResultSet provides special getter methods such as getString(), getInt(), getBoolean(), etc. that can be used to retrieve data from the ResultSet. These methods take the index or the name of the column as a parameter and return the value of the column as the desired data type.

The Answer is: D

How can you execute DML statements (i.e. insert, delete, update) in the database?

  1. O (a) By making use of the InsertStatement, DeleteStatement or UpdateStatement classes

  2. O (b) By invoking the execute(...) or executeUpdate(...) method of a normal Statement object

  3. O (c) By invoking the executeInsert(...), executeDelete(...) or executeUpdate(...) methods of

  4. O (d) By making use of the execute(...) statement of the DataModificationStatement object


Correct Option: B
Explanation:

To execute DML statements (i.e. insert, delete, update) in the database, the user needs to know the methods or classes available to achieve this.

Option A is incorrect because there are no predefined classes in Java named InsertStatement, DeleteStatement or UpdateStatement for executing DML statements in a database.

Option B is correct. You can execute DML statements by invoking the execute() or executeUpdate() method of a normal Statement object. The execute() method is used for executing any type of SQL statement and can return a boolean value indicating whether the query returns a ResultSet or not. The executeUpdate() method is used for executing insert, delete, and update statements and returns an integer value representing the number of rows affected by the query.

Option C is incorrect because there are no predefined methods named executeInsert(), executeDelete() or executeUpdate() for executing DML statements in Java.

Option D is incorrect because there is no class named DataModificationStatement in Java.

Therefore, the correct answer is:

The Answer is: B

How do you know in your Java program that a SQL warning is generated as a result of executing a SQL statement in the database?

  1. O (a) You must catch the checked SQLException which is thrown by the method which executes

  2. O (b) You must catch the unchecked SQLWarningException which is thrown by the method

  3. O (c) You must invoke the getWarnings() method on the Statement object (or a sub interface

  4. O (d) You must query the ResultSet object about possible warnings generated by the database


Correct Option: C
Explanation:

To know in your Java program that a SQL warning is generated as a result of executing a SQL statement in the database, you must invoke the getWarnings() method on the Statement object (or a sub interface). Therefore, option C is the correct answer.

Option A is incorrect because SQLException is thrown when an SQL error occurs, not a warning. It is a checked exception and must be caught or declared to be thrown.

Option B is incorrect because SQLWarningException is not a valid exception class in Java. SQLWarning is the class that represents a warning issued by the database.

Option D is incorrect because ResultSet object is used to retrieve data from the database after executing a query, not to retrieve warnings.

Therefore, the correct answer is:

The Answer is: C. O (c) You must invoke the getWarnings() method on the Statement object (or a sub interface).

What is, in terms of JDBC, a DataSource?

  1. O (a) A DataSource is the basic service for managing a set of JDBC drivers

  2. O (b) A DataSource is the Java representation of a physical data source

  3. O (c) A DataSource is a registry point for JNDI-services

  4. O (d) A DataSource is a factory of connections to a physical data source


Correct Option: D

AI Explanation

To answer this question, you need to understand the concept of a DataSource in terms of JDBC.

Option A) A DataSource is the basic service for managing a set of JDBC drivers - This option is incorrect. Although a DataSource is used to manage JDBC drivers, it is not the basic service for managing them.

Option B) A DataSource is the Java representation of a physical data source - This option is incorrect. Although a DataSource is a representation of a physical data source, it is not the Java representation of it.

Option C) A DataSource is a registry point for JNDI-services - This option is incorrect. Although a DataSource can be registered in the Java Naming and Directory Interface (JNDI) registry, it is not specifically a registry point for JNDI-services.

Option D) A DataSource is a factory of connections to a physical data source - This option is correct. A DataSource in terms of JDBC is a factory that provides connections to a physical data source. It manages the creation, pooling, and recycling of connections to the database.

The correct answer is Option D. This option is correct because it accurately describes the role of a DataSource in JDBC.

What is the meaning of ResultSet.TYPE_SCROLL_INSENSITIVE

  1. O (a) This means that the ResultSet is insensitive to scrolling

  2. O (b) This means that the Resultset is sensitive to scrolling, but insensitive to updates, i.e. not

  3. O (c) This means that the ResultSet is sensitive to scrolling, but insensitive to changes made

  4. O (d) The meaning depends on the type of data source, and the type and version of the driver


Correct Option: C

AI Explanation

To answer this question, we need to understand the meaning of the constant "ResultSet.TYPE_SCROLL_INSENSITIVE" in the context of database result sets.

Option A) This option is incorrect because it states that the ResultSet is insensitive to scrolling. However, the correct meaning of "ResultSet.TYPE_SCROLL_INSENSITIVE" is that the ResultSet is sensitive to scrolling.

Option B) This option is incorrect because it states that the ResultSet is sensitive to scrolling but insensitive to updates. However, the correct meaning of "ResultSet.TYPE_SCROLL_INSENSITIVE" is that the ResultSet is sensitive to scrolling but insensitive to changes made.

Option C) This option is correct. "ResultSet.TYPE_SCROLL_INSENSITIVE" means that the ResultSet is sensitive to scrolling, but insensitive to changes made. It allows you to move the cursor both forward and backward in the ResultSet, but any changes made to the data by other processes or transactions are not reflected in the ResultSet.

Option D) This option is incorrect because it states that the meaning depends on the type of data source and the type and version of the driver. However, the meaning of "ResultSet.TYPE_SCROLL_INSENSITIVE" is consistent across different data sources and drivers.

Therefore, the correct answer is Option C) This means that the ResultSet is sensitive to scrolling, but insensitive to changes made.

  1. O (a) Yes, but only if you call the method openCursor() on the ResultSet, and if the driver and

  2. O (b) Yes, but only if you indicate a concurrency strategy when executing the statement, and

  3. O (c) Yes, but only if the ResultSet is an object of class UpdateableResultSet, and if the driver

  4. O (d) No, ResultSets are never updateable. You must explicitly execute DML statements (i.e.


Correct Option: B
Explanation:

To answer this question, the user needs to have knowledge about ResultSets and their characteristics.

Option A is incorrect because there is no openCursor() method in the ResultSet class.

Option B is partially correct. The ResultSet object is updateable only if you indicate a concurrency strategy when executing the statement, and the driver supports updateable ResultSets.

Option C is incorrect because there is no class called UpdateableResultSet in the Java API.

Option D is incorrect because ResultSets can be updateable, but it depends on the driver, the type of ResultSet, and the concurrency strategy used.

Therefore, the correct answer is:

The Answer is: B

What statements are correct about JDBC transactions (2 answers)?

  1. [_] [a] A transaction is a set of successfully executed statements in the database

  2. [_] [b] A transaction is finished when commit() or rollback() is called on the Connection object,

  3. [_] [c] A transaction is finished when commit() or rollback() is called on the Transaction object

  4. [_] [d] A transaction is finished when close() is called on the Connection object.


Correct Option: B,D

AI Explanation

To answer this question, we need to understand the concept of JDBC transactions. Let's go through each statement to determine which ones are correct:

A. [ ] A transaction is a set of successfully executed statements in the database - This statement is incorrect. A transaction is a logical unit of work that can consist of one or more database operations, but it is not necessarily limited to successfully executed statements. Transactions can also include statements that may fail or be rolled back.

B. [ ] A transaction is finished when commit() or rollback() is called on the Connection object - This statement is correct. In JDBC, a transaction is considered finished when either the commit() or rollback() method is called on the Connection object. The commit() method is used to permanently save the changes made in the transaction, while the rollback() method is used to discard the changes and revert the database to its previous state.

C. [ ] A transaction is finished when commit() or rollback() is called on the Transaction object - This statement is incorrect. In JDBC, there is no Transaction object. Transactions are managed using the Connection object, and the commit() or rollback() methods are called directly on the Connection object.

D. [ ] A transaction is finished when close() is called on the Connection object - This statement is correct. When the close() method is called on the Connection object, any pending transaction is automatically committed. Therefore, closing the Connection object can also be considered as finishing the transaction.

Based on the explanations above, the correct statements about JDBC transactions are B and D.

How can you start a database transaction in the database?

  1. O (a) By asking a Transaction object to your Connection, and calling the method begin() on it

  2. O (b) By asking a Transaction object to your Connection, and setting the autoCommit property

  3. O (c) By calling the method beginTransaction() on the Connection object

  4. O (d) By setting the autoCommit property of the Connection to false, and execute a statement


Correct Option: D

AI Explanation

To start a database transaction in the database, the correct option is D) By setting the autoCommit property of the Connection to false, and execute a statement.

Explanation for each option:

Option A) By asking a Transaction object to your Connection, and calling the method begin() on it - This option is incorrect. While it is possible to start a transaction using a Transaction object, typically, the transaction is managed directly through the Connection object.

Option B) By asking a Transaction object to your Connection, and setting the autoCommit property - This option is incorrect. The autoCommit property determines whether each SQL statement is automatically committed or not. It does not directly start a transaction.

Option C) By calling the method beginTransaction() on the Connection object - This option is incorrect. While some databases provide a method called beginTransaction() to start a transaction, it is not a standard method in the JDBC API.

Option D) By setting the autoCommit property of the Connection to false, and execute a statement - This option is correct. To start a transaction, you can set the autoCommit property of the Connection to false. This means that each SQL statement will not be automatically committed, allowing you to group multiple statements into a single transaction. You can then execute the desired statements to perform your transaction.

What is the meaning of the transaction isolation level TRANSACTION_REPEATABLE_READ

  1. O (a) Dirty reads, non-repeatable reads and phantom reads can occur

  2. O (b) Dirty reads are prevented; non-repeatable reads and phantom reads can occur

  3. O (c) Dirty reads and non-repeatable reads are prevented; phantom reads can occur

  4. O (d) Dirty reads, non-repeatable reads and phantom reads are prevented


Correct Option: C
Explanation:

To understand the meaning of the transaction isolation level TRANSACTION_REPEATABLE_READ, we need to know about transaction isolation levels in database management systems.

Transaction isolation level is a concept that ensures the correctness and consistency of database transactions. It defines the level of isolation between concurrent transactions in the system.

The TRANSACTION_REPEATABLE_READ isolation level guarantees that during the transaction, any row that is read will be locked for the duration of the transaction. This means that if the transaction tries to read the same row again, it will get the same value as before. This ensures that the transaction sees a consistent snapshot of the data.

Now let's go through each option to see which one is correct:

A. (a) Dirty reads, non-repeatable reads, and phantom reads can occur - This option is incorrect. The TRANSACTION_REPEATABLE_READ level prevents dirty reads and non-repeatable reads, but phantom reads can still occur.

B. (b) Dirty reads are prevented; non-repeatable reads and phantom reads can occur - This option is incorrect. The TRANSACTION_REPEATABLE_READ level prevents dirty reads, but non-repeatable reads and phantom reads can still occur.

C. (c) Dirty reads and non-repeatable reads are prevented; phantom reads can occur - This option is correct. The TRANSACTION_REPEATABLE_READ level prevents dirty reads and non-repeatable reads, but phantom reads can still occur.

D. (d) Dirty reads, non-repeatable reads, and phantom reads are prevented - This option is incorrect. The TRANSACTION_REPEATABLE_READ level only prevents dirty reads and non-repeatable reads, but phantom reads can still occur.

Therefore, the answer is: C. (c) Dirty reads and non-repeatable reads are prevented; phantom reads can occur.

What statements are correct about positioned updates (i.e. cursor updates) in ResultSets? (2 answers)

  1. [_] [a] Using the cursor technique is currently the only possible way to change the data in the

  2. [_] [b] Insert statements are not supported when using cursors.

  3. [_] [c] Only scrollable updateable ResultSets can use this approach to change the data in the

  4. [_] [d] The name of the cursor is specified by the setCursorName(String name) method the


Correct Option: B,D

AI Explanation

To answer this question, we need to understand the concept of positioned updates in ResultSets.

Option A) Using the cursor technique is currently the only possible way to change the data in the ResultSets. This statement is incorrect. Positioned updates are one way to change the data in ResultSets, but they are not the only possible way. Other methods, such as using SQL update statements, can also be used to modify the data in ResultSets.

Option B) Insert statements are not supported when using cursors. This statement is correct. When using positioned updates (cursor updates) in ResultSets, insert statements are not supported. Positioned updates are primarily used for modifying existing data in the ResultSets, not for inserting new data.

Option C) Only scrollable updatable ResultSets can use this approach to change the data in the ResultSets. This statement is incorrect. Positioned updates can be used with both scrollable and forward-only ResultSets. Scrollable ResultSets allow for navigating through the ResultSet in both directions, while forward-only ResultSets only allow forward navigation.

Option D) The name of the cursor is specified by the setCursorName(String name) method. This statement is correct. The name of the cursor used for positioned updates can be specified using the setCursorName(String name) method. This allows for identifying and referencing the cursor when performing updates on the ResultSets.

Therefore, the correct statements about positioned updates in ResultSets are:

  • B) Insert statements are not supported when using cursors.
  • D) The name of the cursor is specified by the setCursorName(String name) method.

So, the correct answer is B, D.

How can you execute a stored procedure in the database?

  1. O (a) Call method execute() on a CallableStatement object

  2. O (b) Call method executeProcedure() on a Statement object

  3. O (c) Call method execute() on a StoredProcedure object

  4. O (d) Call method run() on a ProcedureCommand object


Correct Option: A
Explanation:

The correct answer is A. You can execute a stored procedure in the database by calling the execute() method on a CallableStatement object.

Explanation:

A stored procedure is a precompiled set of SQL statements that are stored in the database. To execute a stored procedure, you need to create a CallableStatement object, which allows you to call the stored procedure.

Here's an example of how to execute a stored procedure using Java and JDBC:

// Assuming you have already established a database connection
CallableStatement cstmt = conn.prepareCall("{call your_stored_procedure(?, ?)}");

// Set any input parameters for the stored procedure, if needed
cstmt.setString(1, "input_parameter1");
cstmt.setInt(2, 2);

// Execute the stored procedure
cstmt.execute();

In the code above, your_stored_procedure is the name of the stored procedure you want to execute. The ? placeholders are used for any input parameters the stored procedure may require. You can set the input parameters using the setXxx() methods on the CallableStatement object.

Lastly, you call the execute() method on the CallableStatement object to execute the stored procedure.

What happens if you call the method close() on a ResultSet object?

  1. O (a) the method close() does not exist for a ResultSet. Only Connections can be closed.

  2. O (b) the database and JDBC resources are released

  3. O (c) you will get a SQLException, because only Statement objects can close ResultSets

  4. O (d) the ResultSet, together with the Statement which created it and the Connection from


Correct Option: B
Explanation:

To answer this question, the user needs to have a basic understanding of Java Database Connectivity (JDBC) and ResultSet objects.

Option A is incorrect. The close() method does exist for ResultSet objects.

Option B is correct. If you call the close() method on a ResultSet object, the resources associated with the ResultSet will be released and returned to the database. This includes any database and JDBC resources that were used to create the ResultSet.

Option C is incorrect. The close() method can be called on a ResultSet object, but not on a Statement object. It is the Statement object that creates the ResultSet.

Option D is incorrect. While the ResultSet is associated with the Statement and Connection objects that created it, calling the close() method on the ResultSet will only release the resources associated with the ResultSet itself, not the Statement or Connection objects.

Therefore, the answer is: B. O (b) the database and JDBC resources are released.

What happens if you call deleteRow() on a ResultSet object?

  1. O (a) The row you are positioned on is deleted from the ResultSet, but not from the database.

  2. O (b) The row you are positioned on is deleted from the ResultSet and from the database

  3. O (c) The result depends on whether the property synchonizeWithDataSource is set to true or

  4. O (d) You will get a compile error: the method does not exist because you can not delete rows


Correct Option: B
Explanation:

The correct answer to the question is B. The row you are positioned on is deleted from the ResultSet and from the database.

The deleteRow() method of the ResultSet interface deletes the current row from the ResultSet object and from the underlying database table. This means that the row will no longer be visible in the ResultSet object, and it will also be deleted from the database.

The deleteRow() method only works if the ResultSet object is updatable. An updatable ResultSet object is one that can be used to modify data in the database. To create an updatable ResultSet object, you must set the CONCUR_UPDATABLE property of the Statement object that you use to execute the query.

The deleteRow() method does not throw any exceptions. If you try to delete a row from a ResultSet object that is not updatable, the method will simply do nothing.

Here is an example of how to use the deleteRow() method:

import java.sql.*;

public class DeleteRowExample {

    public static void main(String[] args) throws SQLException {
        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/mydatabase", "username", "password");
        Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
        String sql = "SELECT * FROM customers";
        ResultSet resultSet = statement.executeQuery(sql);

        // Move the cursor to the first row.
        resultSet.first();

        // Delete the current row.
        resultSet.deleteRow();

        // Close the connection.
        connection.close();
    }
}

This code will delete the first row in the customers table.

What statements are correct about batched insert and updates? (2 answers)

  1. [_] [a] To create a batch of insert and update statements, you create an object of type Batch,

  2. [_] [b] Batch insert and updates are only possible when making use of parameterized queries.

  3. [_] [c] To do a batched update/insert, you call addBatch(String statement) on a Statement

  4. [_] [d] To execute a batched update/insert, you call the executeBatch() method on a Statement


Correct Option: C,D

AI Explanation

To answer this question, let's go through each statement:

A) To create a batch of insert and update statements, you create an object of type Batch. This statement is incorrect. In general, to create a batch of insert and update statements, you would typically use an object of type PreparedStatement or CallableStatement, not Batch.

B) Batch insert and updates are only possible when making use of parameterized queries. This statement is not provided as an option, so it is not relevant to the question.

C) To do a batched update/insert, you call addBatch(String statement) on a Statement. This statement is correct. To add a SQL statement to a batch, you would call the addBatch(String statement) method on a Statement object. The statement parameter should be a valid SQL statement.

D) To execute a batched update/insert, you call the executeBatch() method on a Statement. This statement is correct. To execute a batch of SQL statements, you would call the executeBatch() method on a Statement object. This method returns an array of integers representing the update counts for each statement in the batch.

Based on the explanations above, the correct statements are C) and D).

What is correct about DDL statements (create, grant,...)?

  1. O (a) DDL statements are treated as normal sql statements, and are executed by calling the

  2. O (b) To execute DDL statements, you have to install additional support files

  3. O (c) DDL statements can not be executed by making use of JDBC, you should use the native

  4. O (d) Support for DDL statements will be a feature of a future release of JDBC


Correct Option: A
Explanation:

To answer this question, the user needs to have knowledge about DDL (Data Definition Language) statements and their characteristics.

Now, let's go through each option and explain why it is right or wrong:

A. O (a) DDL statements are treated as normal SQL statements, and are executed by calling them. This statement is correct. DDL statements are used to define or modify the structure of database objects like tables, indexes, etc. and they are executed like normal SQL statements.

B. O (b) To execute DDL statements, you have to install additional support files. This statement is incorrect. There is no requirement for additional support files to execute DDL statements.

C. O (c) DDL statements cannot be executed by making use of JDBC, you should use the native database SQL interface. This statement is incorrect. DDL statements can be executed using JDBC (Java Database Connectivity) API like any other SQL statement.

D. O (d) Support for DDL statements will be a feature of a future release of JDBC. This statement is incorrect. DDL statements are already supported by JDBC.

Therefore, the correct option is:

The Answer is: A

Which of the following java.util classes support Internationalization?

  1. a)Locale

  2. b)ResourceBundle

  3. c)Country

  4. d)Language


Correct Option: A,B

AI Explanation

To answer this question, we need to understand the concept of Internationalization in Java and the classes that support it.

Internationalization in Java refers to the process of designing and implementing software that can be adapted for different languages and regions without making any changes to the core code. It allows for the localization of applications by providing support for different languages, date and time formats, number formats, and other cultural conventions.

The java.util package in Java provides several classes that support Internationalization. Let's go through each option to understand which classes support Internationalization:

Option A) Locale - This option is correct because the Locale class in the java.util package provides a way to represent a specific geographical, political, or cultural region. It allows for the localization of applications by providing information about the language, country, and variant preferences. The Locale class is used in conjunction with other Internationalization classes to provide localized resources.

Option B) ResourceBundle - This option is correct because the ResourceBundle class in the java.util package provides a way to manage localized resources. It allows for the retrieval of locale-specific objects from localized resource files. ResourceBundle is used to load and access localized messages, labels, and other resources that are specific to a particular locale.

Option C) Country - This option is incorrect because there is no specific class named "Country" in the java.util package that supports Internationalization.

Option D) Language - This option is incorrect because there is no specific class named "Language" in the java.util package that supports Internationalization.

The correct answers are A) Locale and B) ResourceBundle. These classes are used in conjunction with other Internationalization classes to provide support for different languages, regions, and localized resources.

Therefore, the correct answer is A,B.

Given the following to JSP files select the right answers. ////////// different file Hello

  1. 1) File container.jsp will compile if the directive page comes before the directive include

  2. 2) File container will compile and when executed it will show:”Hello”.

  3. 3) File container.jsp will compile if the errorPage in container.jsp is the same as in file included.jsp.

  4. 4) File container.jsp will compile if instead of directive include () it is used the action include ()


Correct Option: D

What are correct statements about creating scripting variables for a Tag::

  1. 1) It is necessary to implement TagExtraInfo interface.

  2. 2) You have to insert into the tag element of the taglib descriptor file an entry for tei-class element.

  3. 3) The interface you have to implement has a method called getVariableInfo.

  4. 4) None of the above.


Correct Option: A,B,C

Which of the following staments are correct about the following jsp lines:

  1. 1) It won't compile.

  2. 2) It is a valid jsp line and it will print the variable called name.

  3. 3) It will compile but it will always produce null as the output.

  4. 4) It will work if you create a javabean class with only one variable of type java.lang.String.


Correct Option: B
- Hide questions