JavaServer Pages Standard Tag Libraries QuizS2C Home « JavaServer Pages Standard Tag Libraries Quiz

The questions in this quiz on JavaServer Pages Standard Tag Libraries are on the topics covered in the JSTL section of the site. The table below lists the lessons, a description of the lesson content and the quiz question number range.

Lesson Summary

Click on a lesson in the table to go to that lesson for a refresher on the topics for that lesson.

JSTL Lessons Description Question Range
Lesson 1 - Introduction to JSTL 1.2In our first lesson on the JavaServer Pages Standard Tag Libraries we introduce and download JSTL for use.
Lesson 2 - Core Tag libraryIn our first lesson on JSTL libraries we look at the Core tag library.1 - 6
Lesson 3 - XML Tag libraryIn our second lesson on JSTL libraries we look at the XML tag library.7 - 11
Lesson 4 - II8n Tag libraryIn our third lesson on JSTL tag libraries we look at the II8n tag library.12 - 16
Lesson 5 - Database Tag libraryIn our fourth lesson on JSTL tag libraries we look at the Database tag library.17 - 22
Lesson 6 - Functions Tag libraryIn our final lesson on JSTL tag libraries we look at the Functions tag library.23 - 27
Lesson 7 - Creating Custom TagsIn this JSTL lesson we look at creating our own custom tags for when the functionality we need is not present in the JSTL tag libraries.28 - 32
Lesson 8 - EL FunctionsIn this JSTL lesson we look at EL Functions.33 - 37
Lesson 9 - Tag FilesIn our final lesson on JSTL we look at Tag Files.38 - 42

JavaServer Pages Standard Tag Libraries Quiz

The quiz below tests your knowledge of the material learnt in the JSTL section of the site.

Question 1 : How many Core tag library actions are there?
- The <code>Core</code> tag library consists of fourteen actions.
Question 2 : We can use the target and property attributes of the </c:set> action to assign a new property value to any object?
- The object defined by the <code>target</code> attribute must be either a JavaBean or a <code>java.util.Map</code> object.
Question 3 : The <c:remove> tag removes a scoped object?
- The <code>c:remove</code> tag removes the scoped variable that references the object so any other scoped variables that access the object can still do so.
Question 4 : What type of error object is thrown from the <c:catch> tag?
- A <code>java.lang.Throwable</code> object is thrown by the <code>c:catch</code> tag.
Question 5 : Which type of Java conditional statement is the <c:choose> tag similar to?
- The <code>c:choose</code> tag is similar to the <code>switch</code> Java conditional statement.
Question 6 : Which Core iterator tag allows us to iterate over the body content a set number of times?
- The <code>c:forEach</code> iterator tag allow us to iterate over the body content a set number of times.
Question 7 : How many XML tag library actions are there?
- The <code>XML</code> tag library consists of ten actions.
Question 8 : Which XML attribute allows us to specify XPath expressions?
- The <code>select</code> attribute allows us to specify <code>XPath</code> expressions.
Question 9 : The XPath expression language that is global to all JSTL actions?
- The <code>XPath</code> expression language is local to XML actions and not global to all JSTL actions.
Question 10 : An XPath variable must reference a java.lang.Object instance in any of the supported scopes?
- An <code>XPath</code> must reference a <code>java.lang.Object</code> instance in any of the supported scopes.
Question 11 : XPath expression bindings are mapped differently to their EL Implicit Objects counterparts?
- <code>XPath</code> expression bindings are mapped the same as their EL Implicit Objects counterparts.
Question 12 : What is the default value of the type attribute for the <fmt:formatNumber> and <fmt:parseNumber> actions?
- The default value of the <code>type</code> attribute for the <code>fmt:formatNumber</code> and <code>fmt:parseNumber</code> actions is <code>number</code>.
Question 13 : When using the <fmt:formatNumber> action the numeric value to be formatted can be specified using the value attribute or when omitted read from where?
- When using the <code>fmt:formatNumber</code> action the numeric value to be formatted can be specified using the value attribute or when omitted read from can be read from the tag's body content.
Question 14 : What is the default value of the type attribute for the <fmt:formatDate> and <fmt:parseDate> actions?
- The default value of the <code>type</code> attribute for the <code>fmt:formatDate</code> and <code>fmt:parseDate</code> actions is <code>date</code>.
Question 15 : When using the <fmt:formatDate> action if the scope attribute is specfied which other attribute must also be specified?
- When using the <code>fmt:formatDate</code> action if the <code>scope</code> attribute is specfied we must also specify the <code>var</code> attribute.
Question 16 : How many time zone Ii8n actions are there?
- There are <code>2</code> time zone Ii8n actions, these being <code>fmt:timeZone</code> and <code>fmt:setTimeZone</code>.
Question 17 : How many Database tag library actions are there?
- The <code>Database</code> tag library consists of six actions.
Question 18 : What happens if a data source is not of the String or javax.servlet.jsp.jstl.sql.dataSource types?
- If a data source is not of the <code>String</code> or <code>javax.servlet.jsp.jstl.sql.dataSource</code> types an exception is thrown.
Question 19 : What happens if a query using the <sql:query> action produces no results?
- If a query using the <code>sql:query</code> action produces no results, an empty <code>Result</code> object is returned.
Question 20 : Which Database action allows us to safeguard database integrity?
- The <code>sql:transaction</code> action allows us to safeguard database integrity by allowing us to nest several update statements into a transaction.
Question 21 : Which symbol is used for parameter substitution?
- The <code>?</code> symbol is used for parameter substitution.
Question 22 : Which action is used for date parameterisation?
- The <code>sql:dateParam</code> action is used for date parameterisation.
Question 23 : How many Function tag library actions are there?
- The <code>Function</code> tag library consists of sixteen actions.
Question 24 : All the Function tag actions only work on strings?
- The <code>fn:length</code> tag works on collections as well as strings.
Question 25 : What happens if the input to any of the Function tags is null?
- If the input to any of the <code>Function</code> tags is <code>null</code> tag the input is treated as an empty string.
Question 26 : When using the fn:substring function what happens if the beginIndex attribute is less than 0?
- When using the <code>fn:substring</code> function if the <code>beginIndex</code> attribute is less than 0, it is set to 0.
Question 27 : When using the fn:replace function what happens if the afterSubstring attribute is an empty string?
- When using the <code>fn:replace</code> function if the <code>afterSubstring</code> attribute is an empty string all occurrences of the <code>beforeSubstring</code> attribute are removed from the <code>inputString</code> attribute.
Question 28 : Which type serves as the base type for both classic and simple tags and is mainly used for organizational and type-safety purposes?
- The <code>JspTag</code> type serves as the base type for both classic and simple tags and is mainly used for organizational and type-safety purposes.
Question 29 : What is the last method called in the simple tag lifecycle?
- The last method called in the simple tag lifecycle is the <code>doTag()</code> method.
Question 30 : Where are custom tag handlers registered?
- Custom tag handlers are registered in the tag library descriptor.
Question 31 : When compiling a tag handler both the Servlet API and JSP API jars are required?
- When compiling a tag handler both the Servlet API and JSP API jars are required and so both must appear in the build path.
Question 32 : Which directive do we use that allows us to use custom tags within our JSP pages?
- The <code>taglib</code> directive allows us to use custom tags within our JSP pages.
Question 33 : We can use the same TLD file for custom tags and EL functions?
- We can use the same TLD file for custom tags and EL functions as long as each entity has a unique name.
Question 34 : EL functions use public instance methods?
- EL functions use public static methods.
Question 35 : We need to include the Servlet and JSP API JARs in our build path when compiling EL functions?
- We do not need to include the Servlet and JSP API JARs in our build path when compiling EL functions as we just use standard Java classes.
Question 36 : We can use methods from existing classes for EL functions?
- We can use methods from existing classes for EL functions as long as the methods have the <code>public static</code> access modifiers.
Question 37 : Which directive do we use that allows us to use EL functions within our JSP pages?
- The <code>taglib</code> directive allows us to use EL functions within our JSP pages.
Question 38 : With tag files you have to precompile tag handlers just like you do with custom tags?
- With tag files there is no need to precompile tag handlers as you have to with custom tags.
Question 39 : Which of these directives isn't used in tag files?
- The <code>page</code> directive is used in JSP pages, in tag files we use the <code>tag</code> directive instead.
Question 40 : Deployed tag files can be located by the container within WEB-INF/tags or a subdiretory there of, can we place tag files anywhere else?
- Deployed tag files can also be located by the container within the <code>META-INF/tags</code> directory inside a JAR file that's inside the <code>WEB-INF/lib</code> folder or inside a sub-directory of the <code>META-INF/tags</code> directory that's inside a JAR file that's inside the <code>WEB-INF/lib</code> folder.
Question 41 : When we want to use a tag file within our JSP pages what directive do we use to point to the location of the tag file?
- When we want to use a tag file within our JSP pages we use the <code>taglib</code> directive to point to the location of the tag file.
Question 42 : Can tag files include other sources?
- . Just like JSP pages tag files can also include other resources and these files have the <code>tagf</code> extension.
Quiz Progress Bar Please select an answer

What's Next?

That's the last of the JSP related quizzes, the next quiz is on the HTML 4.01 Basics section of the site.

go to home page Homepage go to top of page Top