0

programming languages Online Quiz - 243

Description: programming languages Online Quiz - 243
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0
  1. \doc-root\dd.xml

  2. \doc-root\web.xml

  3. \doc-root\WEB-INF\web.xml

  4. \doc-root\WEB_INF\dd.xml


Correct Option: C
Explanation:

To solve this question, the user needs to know the naming convention and location of the deployment descriptor for a web application.

The deployment descriptor is an XML file that contains information about the web application, such as the servlets, filters, and other components that make up the application. It is used by the web server or servlet container to configure the application at runtime.

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

A. \doc-root\dd.xml: This option is incorrect because the deployment descriptor must be located in the WEB-INF directory of the web application. Therefore, option A is not a valid location for the deployment descriptor.

B. \doc-root\web.xml: This option is incorrect because the deployment descriptor must be located in the WEB-INF directory of the web application. Therefore, option B is not a valid location for the deployment descriptor.

C. \doc-root\WEB-INF\web.xml: This option is correct. This is the correct location and naming convention for the deployment descriptor of a web application. The WEB-INF directory is a special directory that is not directly accessible from the web, so it is a secure location to store configuration files.

D. \doc-root\WEB_INF\dd.xml: This option is incorrect because the deployment descriptor must be named "web.xml" and it must be located in the WEB-INF directory of the web application. Therefore, option D is not a valid location or naming convention for the deployment descriptor.

The Answer is: C

  1. Checks for errors

  2. Schedules the job

  3. Manages the output processing of the job.

  4. All the above

  5. None of the above


Correct Option: D
  1. The order of elements in deployment descriptor is not important. The elements can follow any order.

  2. The elements of deployment descriptor are case insensitive.

  3. The servlet-mapping element, if defined, must be included within the servlet element.

  4. The web-app element must include the servlet element.


Correct Option: A
  1. mypackage.MyException /error.jsp

  2. mypackage.MyException /error.jsp

  3. mypackage.MyException /error.jsp

  4. mypackage.MyException


Correct Option: B

Which element of the deployment descriptor of a web application includes the welcome-file-list element as a subelement. Select the one correct answer.

  1. web-app

  2. welcome-file

  3. servlet

  4. file-list


Correct Option: A

Which of these are the correct fragment within the web-app element of deployment descriptor. Select the two correct answer.

  1. 404 /error.jsp

  2. mypackage.MyException 404 /error.jsp

  3. mypackage.MyException 404

  4. mypackage.MyException /error.jsp


Correct Option: A,D
  1. 3

  2. Anywhere between 5 to 17

  3. Anywhere between 4 to 16

  4. Anywhere between 1 to 17

  5. No constraints


Correct Option: C

With in a context-param element of deployment descriptor, which of the following element is required?

  1. param-name

  2. name

  3. init-param

  4. servlet-name


Correct Option: A

If the condition in the COND parameter satisfies what will happen?

  1. Step will not execute

  2. Step will abend

  3. Step will execute

  4. S0C7


Correct Option: A

What gets printed when the following expression is evaluated? Select the one correct answer. ${(1==2) ? 4 : 5}

  1. 1

  2. 2

  3. 4

  4. 5


Correct Option: D
Explanation:

To solve this question, the user needs to understand the concept of a ternary operator and the logical comparison operator.

The expression (1==2) will evaluate to false since 1 is not equal to 2.

The ternary operator ? : has the syntax condition ? value_if_true : value_if_false.

Therefore, the expression will evaluate to 5 since false is equivalent to 0, and the value if false is 5.

So, the answer is:

The Answer is: D. 5

What gets printed when the following expression is evaluated? Select the one correct answer. ${4 div 5}

  1. 0

  2. 0.8

  3. 1

  4. -1


Correct Option: B

AI Explanation

To answer this question, you need to understand the concept of integer division.

In Python, the division operator (/) returns a floating-point number (decimal number) as the result. However, the integer division operator (//) returns the quotient as an integer.

In the given expression, ${4 div 5}, the div keyword is not a valid operator in Python. Instead, we should use the // operator for integer division.

Let's evaluate the expression using the correct operator:

${4 // 5}

The result of this expression is 0.8. However, since we are using integer division, the decimal part is truncated, and only the integer part is returned.

Therefore, the correct answer is B) 0.8.

What gets printed when the following expression is evaluated? Select the one correct answer. ${12 % 4}

  1. 0

  2. 3

  3. 8

  4. 16


Correct Option: A
Explanation:

To solve this question, the user needs to know the concept of the modulus operator (%) and basic arithmetic.

Explanation:

The modulus operator (%) returns the remainder when the left operand is divided by the right operand.

When the expression ${12 % 4} is evaluated, it is equivalent to the expression 12 divided by 4, with the remainder returned as the result. Since 12 is evenly divisible by 4, the remainder is 0.

Thus, the correct answer is:

The Answer is: A) 0

What is program used to compile the COBOL program?

  1. IGYWCL

  2. IEWL

  3. IEBCOMPILE

  4. IGYCRCTL


Correct Option: D

What is the effect of executing the following JSP statement, assuming a class with name Employee exists in classes package.

  1. The code does not compile as there is no property attribute of setProperty tag.

  2. The code does not compile as property attribute cannot take * as a value.

  3. The code sets value of all properties of employee bean to "*".

  4. The code sets the values of all properties of employee bean to matrching parameters in request object.


Correct Option: D
- Hide questions