0

programming languages Online Quiz - 51

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

A JSP file that uses a tag library must declare the tag library first. The tag library is defined using the taglib directive - Which of the following specifies the correct purpose of prefix attribute. Select the one correct answer.

  1. A. The prefix defines the name of the tag that may be used for a tag library

  2. B. The prefix attribute defines the location of the tag library descriptor file.

  3. C. The prefix attribute should refer to the short name attribute of the tag library file that is defined by the uri attribute of taglib directive.

  4. D. The prefix attribute is used in front of a tagname of a tag defined within the tag library.


Correct Option: D

Which of the elements defined within the taglib element of taglib descriptor file are required. Select the two correct answers.

  1. name

  2. description

  3. validator

  4. tag-class

  5. display-name


Correct Option: A,D

AI Explanation

To answer this question, you need to understand the structure of the taglib descriptor file (TLD) and which elements are required.

Let's go through each option to understand why it is correct or incorrect:

Option A) name - This option is correct because the "name" attribute is required in the taglib element. It specifies the unique name for the tag library.

Option B) description - This option is incorrect because the "description" element is optional. It provides a description or documentation for the tag library, but it is not required.

Option C) validator - This option is incorrect because the "validator" element is optional. It is used to define a validator class for the tag library, but it is not required.

Option D) tag-class - This option is correct because the "tag-class" element is required in the taglib element. It specifies the fully qualified class name of the tag handler class.

Option E) display-name - This option is incorrect because the "display-name" element is optional. It is used to provide a human-readable name for the tag library, but it is not required.

Therefore, the correct answers are A) name and D) tag-class. These elements are required in the taglib element of the taglib descriptor file.

Which of the following JSP variables are not available within a JSP expression. Select the one correct answer.

  1. out

  2. session

  3. request

  4. response

  5. httpsession

  6. page


Correct Option: E

AI Explanation

To answer this question, we need to understand the different JSP variables and their availability within a JSP expression.

Option A) out - This option is correct because the out variable is available within a JSP expression. It represents the JspWriter object and is used to send output to the response.

Option B) session - This option is correct because the session variable is available within a JSP expression. It represents the HttpSession object and is used to store and retrieve session-specific data.

Option C) request - This option is correct because the request variable is available within a JSP expression. It represents the HttpServletRequest object and is used to retrieve information about the client's request.

Option D) response - This option is correct because the response variable is available within a JSP expression. It represents the HttpServletResponse object and is used to send response back to the client.

Option E) httpsession - This option is incorrect because the httpsession variable is not available within a JSP expression. There is no standard JSP variable named httpsession available.

Option F) page - This option is correct because the page variable is available within a JSP expression. It represents the current JSP page and is used to access page-specific information and methods.

The correct answer is E) httpsession. This option is incorrect because the httpsession variable is not available within a JSP expression.

Which of the following represents a correct syntax for usebean. Select the two correct answers.

  1. G.

  2. H.

  3. I.

  4. J.


Correct Option: B,C

Which of these is true about include directive. Select the one correct answer.

  1. The included file must have jspf extension

  2. The XML syntax of include directive in .

  3. The content of file included using include directive, cannot refer to variables local to the original page

  4. When using the include directive, the JSP container treats the file to be included as if it was part of the original file.


Correct Option: D

AI Explanation

To answer this question, you need to understand the concept of the include directive in JSP. Let's go through each option to understand why it is correct or incorrect:

Option A) The included file must have a jspf extension - This option is incorrect because the included file does not have to have a specific extension. It can have any valid JSP extension.

Option B) The XML syntax of the include directive is - This option is incorrect because the XML syntax of the include directive is . The attribute used is "page" instead of "file".

Option C) The content of the file included using the include directive cannot refer to variables local to the original page - This option is incorrect because the content of the included file can refer to variables local to the original page. The included file has access to the variables defined in the original page.

Option D) When using the include directive, the JSP container treats the file to be included as if it was part of the original file - This option is correct. When the include directive is used, the JSP container essentially combines the content of the included file with the original file during the translation phase. It treats the included file as if it was part of the original file, allowing the included file to have access to the variables and other resources of the original file.

The correct answer is D. This option is correct because it accurately describes the behavior of the include directive in JSP.

  1. A. A status of 200 to 299 signifies that the request was successful

  2. B. A status of 300 to 399 are informational messages

  3. C. A status of 400 to 499 indicates an error in the server.

  4. D. A status of 500 to 599 indicates an error in the client.


Correct Option: A
Explanation:

To answer this question, the user needs to have knowledge about HTTP response status codes. The HTTP response status code indicates whether a request has been successfully completed or not. It is a 3-digit integer with the first digit indicating the general response class, while the last two digits do not have any categorization role.

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

A. A status of 200 to 299 signifies that the request was successful - This statement is correct. HTTP status codes 2xx indicate that the request was successfully received, understood, and accepted.

B. A status of 300 to 399 are informational messages - This statement is incorrect. HTTP status codes 3xx indicate redirection messages, not informational messages.

C. A status of 400 to 499 indicates an error in the server - This statement is incorrect. HTTP status codes 4xx indicate client errors, not server errors.

D. A status of 500 to 599 indicates an error in the client - This statement is incorrect. HTTP status codes 5xx indicate server errors, not client errors.

Therefore, the correct answer is:

The Answer is: A.

Which of the following are correct statements? Select the two correct answers.

  1. A. The getRequestDispatcher method of ServletContext class takes the full path of the servlet, whereas the getRequestDispatcher method of HttpServletRequest class takes the path of the servlet relative to the ServletContext.

  2. B. The include method defined in the RequestDispatcher class can be used to access one servlet from another. But it can be invoked only if no output has been sent to the server.

  3. C. The getRequestDispatcher(String URL) is defined in both ServletContext and HttpServletRequest method

  4. D. The getNamedDispatcher(String) defined in HttpServletRequest class takes the name of the servlet and returns an object of RequestDispatcher class.


Correct Option: A,C

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) The statement is correct. The getRequestDispatcher method of the ServletContext class takes the full path of the servlet, whereas the getRequestDispatcher method of the HttpServletRequest class takes the path of the servlet relative to the ServletContext. This allows for flexibility in specifying the servlet path.

Option B) The statement is incorrect. The include method defined in the RequestDispatcher class can be used to access one servlet from another, regardless of whether any output has been sent to the server. It does not depend on the presence or absence of output.

Option C) The statement is correct. The getRequestDispatcher(String URL) method is indeed defined in both the ServletContext and HttpServletRequest classes. This allows for obtaining a request dispatcher from either the application context or a specific request.

Option D) The statement is incorrect. The getNamedDispatcher(String) method is not defined in the HttpServletRequest class. It is only defined in the ServletContext class. This method allows for obtaining a request dispatcher by specifying the name of the servlet.

Therefore, the correct statements are A and C.

Name the location of compiled class files within a war file? Select the one correct answer.

  1. /META-INF/classes

  2. /classes

  3. /WEB-INF/classes

  4. /root/classes


Correct Option: C

AI Explanation

To answer this question, you need to understand the structure of a WAR (Web Application Archive) file.

A WAR file is a compressed file format used to package and distribute a web application. It contains all the necessary files, including HTML, CSS, JavaScript, Java class files, and other resources.

The location of compiled class files within a WAR file is typically within the /WEB-INF/classes directory. This directory is specific to Java web applications and is a commonly used location for storing compiled Java class files.

Let's go through each option to understand why it is correct or incorrect:

Option A) /META-INF/classes - This option is incorrect because the /META-INF directory is typically used for storing metadata files, such as the manifest file. It is not the standard location for compiled class files.

Option B) /classes - This option is incorrect because the root directory /classes is not a standard location for compiled class files within a WAR file.

Option C) /WEB-INF/classes - This option is correct because the /WEB-INF/classes directory is the standard location for storing compiled class files within a WAR file. The "WEB-INF" directory is a protected directory that is not directly accessible from the web, making it a secure location for storing sensitive files.

Option D) /root/classes - This option is incorrect because there is no standard location called /root/classes within a WAR file.

The correct answer is C) /WEB-INF/classes. This option is correct because it is the standard location for compiled class files within a WAR file.

In WebLogic clusters, what is the load balancing algorithm ?

  1. RoundRobin

  2. FIFO

  3. LIFO

  4. None


Correct Option: A

Truncate is a Data Definition Language.

  1. True

  2. False


Correct Option: A

Delete is faster than Truncate.

  1. True

  2. False


Correct Option: B

Using which option a dropped table can be undropped ?

  1. ROLLBACK

  2. FLASHBACK

  3. GETBACK

  4. NONE


Correct Option: B

What is returned from the query SELECT NVL2(NULL,'V1','V2') from DUAL;

  1. V1

  2. NULL

  3. V2

  4. None


Correct Option: C

COUNT will consider NULL values in the column while counting.

  1. True

  2. False


Correct Option: B

ROWNUM is the physical address of the row.

  1. True

  2. False


Correct Option: B

GRANT and REVOKE are part of

  1. DDL

  2. DML

  3. DCL

  4. None


Correct Option: C

What is the result of the query SELECT add_months('15-Jan-2011',-2) from DUAL ?

  1. 15-Dec-2010

  2. 15-Nov-2010

  3. 15-Mar-2011

  4. 15-Nov-2011


Correct Option: B

What is the result of the query SELECT FLOOR(-4.6)+CEIL(3.9) from DUAL ?

  1. -2

  2. 0

  3. 1

  4. -1


Correct Option: D

How many comparisons can be written in a CASE statement ?

  1. 127

  2. 255

  3. 63

  4. 511


Correct Option: B

Which is the Defualt Index ?

  1. BITMAP

  2. B-TREE

  3. FUNCTION BASED

  4. None


Correct Option: B
- Hide questions