This chapter is not something that you need to memorize but, from the exam point of view, this is a pretty important chapter. We will be covering some tips and tricks that can help you prepare better for the exam and get certified successfully.
Another good news is, we have already covered all you need to know to pass the SCWCD Exam. This is going to be the last chapter in this series (Of course, there are some sample exam questions that you can use to test your understanding of the topics).
So, lets get started!!!
Study Tips
• Don't just blindly memorize the stuff related to the exam
• Read them slowly and try to understand how every item works and what the purpose of each entity is
• Writing Code and Running them in your local computer is the best way to understand many of the concepts
• There is a lot of example code. Try deploying them onto your computer and test out the results. This would do wonders when compared to just monotonously reading articles.
• Finally, Study only when you are alert, reduce or avoid distractions as much as possible and take breaks when you become fatigued
Pre-Testing Yourself
Every Section in this series has some sample questions. Test your knowledge of the topics by answering them. Don't lose heart if you are unable to answer them all right. Nobody is perfect. Just re-visit the chapters, read them again and re-take the test.
• Most importantly, there are going to be 3 sets of Mock Exam Questions after this chapter. Time your Mock Exam and evaluate yourself. Note down your scores. Your scores in the mock exam will give you a fair idea of how well prepared you are for the exam and it will also help you identify pain-points that you may have to review/re-study to master.
During the Exam Session
Following are some general tips that are applicable to anyone who is taking any exam and it applies to us for the SCWCD Exam too.
• Take a deep breath and try to relax when you first sit down for your exam session. It is important to control the pressure you might (naturally) feel when taking exams.
• You will be provided with scratch paper. Take a moment to write down any factual information and technical detail that you committed to short-term memory.
• Carefully read all information and instruction screens. These displays have been put together to give you information that is relevant to the exam you are taking.
• Read the exam questions carefully. Reread each question to identify all relevant details. Do not rush.
• Tackle the questions in the order they are presented. Skipping around will not build your confidence and most importantly it wastes time
• If you are unable to answer a question after 60 seconds, just move on to the next one. Don't waste too much time on any particular question.
• If session time remains after you have completed all questions, review your answers. Pay particular attention to questions that seem to have a lot of detail or that involve code analysis.
• As for changing your answers, the general rule of thumb here is don't change them. In most cases, a perfectly right answer might seem incorrect in the last few minutes when you review the answer. Avoid such impulsive changes. However, if an answer seems a definite incorrect answer, don't hesitate, just go ahead and choose the one you feel is right.
Last but not the least, All the very best and do well.
And – do come back and leave a comment on my blog once you clear the exam and get certified!!!
Previous Chapter: Self Test - Chapters 51 to 58
Next Chapter: SCWCD Mock Exam 1
Topics Covered in the Blog - Synopsis
Showing posts with label scwcd exam. Show all posts
Showing posts with label scwcd exam. Show all posts
Friday, April 29, 2011
Chapter 59: Study and Exam Preparation Tips
Labels:
exam prep tips,
scwcd exam,
scwcd exam questions,
tips,
tips and tricks
| Reactions: |
Self Test: Chapters 51 to 58
Questions
Question 1
Which design pattern has as its primary responsibility to decouple presentation and service tiers, and a central director?
A. Value Object
B. Composite View
C. Business Delegate
D. Model-View-Controller
Question 2
Which design pattern has as its primary responsibility to exchange data between tiers?
A. Value Object
B. Composite View
C. Business Delegate
D. Model-View-Controller
Question 3
Which design pattern has as its primary responsibility to abstract data sources and provide transparent access to the data in these sources?
A. Value Object
B. Data Access Object
C. Business Delegate
D. Model-View-Controller
E. None of the above
Question 4
Which design pattern has as its primary responsibility to isolate the presentation and the business tiers from each other by adding a director between the two, making it is easier to manage changes on either side?
A. Session Facade
B. Data Access Object
C. Business Delegate
D. Model-View-Controller
E. Aggregate Entity
Question 5
Which one of the following is most likely used for cache?
A. Value Object
B. Data Access Object
C. Business Delegate
D. Cache Object
E. Aggregate Entity
Question 6
Which design pattern acts as a switchboard, dispatching incoming requests to the correct resource?
A. Value Object
B. Data Access Object
C. Business Delegate
D. Front Controller
Question 7
Which design pattern is most likely to care about RDBMS, OODBMS, and flat files?
A. Value Object
B. Data Access Object
C. Business Delegate
D. Cache Object
E. Aggregate Entity
Question 8
Which design pattern does the following force most affect?
Persistent storage APIs vary between vendors, which causes a lack of uniform APIs to address the requirements for accessing storages.
A. Value Object
B. Data Access Object
C. Business Delegate
D. Cache Object
E. Aggregate Entity
Question 9
Which design pattern has as its primary role to provide control and protection for the business service?
A. Value Object
B. Data Access Object
C. Business Delegate
D. Cache Object
E. Aggregate Entity
Question 10
Which design pattern is most likely to be used as a proxy?
A. Business Delegate
B. Data Access Object
C. Model-View-Controller
D. Value Object
Question 11
Which design pattern reduces the number of remote network method calls required to obtain the attribute values from the entity beans?
A. Business Delegate
B. Data Access Object
C. Model-View-Controller
D. Value Object
Question 12
Which design pattern that usually is a good candidate to work with entity beans becomes less useful when a cache is used to persist data?
A. Business Delegate
B. Data Access Object
C. Model-View-Controller
D. Value Object
Answers
Question 1
D. The Model-View-Controller pattern has as its primary responsibility to decouple presentation and data/business logic tiers, by using a director or switchboard between them.
Question 2
A. The Value Object pattern has as its primary responsibility to exchange data between tiers. Although the Business Delegate and Model-View-Controller also do this, it isn't their primary responsibility.
Question 3
B. The Data Access Object pattern has as its primary responsibility to abstract data sources and provide transparent access to the data in these sources. The Business Delegate and Model-View-Controller may do so, but the Data Access Object always does this.
Question 4
D. The Model-View-Controller pattern has as its primary responsibility to minimize the impact of changing the client or business tier. Remember that this is a very high-level pattern, so it often uses other patterns.
Question 5
A. The Value Object pattern is most likely used for cache. Notice that its whole purpose is to collect data from somewhere far and bring it close in a neat package. The Data Access Object and Business Delegate often actually use a Value Object underneath. The Cache Object is fiction and the Aggregate Entity is not one of the four that you might see on the exam.
Question 6
D. The front controller pattern acts as a switch board, dispatching incoming requests to the correct resource.
Question 7
B. The Data Access Object design pattern is one that deals with RDBMS, OODBMS, excel, flat files, and more. This is pattern you use to isolate the access API from the actual data repository implementation. Value Object and Business Delegate don't do this. The other two patterns mentioned are distracters.
Question 8
B. The Data Access Object design pattern is affected most by varying persistent storage APIs due to different vendors and non-uniform APIs to address the requirements to access storages. Whenever you see the word persistent, think Data Access Object design pattern.
Question 9
C. The Business Delegate design pattern has as its primary role to provide control and protection for the business service. Although you can't just ignore the rest of the Question, normally when a Question focuses on the business service, think Business Delegate design pattern.
Question 10
A. The Business Delegate design pattern is most likely to be used as a proxy. Its whole purpose is being the mediator between a business service and the rest of the world, especially, but not limited to, clients. This is what proxies do, too.
Question 11
D. The Value Object design pattern reduces the number of remote network method calls required to obtain the attribute values from the entity beans. Although the four patterns in the answers do this, it's the main reason for using a Value Object.
Question 12
B. The Data Access Object design pattern is usually a good candidate to work with data that is remote or and costly to query often, but becomes a bad choice with container-managed persistence. This is tricky because the container often, but not always, will persist data as a primary function.
Previous Chapter: Quick Recap - Chapters 51 to 58
Next Chapter: Chapter 59 - Exam Preparation Tips
Question 1
Which design pattern has as its primary responsibility to decouple presentation and service tiers, and a central director?
A. Value Object
B. Composite View
C. Business Delegate
D. Model-View-Controller
Question 2
Which design pattern has as its primary responsibility to exchange data between tiers?
A. Value Object
B. Composite View
C. Business Delegate
D. Model-View-Controller
Question 3
Which design pattern has as its primary responsibility to abstract data sources and provide transparent access to the data in these sources?
A. Value Object
B. Data Access Object
C. Business Delegate
D. Model-View-Controller
E. None of the above
Question 4
Which design pattern has as its primary responsibility to isolate the presentation and the business tiers from each other by adding a director between the two, making it is easier to manage changes on either side?
A. Session Facade
B. Data Access Object
C. Business Delegate
D. Model-View-Controller
E. Aggregate Entity
Question 5
Which one of the following is most likely used for cache?
A. Value Object
B. Data Access Object
C. Business Delegate
D. Cache Object
E. Aggregate Entity
Question 6
Which design pattern acts as a switchboard, dispatching incoming requests to the correct resource?
A. Value Object
B. Data Access Object
C. Business Delegate
D. Front Controller
Question 7
Which design pattern is most likely to care about RDBMS, OODBMS, and flat files?
A. Value Object
B. Data Access Object
C. Business Delegate
D. Cache Object
E. Aggregate Entity
Question 8
Which design pattern does the following force most affect?
Persistent storage APIs vary between vendors, which causes a lack of uniform APIs to address the requirements for accessing storages.
A. Value Object
B. Data Access Object
C. Business Delegate
D. Cache Object
E. Aggregate Entity
Question 9
Which design pattern has as its primary role to provide control and protection for the business service?
A. Value Object
B. Data Access Object
C. Business Delegate
D. Cache Object
E. Aggregate Entity
Question 10
Which design pattern is most likely to be used as a proxy?
A. Business Delegate
B. Data Access Object
C. Model-View-Controller
D. Value Object
Question 11
Which design pattern reduces the number of remote network method calls required to obtain the attribute values from the entity beans?
A. Business Delegate
B. Data Access Object
C. Model-View-Controller
D. Value Object
Question 12
Which design pattern that usually is a good candidate to work with entity beans becomes less useful when a cache is used to persist data?
A. Business Delegate
B. Data Access Object
C. Model-View-Controller
D. Value Object
Answers
Question 1
D. The Model-View-Controller pattern has as its primary responsibility to decouple presentation and data/business logic tiers, by using a director or switchboard between them.
Question 2
A. The Value Object pattern has as its primary responsibility to exchange data between tiers. Although the Business Delegate and Model-View-Controller also do this, it isn't their primary responsibility.
Question 3
B. The Data Access Object pattern has as its primary responsibility to abstract data sources and provide transparent access to the data in these sources. The Business Delegate and Model-View-Controller may do so, but the Data Access Object always does this.
Question 4
D. The Model-View-Controller pattern has as its primary responsibility to minimize the impact of changing the client or business tier. Remember that this is a very high-level pattern, so it often uses other patterns.
Question 5
A. The Value Object pattern is most likely used for cache. Notice that its whole purpose is to collect data from somewhere far and bring it close in a neat package. The Data Access Object and Business Delegate often actually use a Value Object underneath. The Cache Object is fiction and the Aggregate Entity is not one of the four that you might see on the exam.
Question 6
D. The front controller pattern acts as a switch board, dispatching incoming requests to the correct resource.
Question 7
B. The Data Access Object design pattern is one that deals with RDBMS, OODBMS, excel, flat files, and more. This is pattern you use to isolate the access API from the actual data repository implementation. Value Object and Business Delegate don't do this. The other two patterns mentioned are distracters.
Question 8
B. The Data Access Object design pattern is affected most by varying persistent storage APIs due to different vendors and non-uniform APIs to address the requirements to access storages. Whenever you see the word persistent, think Data Access Object design pattern.
Question 9
C. The Business Delegate design pattern has as its primary role to provide control and protection for the business service. Although you can't just ignore the rest of the Question, normally when a Question focuses on the business service, think Business Delegate design pattern.
Question 10
A. The Business Delegate design pattern is most likely to be used as a proxy. Its whole purpose is being the mediator between a business service and the rest of the world, especially, but not limited to, clients. This is what proxies do, too.
Question 11
D. The Value Object design pattern reduces the number of remote network method calls required to obtain the attribute values from the entity beans. Although the four patterns in the answers do this, it's the main reason for using a Value Object.
Question 12
B. The Data Access Object design pattern is usually a good candidate to work with data that is remote or and costly to query often, but becomes a bad choice with container-managed persistence. This is tricky because the container often, but not always, will persist data as a primary function.
Previous Chapter: Quick Recap - Chapters 51 to 58
Next Chapter: Chapter 59 - Exam Preparation Tips
Self Test: Chapters 47 to 50
Questions:
Question 1:
Which two statements apply to the following code snippet? (Choose two.)
< servlet >
< servlet-name >
testServlet
< /servlet-name >
< servlet-class >
myPackage.MyTestServlet
< /servlet-class >
< /servlet >
A. It is a mapping between a servlet name and the fully-qualified name of the servlet class.
B. It is a map between a URL and a servlet.
C. This code belongs in the WebApp deployment descriptor.
D. It tells the container where to install the servlet.
Question 2:
Which two of the following statements most closely relate to HTTPS Client Authentication?
A. It uses a Status-Code element (three-digit integer).
B. It uses predefined form fields.
C. It is the most secure form of authentication.
D. It uses SSL.
Question 3:
Which directory is the location for myApp.jar?
A. /WEB-INF/
B. /WEB-INF/classes/
C. /WEB-INF/lib/D. /
Question 4:
In which two elements can you define initialization parameters?
A. servlet
B. context-param
C. welcome-file
D. login-config
Question 5:
Which three of the following are elements of the Web Application Descriptor?
A. servlet
B. context-param
C. listener
D. error
Question 6:
What is the configuration that the deployment descriptor uses to handle each exception?
A. error-page
B. exception
C. error
D. exception-page
Question 7:
What is the deployment descriptor file named?
A. server.conf
B. server.xml
C. web.xml
D. web.conf
Question 8:
Which directory is the location for Web application class files?
A. /WEB-INF/
B. /WEB-INF/classes/
C. /WEB-INF/classpath/
D. /META-INF/classes
Question 9:
What does the security-role element do?
A. It configures the authentication method that should be used by the form login mechanism.
B. It defines the status codes for security breaches.
C. It contains a mapping between an error code or exception type to the path of a resource in the Web application.
D. It describes and names the security role.
Question 10:
Which directory is the location for the deployment descriptor?
A. /WEB-INF/
B. /WEB-INF/classes/
C. /WEB-INF/lib/D. /
Question 11:
Which of the following best defines authentication?
A. The means used to prove that information has not been modified by a third party while in transit.
B. This is access control where interactions with resources are limited to collections of users or programs for the purpose of enforcing integrity, confidentiality, or availability constraints.
C. You have permission to use a given page.
D. The means by which communicating entities prove to one another that they are acting on behalf of specific identities.
Question 12:
What is the best definition for auditing?
A. This is access control where it defines who can interact with what resources.
B. Maintaining a record of Web application activity.
C. This is a check of the Web application when it is used for commercial transactions.
D. This prevents Web site attacks.
Answers:
Question 1:
A and C. The servlet element establishes a mapping between a servlet name and the fully-qualified name of the servlet class. You would place this code in the WebApp deployment descriptor.
Question 2:
C and D. This is end user authentication using HTTPS (HTTP over SSL). This mechanism uses public key encryption that requires the user to possess a Public Key Certificate (PKC). This is the highest level security of the four here.
Question 3:
C. The jar files go in the /WEB-INF/lib/ directory.
Question 4:
A and B. The initialization parameters are defined in both the context-param and the servlet elements of the Web deployment descriptor.
Question 5:
A, B, and C. All of these are elements except there is no error element. It should have been error-page.
Question 6:
A. The error-page element, which defines what resource the container should use for a given exception.
< web-app >
< error-page >
< error-code >404< / error-code >
< location > /404.html < /location >
< /error-page >
< /web-app >
Question 7:
C. web.xml is the deployment descriptor file.
Question 8:
B. You place your servlets and utility classes in /WEB-INF/classes/.
Question 9:
D. The security-role element contains the definition of a security role. The definition consists of an optional description of the security role, and the security role name.
Question 10:
A. web.xml is the deployment descriptor file in /WEB-INF/web.xml.
Question 11:
D. Authentication is the means by which communicating entities prove to one another that they are acting on behalf of specific identities. In other words, it is the attempt to prove that you are really you.
Question 12:
B. Maintain a record of Web application activity. For example, you can log resource accesses including times and requester IP and ID. This usually involves a log somewhere.
Previous Chapter: Quick Recap - Chapters 47 to 50
Next Chapter: Chapter 51 - Introduction to Design Patterns
Question 1:
Which two statements apply to the following code snippet? (Choose two.)
< servlet >
< servlet-name >
testServlet
< /servlet-name >
< servlet-class >
myPackage.MyTestServlet
< /servlet-class >
< /servlet >
A. It is a mapping between a servlet name and the fully-qualified name of the servlet class.
B. It is a map between a URL and a servlet.
C. This code belongs in the WebApp deployment descriptor.
D. It tells the container where to install the servlet.
Question 2:
Which two of the following statements most closely relate to HTTPS Client Authentication?
A. It uses a Status-Code element (three-digit integer).
B. It uses predefined form fields.
C. It is the most secure form of authentication.
D. It uses SSL.
Question 3:
Which directory is the location for myApp.jar?
A. /WEB-INF/
B. /WEB-INF/classes/
C. /WEB-INF/lib/D. /
Question 4:
In which two elements can you define initialization parameters?
A. servlet
B. context-param
C. welcome-file
D. login-config
Question 5:
Which three of the following are elements of the Web Application Descriptor?
A. servlet
B. context-param
C. listener
D. error
Question 6:
What is the configuration that the deployment descriptor uses to handle each exception?
A. error-page
B. exception
C. error
D. exception-page
Question 7:
What is the deployment descriptor file named?
A. server.conf
B. server.xml
C. web.xml
D. web.conf
Question 8:
Which directory is the location for Web application class files?
A. /WEB-INF/
B. /WEB-INF/classes/
C. /WEB-INF/classpath/
D. /META-INF/classes
Question 9:
What does the security-role element do?
A. It configures the authentication method that should be used by the form login mechanism.
B. It defines the status codes for security breaches.
C. It contains a mapping between an error code or exception type to the path of a resource in the Web application.
D. It describes and names the security role.
Question 10:
Which directory is the location for the deployment descriptor?
A. /WEB-INF/
B. /WEB-INF/classes/
C. /WEB-INF/lib/D. /
Question 11:
Which of the following best defines authentication?
A. The means used to prove that information has not been modified by a third party while in transit.
B. This is access control where interactions with resources are limited to collections of users or programs for the purpose of enforcing integrity, confidentiality, or availability constraints.
C. You have permission to use a given page.
D. The means by which communicating entities prove to one another that they are acting on behalf of specific identities.
Question 12:
What is the best definition for auditing?
A. This is access control where it defines who can interact with what resources.
B. Maintaining a record of Web application activity.
C. This is a check of the Web application when it is used for commercial transactions.
D. This prevents Web site attacks.
Answers:
Question 1:
A and C. The servlet element establishes a mapping between a servlet name and the fully-qualified name of the servlet class. You would place this code in the WebApp deployment descriptor.
Question 2:
C and D. This is end user authentication using HTTPS (HTTP over SSL). This mechanism uses public key encryption that requires the user to possess a Public Key Certificate (PKC). This is the highest level security of the four here.
Question 3:
C. The jar files go in the /WEB-INF/lib/ directory.
Question 4:
A and B. The initialization parameters are defined in both the context-param and the servlet elements of the Web deployment descriptor.
Question 5:
A, B, and C. All of these are elements except there is no error element. It should have been error-page.
Question 6:
A. The error-page element, which defines what resource the container should use for a given exception.
< web-app >
< error-page >
< error-code >404< / error-code >
< location > /404.html < /location >
< /error-page >
< /web-app >
Question 7:
C. web.xml is the deployment descriptor file.
Question 8:
B. You place your servlets and utility classes in /WEB-INF/classes/.
Question 9:
D. The security-role element contains the definition of a security role. The definition consists of an optional description of the security role, and the security role name.
Question 10:
A. web.xml is the deployment descriptor file in /WEB-INF/web.xml.
Question 11:
D. Authentication is the means by which communicating entities prove to one another that they are acting on behalf of specific identities. In other words, it is the attempt to prove that you are really you.
Question 12:
B. Maintain a record of Web application activity. For example, you can log resource accesses including times and requester IP and ID. This usually involves a log somewhere.
Previous Chapter: Quick Recap - Chapters 47 to 50
Next Chapter: Chapter 51 - Introduction to Design Patterns
Labels:
getting scwcd certified,
scwcd certification,
scwcd exam,
scwcd exam questions,
self assement,
self assement scwcd,
self test,
self test scwcd
| Reactions: |
Thursday, April 28, 2011
Self Test: Chapters 44 & 45
Questions
Question 1:
Which three of the following is part of the Tag Library Descriptor element?
A. namespace
B. name
C. tag handler class
D. tag attributes
Question 2:
Which two of the following attributes are not part of the taglib directive?
A. url
B. uri
C. prefix
D. name
Question 3:
Which file does the following DTD element definition apply to: ?
A. web.init
B. YourTagHandler.java
C. YourTagLibraryDefinition.tld
D. web.xml
Question 4:
Which of the following is the Web Deployment Descriptor, the purpose of which is to configure a Web application?
A. web.xml
B. web.init
C. YourTagLibraryDefinition.tld
D. YourTagHandler.java
Question 5:
Which three of the following files is part of a simple tag library?
A. web.xml
B. web.init
C. YourTagLibraryDefinition.tld
D. YourTagHandler.java
Question 6:
How do you declare a tag library within a JSP page?
A. You use a declare scriptlet.
B. You use a taglib directive.
C. You use a unique variable.
D. You use the path to the tag handler.
Question 7:
Which two of the following options apply to an empty custom tag?
A. Specified in the web.xml Web component descriptor.
B. Specified in the tag library handler.
C. < libraryPrefix : handlerName / >
D. A custom tag with no body.
Question 8:
What does the container use to validate a custom tag in a JSP page?
A. web.xml
B. Xerces
C. Xmlspy
D. Tag Library Descriptor
Question 9:
Which interface does the doStartTag() belong to?
A. TagSupport
B. TagProcess
C. Tag
D. TagStart
Question 10:
What does the container do during translation when it encounters a custom tag in a JSP page?
A. It converts the XML notation into Java calls, inserted into the Java that resulted from the page translation.
B. It passes it to the tag handler.
C. It converts it to scriptlets.
D. It adds the code to the output stream.
Answers:
Question 1:
B, C, and D. All of these are part of the Tag Library Descriptor element except option A. Also, you need a JSP file such as yourJSP.jsp.
Question 2:
A and D. The taglib directive only takes two attributes, uri and prefix.
Question 3:
D. The taglib element is used to describe a JSP tag library. The syntax for the taglib element in the web.xml file is < ! ELEMENT taglib (taglib-uri, taglib-location) >. The required taglib-location element contains the location and the taglib-uri element describes a URI identifying a Tag Library used in the Web application. You use the URI to give a tag library a unique address or namespace.
Question 4:
A. The web.xml file is used as the deployment descriptor. The deployment descriptor defines the elements and configuration information of a Web application. In it you define elements to support the Web application within a servlet container, including ServletContext init parameters, session configuration, and servlet declarations..”
Note: We will be covering Deployment & Deployment Descriptions shortly. So for now, just know this about the web.xml file.
Question 5:
A, C, and D. All of these files could be used as part of your tag library except option B because web.init is not a file defined by the specification. Also, you need a JSP file such as yourJSP.jsp.
Question 6:
B. The taglib directive creates a reference to the prefix. The prefix tells the container which library you want. Once that is done, you can use a custom tag, so called because it is your tag, not a standard one that came shipped with the container.
Question 7:
C and D. C uses correct XML notation to refer to an empty tag. By convention, we call a custom tag in a JSP page without a body an empty custom tag.
Question 8:
D. The Tag Library Descriptor (TLD) is used by a Web container to validate the tags in a JSP page.
Question 9:
A. Your tag handler is a class that extends the TagSupport abstract class if it has doStartTag() and doEndTag() methods.
Question 10:
A. The container will combine the JSP code and tag library into one Java source file. The container converts your custom tags into Java calls during the JSP page translation.
Previous Chapter: Quick Recap - Chapters 44 & 45
Next chapter: chapter 46 - JSP API
Question 1:
Which three of the following is part of the Tag Library Descriptor element?
A. namespace
B. name
C. tag handler class
D. tag attributes
Question 2:
Which two of the following attributes are not part of the taglib directive?
A. url
B. uri
C. prefix
D. name
Question 3:
Which file does the following DTD element definition apply to: ?
A. web.init
B. YourTagHandler.java
C. YourTagLibraryDefinition.tld
D. web.xml
Question 4:
Which of the following is the Web Deployment Descriptor, the purpose of which is to configure a Web application?
A. web.xml
B. web.init
C. YourTagLibraryDefinition.tld
D. YourTagHandler.java
Question 5:
Which three of the following files is part of a simple tag library?
A. web.xml
B. web.init
C. YourTagLibraryDefinition.tld
D. YourTagHandler.java
Question 6:
How do you declare a tag library within a JSP page?
A. You use a declare scriptlet.
B. You use a taglib directive.
C. You use a unique variable.
D. You use the path to the tag handler.
Question 7:
Which two of the following options apply to an empty custom tag?
A. Specified in the web.xml Web component descriptor.
B. Specified in the tag library handler.
C. < libraryPrefix : handlerName / >
D. A custom tag with no body.
Question 8:
What does the container use to validate a custom tag in a JSP page?
A. web.xml
B. Xerces
C. Xmlspy
D. Tag Library Descriptor
Question 9:
Which interface does the doStartTag() belong to?
A. TagSupport
B. TagProcess
C. Tag
D. TagStart
Question 10:
What does the container do during translation when it encounters a custom tag in a JSP page?
A. It converts the XML notation into Java calls, inserted into the Java that resulted from the page translation.
B. It passes it to the tag handler.
C. It converts it to scriptlets.
D. It adds the code to the output stream.
Answers:
Question 1:
B, C, and D. All of these are part of the Tag Library Descriptor element except option A. Also, you need a JSP file such as yourJSP.jsp.
Question 2:
A and D. The taglib directive only takes two attributes, uri and prefix.
Question 3:
D. The taglib element is used to describe a JSP tag library. The syntax for the taglib element in the web.xml file is < ! ELEMENT taglib (taglib-uri, taglib-location) >. The required taglib-location element contains the location and the taglib-uri element describes a URI identifying a Tag Library used in the Web application. You use the URI to give a tag library a unique address or namespace.
Question 4:
A. The web.xml file is used as the deployment descriptor. The deployment descriptor defines the elements and configuration information of a Web application. In it you define elements to support the Web application within a servlet container, including ServletContext init parameters, session configuration, and servlet declarations..”
Note: We will be covering Deployment & Deployment Descriptions shortly. So for now, just know this about the web.xml file.
Question 5:
A, C, and D. All of these files could be used as part of your tag library except option B because web.init is not a file defined by the specification. Also, you need a JSP file such as yourJSP.jsp.
Question 6:
B. The taglib directive creates a reference to the prefix. The prefix tells the container which library you want. Once that is done, you can use a custom tag, so called because it is your tag, not a standard one that came shipped with the container.
Question 7:
C and D. C uses correct XML notation to refer to an empty tag. By convention, we call a custom tag in a JSP page without a body an empty custom tag.
Question 8:
D. The Tag Library Descriptor (TLD) is used by a Web container to validate the tags in a JSP page.
Question 9:
A. Your tag handler is a class that extends the TagSupport abstract class if it has doStartTag() and doEndTag() methods.
Question 10:
A. The container will combine the JSP code and tag library into one Java source file. The container converts your custom tags into Java calls during the JSP page translation.
Previous Chapter: Quick Recap - Chapters 44 & 45
Next chapter: chapter 46 - JSP API
Labels:
jsp tag library,
sample questions scwcd,
scwcd exam,
scwcd exam questions,
self test,
self test scwcd,
taglibs
| Reactions: |
Thursday, April 14, 2011
Self Test: Chapters 38 to 43
Let us test out our knowledge of JavaBeans that we learnt in the past chapters.
Questions:
Question 1:
Which one of the following interfaces is implemented when declaring a JavaBean?
A. JavaBean
B. ServiceBean
C. HttpJavaBean
D. ServletBean
E. None of the above.
Question 2:
Which one of the following objects is passed to a JavaBean when one of its properties is set via a JSP action?
A. ServletRequest
B. HttpServletRequest
C. ServletResponse
D. HttpServletResponse
E. None of the above.
Question 3:
By default, how many instances of a JavaBean will be created by a servlet container when there are five useBean elements with the same ID on the same JSP page?
A. One
B. Five
C. One per session
D. None of the above
Question 4:
Which of the following cannot be used as the scope when using a JavaBean with JSP?
A. response
B. request
C. session
D. application
E. page
Question 5:
Which of the following are used by servlet containers to set JavaBean properties?
A. cookies
B. form fields
C. memory
D. disk
Question 6:
Which of the following scopes best fits with this description: “An object inside this scope is accessible from all pages processing the request during which the object was created?”
A. page
B. session
C. application
D. request
Question 7:
Is it impossible to share a page scope variable with another JSP or servlet?
A. Yes
B. No
C. Sometimes
D. Configurable
Question 8:
Given a form field named lastName, what is the get method for the associatedJavaBean property?
public String getFirstName ()
{
return firstName;
}
public String getFirstName (boolean returnValue)
{
if (returnValue)
return firstName;
}
public String getFirstname ()
{
return Firstname;
}
public String get("FirstName")
{
return FirstName;
}
Answers:
Answer 1:
E. None of the interfaces mentioned in the answers is implemented when declaring a JavaBean. It isn't an interface that makes a class a JavaBean; it's the way it is used with a public class, public constructor without arguments, and the get/set paradigm. Notice that neither “none of the above” nor “all of the above” answers are allowed on the actual exam.
Answer 2:
E. None of the objects mentioned in the answers is passed to a JavaBean when a property is changed from JSP. Rather, it is simply a method call transferred from the JSP page to the Bean with either the setProperty element or with a direct call within a scriptlet
Answer 3:
D. There will only be one instance of a JavaBean with the same ID created by a servlet container, even when there are five useBean actions on the same JSP page. If you have more than one useBean action with the same ID, you will get a CompileException for the duplicate bean name. See “Creating JavaBeans,” earlier in this chapter.
Answer 4:
A. The response object cannot be used as the scope when using a JavaBean with JSP.
Answer 5:
B. The JavaBean attributes are set when the container captures the form field name-value pairs, and then calls the setter methods in the bean for the attributes which have the same name as the form fields.
Answer 6:
D. The request scope best fits the description given by the question.
Answer 7:
A. This is true that it is impossible to share a page scoped variable with another JSP or Servlet.
Answer 8:
B. When you write a get method for a JavaBean property, use set or get followed by the first letter of the property name capitalized.
Previous Chapter: Quick Recap - Chapters 38 to 43
Next Chapter: Chapter 44 - JSP Tag Libraries
Questions:
Question 1:
Which one of the following interfaces is implemented when declaring a JavaBean?
A. JavaBean
B. ServiceBean
C. HttpJavaBean
D. ServletBean
E. None of the above.
Question 2:
Which one of the following objects is passed to a JavaBean when one of its properties is set via a JSP action?
A. ServletRequest
B. HttpServletRequest
C. ServletResponse
D. HttpServletResponse
E. None of the above.
Question 3:
By default, how many instances of a JavaBean will be created by a servlet container when there are five useBean elements with the same ID on the same JSP page?
A. One
B. Five
C. One per session
D. None of the above
Question 4:
Which of the following cannot be used as the scope when using a JavaBean with JSP?
A. response
B. request
C. session
D. application
E. page
Question 5:
Which of the following are used by servlet containers to set JavaBean properties?
A. cookies
B. form fields
C. memory
D. disk
Question 6:
Which of the following scopes best fits with this description: “An object inside this scope is accessible from all pages processing the request during which the object was created?”
A. page
B. session
C. application
D. request
Question 7:
Is it impossible to share a page scope variable with another JSP or servlet?
A. Yes
B. No
C. Sometimes
D. Configurable
Question 8:
Given a form field named lastName, what is the get method for the associatedJavaBean property?
public String getFirstName ()
{
return firstName;
}
public String getFirstName (boolean returnValue)
{
if (returnValue)
return firstName;
}
public String getFirstname ()
{
return Firstname;
}
public String get("FirstName")
{
return FirstName;
}
Answers:
Answer 1:
E. None of the interfaces mentioned in the answers is implemented when declaring a JavaBean. It isn't an interface that makes a class a JavaBean; it's the way it is used with a public class, public constructor without arguments, and the get/set paradigm. Notice that neither “none of the above” nor “all of the above” answers are allowed on the actual exam.
Answer 2:
E. None of the objects mentioned in the answers is passed to a JavaBean when a property is changed from JSP. Rather, it is simply a method call transferred from the JSP page to the Bean with either the setProperty element or with a direct call within a scriptlet
Answer 3:
D. There will only be one instance of a JavaBean with the same ID created by a servlet container, even when there are five useBean actions on the same JSP page. If you have more than one useBean action with the same ID, you will get a CompileException for the duplicate bean name. See “Creating JavaBeans,” earlier in this chapter.
Answer 4:
A. The response object cannot be used as the scope when using a JavaBean with JSP.
Answer 5:
B. The JavaBean attributes are set when the container captures the form field name-value pairs, and then calls the setter methods in the bean for the attributes which have the same name as the form fields.
Answer 6:
D. The request scope best fits the description given by the question.
Answer 7:
A. This is true that it is impossible to share a page scoped variable with another JSP or Servlet.
Answer 8:
B. When you write a get method for a JavaBean property, use set or get followed by the first letter of the property name capitalized.
Previous Chapter: Quick Recap - Chapters 38 to 43
Next Chapter: Chapter 44 - JSP Tag Libraries
| Reactions: |
Tuesday, April 12, 2011
Self Test: Chapters 31 to 37
Questions:
Question 1:
Assume the custom tag is GLOOP and the prefix is TWONG. Which of the following is the syntax for an empty custom tag?
A. < TWONG : GLOOP / >
B. < GLOOP : TWONG / >
C. < GLOOP : TWONG > < / GLOOP : TWONG >
D. < TWONG : GLOOP > < / TWONG : GLOOP >
Question 2:
Which design pattern did the designers of JSP use to provide centralized dispatching of requests via a controller servlet?
A. Model-View-Controller
B. Facade
C. Server-Client
D. Publish-Subscribe
Question 3:
Which of the following options is a valid declaration?
A. < % ! String name="Rocky" % >
B. < % ! String name="Rocky"; % >
C. < % String name="Anand" % >
D. < % public String name="Anand"; % >
Question 4:
The following are the contents of comment.jsp:
1 < html >
2 < head > < title >Two Comments< / title > < / head >
3 < body >
4 < % - - JSP Comment - - % >
5 < ! - - HTML Comment - - >
6 < / body >
7 < / html >
Which option best describes what happens upon executing index.jsp?
A. A fatal error occurs because the body is empty.
B. Line 5 (but not 4) gets added to the output stream.
C. 4 (but not 5) gets added to the output stream.
D. All seven lines get added to the output stream.
Question 5:
The following are the contents of request_parameter.jsp:
< html >
< head >
< title >Retrieve Request Parameter< / title >
< / head >
< body >
< % String customerName = request.getParameter("customer"); % >
< p >
The customer is < % = customerName % >
< / body >
< / html >
Assuming the www.que.com server is responding correctly and the page path is valid, what displays in the browser if the user types http://www.quepublishing.com/customer/request_parameter.jsp?customer=Anand?
A. The customer is
B. A blank page.
C. The customer is Anand
D. An error page.
Question 6:
The following are the contents of welcomeHeader.inc:
< h1 >Welcome to our drive through
Java coding service!< / h1 >
The following are the contents of index.jsp:
< html >
< head > < title >Java Quick Code< / title > < / head >
< body >
< % String file="welcomeHeader.inc"; % >
< %@ include file="file" % > < p >
We are the best J2EE Programmers.
< / body >
< / html >
Which option best describes what happens upon executing comment.jsp?
A. An error occurs.
B. The page displays including the welcome header.
C. The page displays excluding the welcome header.
D. The page displays, but replaces the welcome header with the words welcomeHeader.inc.
Question 7:
Which of the following options is a JSP implicit object?
A. objRequest
B. Request.send
C. request
D. servlet
Question 8:
Which of the following options is not a JSP implicit object?
A. out
B. in
C. response
D. page
Question 9:
Which of the following will not compile (assume < x : tag > is a valid custom tag that is declared for the current JSP file)?
A. < % String employees = "Rocky"+"Anand"; % >
B. < x : tag value='< % = "5" % > ' />
C. < x : tag value="< % = "hi!" % > " />
D. < x : tag value='< % = "Joe said \\"" +statement+ "\\"." % > '/ >
Question 10:
Which among the following objects is the best choice to share information between users?
A. application
B. page
C. request
D. session
Question 11:
Which among the following objects is the best choice to share information between pages for a single user?
A. application
B. page
C. request
D. session
Question 12:
Which of the following objects is used to share information between pages using the setAttribute and getAttribute methods?
A. application
B. page
C. request
D. session
Question 13:
Which option is a valid page directive?
A. < % @ page language="java" import="com.myco.*" buffer="16kb" % >
B. < % @ page import="com.myco.class" buffer="16" % >
C. < % @ page language="javaScript" buffer="16" % >
D. < % @ page import='com.myco.*' buffer='16' % >
Question 14:
Which option indicates whether the current JSP page is intended to be the URL target of another JSP page's error page?
A. < % @ page isErrorPage="true" % >
B. < % @ page isErrorPage="/messages/errorPage.jsp" % >
C. < % @ page errorPage="true" % >
D. < % @ page errorPage="/messages/errorPage.jsp" % >
Question 15:
Which option defines a URL to a resource to which any Java programming language Throwable object(s) thrown but not caught by the page implementation are forwarded for error processing?
A. < % @ page isErrorPage="true" % >
B. < % @ page isErrorPage="/messages/errorPage.jsp" % >
C. < % @ page errorPage="true" % >
D. < % @ page errorPage="/messages/errorPage.jsp" % >
Answers:
Answer 1:
A, D. These use the correct syntax for an empty custom tag of GLOOP having the prefix TWONG.
Answer 2:
A. The Model-View-Controller design pattern is the one the designers of JSP use to provide centralized dispatching of requests via a controller servlet.
Answer 3:
B. This is a valid declaration. Be careful about the semicolon, which is required in a declaration.
Answer 4:
B. Remember that the JSP Comment is ignored by the compiler. However, the HTML Comment is passed through. Even though the browser doesn't display content in response to it, the JSP container does add it to the output stream.
Answer 5:
C. The declaration is correct. The customer is < % = customerName % > fragment becomes The customer is Anand.
Answer 6:
A. The following is wrong: < % @ include file="file" % >. It should have been < % @ include file="welcomeHeader.inc" % >. Note that "file" in quotes literally means you were asking the system to include a file whose filename is “file.”
Answer 7:
C. Option C is correct if the request is the only implicit object.
Answer 8:
B. All of these are JSP implicit objects except the fictitious in.
Answer 9:
C. All of these will compile except C, because there are quotes within quotes. It should have been < x : tag value="<%= \"hi!\" %>" / >.
Answer 10:
A. The same application object is accessible by all users.
Answer 11:
D. The session object is the best choice for sharing information between pages for a single user. Users can see their own session object, but can't see others' session objects.
Answer 12:
A, C, and D. Both the application and the session objects can be used to share information between pages with the setAttribute and setAttribute methods. Either A or D is correct. Option C is also valid because you can share attributes from a “master” page to an “included” page.
Answer 13:
A. Only A is correct. All the others are syntactically wrong. Notice the kb requirement on the buffer attribute.
Answer 14:
A. This is the isErrorPage attribute of the page directive. Another page can now, but doesn't have to, use this page as an error page.
Answer 15:
D. The errorPage attribute of the page directive defines a URL to a resource to which any Java programming language Throwable object(s) thrown but not caught by the page implementation are forwarded for error processing.
Previous Chapter: Quick Recap - Chapters 31 to 37
Next Chapter: Chapter 38 - Introduction to JavaBeans
Question 1:
Assume the custom tag is GLOOP and the prefix is TWONG. Which of the following is the syntax for an empty custom tag?
A. < TWONG : GLOOP / >
B. < GLOOP : TWONG / >
C. < GLOOP : TWONG > < / GLOOP : TWONG >
D. < TWONG : GLOOP > < / TWONG : GLOOP >
Question 2:
Which design pattern did the designers of JSP use to provide centralized dispatching of requests via a controller servlet?
A. Model-View-Controller
B. Facade
C. Server-Client
D. Publish-Subscribe
Question 3:
Which of the following options is a valid declaration?
A. < % ! String name="Rocky" % >
B. < % ! String name="Rocky"; % >
C. < % String name="Anand" % >
D. < % public String name="Anand"; % >
Question 4:
The following are the contents of comment.jsp:
1 < html >
2 < head > < title >Two Comments< / title > < / head >
3 < body >
4 < % - - JSP Comment - - % >
5 < ! - - HTML Comment - - >
6 < / body >
7 < / html >
Which option best describes what happens upon executing index.jsp?
A. A fatal error occurs because the body is empty.
B. Line 5 (but not 4) gets added to the output stream.
C. 4 (but not 5) gets added to the output stream.
D. All seven lines get added to the output stream.
Question 5:
The following are the contents of request_parameter.jsp:
< html >
< head >
< title >Retrieve Request Parameter< / title >
< / head >
< body >
< % String customerName = request.getParameter("customer"); % >
< p >
The customer is < % = customerName % >
< / body >
< / html >
Assuming the www.que.com server is responding correctly and the page path is valid, what displays in the browser if the user types http://www.quepublishing.com/customer/request_parameter.jsp?customer=Anand?
A. The customer is
B. A blank page.
C. The customer is Anand
D. An error page.
Question 6:
The following are the contents of welcomeHeader.inc:
< h1 >Welcome to our drive through
Java coding service!< / h1 >
The following are the contents of index.jsp:
< html >
< head > < title >Java Quick Code< / title > < / head >
< body >
< % String file="welcomeHeader.inc"; % >
< %@ include file="file" % > < p >
We are the best J2EE Programmers.
< / body >
< / html >
Which option best describes what happens upon executing comment.jsp?
A. An error occurs.
B. The page displays including the welcome header.
C. The page displays excluding the welcome header.
D. The page displays, but replaces the welcome header with the words welcomeHeader.inc.
Question 7:
Which of the following options is a JSP implicit object?
A. objRequest
B. Request.send
C. request
D. servlet
Question 8:
Which of the following options is not a JSP implicit object?
A. out
B. in
C. response
D. page
Question 9:
Which of the following will not compile (assume < x : tag > is a valid custom tag that is declared for the current JSP file)?
A. < % String employees = "Rocky"+"Anand"; % >
B. < x : tag value='< % = "5" % > ' />
C. < x : tag value="< % = "hi!" % > " />
D. < x : tag value='< % = "Joe said \\"" +statement+ "\\"." % > '/ >
Question 10:
Which among the following objects is the best choice to share information between users?
A. application
B. page
C. request
D. session
Question 11:
Which among the following objects is the best choice to share information between pages for a single user?
A. application
B. page
C. request
D. session
Question 12:
Which of the following objects is used to share information between pages using the setAttribute and getAttribute methods?
A. application
B. page
C. request
D. session
Question 13:
Which option is a valid page directive?
A. < % @ page language="java" import="com.myco.*" buffer="16kb" % >
B. < % @ page import="com.myco.class" buffer="16" % >
C. < % @ page language="javaScript" buffer="16" % >
D. < % @ page import='com.myco.*' buffer='16' % >
Question 14:
Which option indicates whether the current JSP page is intended to be the URL target of another JSP page's error page?
A. < % @ page isErrorPage="true" % >
B. < % @ page isErrorPage="/messages/errorPage.jsp" % >
C. < % @ page errorPage="true" % >
D. < % @ page errorPage="/messages/errorPage.jsp" % >
Question 15:
Which option defines a URL to a resource to which any Java programming language Throwable object(s) thrown but not caught by the page implementation are forwarded for error processing?
A. < % @ page isErrorPage="true" % >
B. < % @ page isErrorPage="/messages/errorPage.jsp" % >
C. < % @ page errorPage="true" % >
D. < % @ page errorPage="/messages/errorPage.jsp" % >
Answers:
Answer 1:
A, D. These use the correct syntax for an empty custom tag of GLOOP having the prefix TWONG.
Answer 2:
A. The Model-View-Controller design pattern is the one the designers of JSP use to provide centralized dispatching of requests via a controller servlet.
Answer 3:
B. This is a valid declaration. Be careful about the semicolon, which is required in a declaration.
Answer 4:
B. Remember that the JSP Comment is ignored by the compiler. However, the HTML Comment is passed through. Even though the browser doesn't display content in response to it, the JSP container does add it to the output stream.
Answer 5:
C. The declaration is correct. The customer is < % = customerName % > fragment becomes The customer is Anand.
Answer 6:
A. The following is wrong: < % @ include file="file" % >. It should have been < % @ include file="welcomeHeader.inc" % >. Note that "file" in quotes literally means you were asking the system to include a file whose filename is “file.”
Answer 7:
C. Option C is correct if the request is the only implicit object.
Answer 8:
B. All of these are JSP implicit objects except the fictitious in.
Answer 9:
C. All of these will compile except C, because there are quotes within quotes. It should have been < x : tag value="<%= \"hi!\" %>" / >.
Answer 10:
A. The same application object is accessible by all users.
Answer 11:
D. The session object is the best choice for sharing information between pages for a single user. Users can see their own session object, but can't see others' session objects.
Answer 12:
A, C, and D. Both the application and the session objects can be used to share information between pages with the setAttribute and setAttribute methods. Either A or D is correct. Option C is also valid because you can share attributes from a “master” page to an “included” page.
Answer 13:
A. Only A is correct. All the others are syntactically wrong. Notice the kb requirement on the buffer attribute.
Answer 14:
A. This is the isErrorPage attribute of the page directive. Another page can now, but doesn't have to, use this page as an error page.
Answer 15:
D. The errorPage attribute of the page directive defines a URL to a resource to which any Java programming language Throwable object(s) thrown but not caught by the page implementation are forwarded for error processing.
Previous Chapter: Quick Recap - Chapters 31 to 37
Next Chapter: Chapter 38 - Introduction to JavaBeans
Labels:
sample questions,
sample questions scwcd,
scwcd exam,
scwcd exam questions,
self test,
self test scwcd
| Reactions: |
Monday, April 4, 2011
Self Test: Chapters 25 to 29
Questions:
Question 1:
The sendError() method sends what type of information to the client?
A. Response footer.
B. Response header.
C. Content body.
D. None of the above.
Question 2:
Which of the following is a correct sendError() call?
A. response.sendError(HttpServletResponse.SC_FORBIDDEN, "Sorry, restricted to geeks.");
B. request.sendError(HttpServletResponse.SC_FORBIDDEN, "Sorry, restricted to geeks.");
C. request.sendError(HttpServletResponse.SC_FORBIDDEN);
D. response.sendError("Sorry, restricted to geeks.");
Question 3:
The Status-Code element is a three-digit integer code. The first digit of the Status-Code defines the class of response while the last two digits do not have categories, although they are defined in the standard. What classification is used for redirect?
A. 2XX.
B. 3XX.
C. 4XX.
D. 5XX.
Question 4:
The status codes have been defined by whom?
A. The DSN group.
B. Sun's expert group.
C. The Internet Society.
D. The Apache group.
Question 5:
You need to terminate the request due to an erroneous set of credentials. What method should your servlet respond with?
A. addHeader(String name, String value) method of the response object to add a response header with the given name and value.
B. terminate(String name, int value) to add a response header with the given name and integer value.
C. doTerminate(String location) to send a temporary redirect response to the client so they can try again.
D. response.sendError(HttpServletResponse. SC_NOT_ACCEPTABLE, "Sorry, your crentials are invalid. Please try again.");.
Question 6:
Which method is best for telling the client that all went well and the request was processed successfully?
A. Do nothing. This is the default.
B. setHeader()
C. setStatus()
D. setIntHeader()
Question 7:
Which method commits the response, effectively terminating it?
A. sendError()
B. setHeader()
C. setStatus()
D. finalize()
Question 8:
How can you return an exception object to the client?
A. You cannot do this.
B. Use sendError.
C. Use setStatus.
D. Use sendException.
Question 9:
Which of the following will throw an IllegalStateException exception?
A. setIntHeader(long)
B. setHeader(long)
C. Calling the destroy method before the buffer is flushed.
D. Calling sendError after the response is committed.
Answers:
Answer 1:
D. The sendError() method sends both header and content body type information. This method is overloaded to handle either header only or both.
Answer 2:
A. This method is overloaded with two signatures. Only A is correct. B and C are wrong because this method is part of the response object not the request object. D is wrong because you must supply a status code; you can't just send a String message.
Answer 3:
B. 3XX is used for redirection. The other codes are 2XX for continuation, 4XX for client error, and 5XX for server error.
Answer 4:
C. The Internet Society is the group who defined these codes. The other groups were not involved.
Answer 5:
D. This is the correct way to send a “Not Acceptable” status code of 406. The other answers are correct syntax, but don't send the proper status code to the client.
Answer 6:
A. This is a difficult question. B, C, and D can be used to send information to the client. C is close because it is sometimes used to send an “OK” status of 200 back to the client. However, A is the correct answer. This particular task should be left to the container.
Answer 7:
A. This is the only method that actually terminates the request. sendError() commits the response, if it has not already been committed, and terminates it. No further output to the client can be made because data written to the response after this method is called is ignored.
Answer 8:
B. Sending an exception object is not possible without a lot of tweaking. This action is not mentioned anywhere in the specification. See “Returning an Error Code to the Client.”
Answer 9:
D. Calling sendError will throw an IllegalStateException exception if the response was already sent (committed). None of the other choices will throw this exception.
Previous Chapter: Quick Recap - Chapters 25 to 29
Next Chapter: Chapter 30 - Servlet API
Question 1:
The sendError() method sends what type of information to the client?
A. Response footer.
B. Response header.
C. Content body.
D. None of the above.
Question 2:
Which of the following is a correct sendError() call?
A. response.sendError(HttpServletResponse.SC_FORBIDDEN, "Sorry, restricted to geeks.");
B. request.sendError(HttpServletResponse.SC_FORBIDDEN, "Sorry, restricted to geeks.");
C. request.sendError(HttpServletResponse.SC_FORBIDDEN);
D. response.sendError("Sorry, restricted to geeks.");
Question 3:
The Status-Code element is a three-digit integer code. The first digit of the Status-Code defines the class of response while the last two digits do not have categories, although they are defined in the standard. What classification is used for redirect?
A. 2XX.
B. 3XX.
C. 4XX.
D. 5XX.
Question 4:
The status codes have been defined by whom?
A. The DSN group.
B. Sun's expert group.
C. The Internet Society.
D. The Apache group.
Question 5:
You need to terminate the request due to an erroneous set of credentials. What method should your servlet respond with?
A. addHeader(String name, String value) method of the response object to add a response header with the given name and value.
B. terminate(String name, int value) to add a response header with the given name and integer value.
C. doTerminate(String location) to send a temporary redirect response to the client so they can try again.
D. response.sendError(HttpServletResponse. SC_NOT_ACCEPTABLE, "Sorry, your crentials are invalid. Please try again.");.
Question 6:
Which method is best for telling the client that all went well and the request was processed successfully?
A. Do nothing. This is the default.
B. setHeader()
C. setStatus()
D. setIntHeader()
Question 7:
Which method commits the response, effectively terminating it?
A. sendError()
B. setHeader()
C. setStatus()
D. finalize()
Question 8:
How can you return an exception object to the client?
A. You cannot do this.
B. Use sendError.
C. Use setStatus.
D. Use sendException.
Question 9:
Which of the following will throw an IllegalStateException exception?
A. setIntHeader(long)
B. setHeader(long)
C. Calling the destroy method before the buffer is flushed.
D. Calling sendError after the response is committed.
Answers:
Answer 1:
D. The sendError() method sends both header and content body type information. This method is overloaded to handle either header only or both.
Answer 2:
A. This method is overloaded with two signatures. Only A is correct. B and C are wrong because this method is part of the response object not the request object. D is wrong because you must supply a status code; you can't just send a String message.
Answer 3:
B. 3XX is used for redirection. The other codes are 2XX for continuation, 4XX for client error, and 5XX for server error.
Answer 4:
C. The Internet Society is the group who defined these codes. The other groups were not involved.
Answer 5:
D. This is the correct way to send a “Not Acceptable” status code of 406. The other answers are correct syntax, but don't send the proper status code to the client.
Answer 6:
A. This is a difficult question. B, C, and D can be used to send information to the client. C is close because it is sometimes used to send an “OK” status of 200 back to the client. However, A is the correct answer. This particular task should be left to the container.
Answer 7:
A. This is the only method that actually terminates the request. sendError() commits the response, if it has not already been committed, and terminates it. No further output to the client can be made because data written to the response after this method is called is ignored.
Answer 8:
B. Sending an exception object is not possible without a lot of tweaking. This action is not mentioned anywhere in the specification. See “Returning an Error Code to the Client.”
Answer 9:
D. Calling sendError will throw an IllegalStateException exception if the response was already sent (committed). None of the other choices will throw this exception.
Previous Chapter: Quick Recap - Chapters 25 to 29
Next Chapter: Chapter 30 - Servlet API
Labels:
exception handling in servlets,
getting scwcd certified,
questions,
scwcd exam,
scwcd exam questions,
scwcd questions
| Reactions: |
Thursday, March 24, 2011
Self Test: Chapters 20 to 24
Questions
Question 1:
Which of the following two methods are used to track or store the session ID?
A. encodeURL()
B. sessionTrack()
C. sessionUpdate()
D. encodeRedirectURL()
Question 2:
How do you create a session?
A. createSession()
B. makeSession()
C. callSession()
D. getSession()
Question 3:
How do you retrieve a session object across multiple requests to the same or different servlets within the same WebApp?
A. retrieveSession()
B. findSession()
C. getSession()
D. callSession()
Question 4:
How do you store objects into a session object?
A. put(String, Object)
B. setAttribute(String, Object)
C. addObject(Object)
D. putObject(String, Object)
Question 5:
How do you know if a session is alive?
A. Look in the cookies.
B. getSession(false)
C. isSessionAlive()
D. Exception thrown if you try to create one when one already exists.
Question 6:
How do you destroy or expunge a session?
A. Session.isAlive = false;
B. Session.isNew(false)
C. invalidate()
D. removeSession()
Question 7:
How do you know when a particular object is added to a session?
A. getCreationTime()
B. getAttribute(Date)
C. Session.attributeDate(index)
D. attributeAdded(HttpSessionBindingEvent)
Question 8:
How do you know when a session is created?
A. sessionDidActivate(HttpSessionEvent)
B. You check with sessionIsAlive().
C. You only know when it is killed.
D. When the SESSIONID becomes null.
Question 9:
How do you know when a session is destroyed?
A. sessionBound(HttpSessionEvent)
B. sessionFinalize(HttpSessionEvent)
C. sessionWillPassivate(HttpSessionEvent)
D. valueBound(HttpSessionEvent)
Question 10:
Given that URL-rewriting must be used for session management, identify the query string attribute used when URL-rewriting.
A. sessionid
B. servletid
C. jsessionid
D. containerid
Question 11:
Where are cookies stored?
A. On the server.
B. In web.xml.
C. On the client.
D. In HTML.
Question 12:
Where are session IDs stored?
A. In cookies.
B. In HTML form fields.
C. In query strings.
D. Session IDs are not stored.
Question 13:
Which two technique can be used by a Web container to manage session IDs?
A. deleteAttribute(String)
B. attributeRemove(String)
C. removeAttribute(String)
D. setAttribute(null)
Question 14:
How do you get the date stamp of the session's creation?
A. getCreationTime()
B. sessionDate()
C. getSession(Date)
D. From the response object.
Answers:
Answer 1: A and D. You append the session ID in URLs by calling the response's encodeURL(URL) (or encodeRedirectURL()) method on all URLs returned by a servlet. This method includes the session ID in the URL only if cookies are disabled; otherwise, it returns the URL unchanged.
Answer 2: D. To get the current session in a servlet, you call the getSession() method of HttpServletRequest. You have one parameter to think about. If you don't provide a boolean, this method will create a session if one doesn't exist. The same behavior occurs when you provide a true boolean. However, the container will not create a new session if it doesn't already exist when you use a false argument.
Answer 3: C. This is the same question as #2, but stated differently. You call the getSession() method of HttpServletRequest to create a session.
Answer 4: B. You use the setAttribute(java.lang.String name, java.lang.Object value) method to add objects to a session. The other methods listed are incorrect.
Answer 5: B. This is somewhat difficult. You use getSession(false) method and test for a null result.
HttpSession session = request.getSession(false);
if (session = null) {
//do something about lacking a session
}
If you get a null then the session is alive. You can also check for the session ID with getId(), which returns the id of the session as a String representing the unique identifier assigned to this session. If the session is dead, it will return a null.
Answer 6: C. Only the invalidate() method can destroy a session. Notice that the session can't be referenced after this method has been called. A and D are incorrect and B isn't used properly.
Answer 7: D. The attributeAdded(HttpSessionBindingEvent se) method gets called as the notification that an attribute has been added to a session. The other options are incorrect.
Answer 8: A. The sessionDidActivate(HttpSessionEvent) method is called when the session has just been activated. The other options are incorrect.
Answer 9: C. The sessionWillPassivate(HttpSessionEvent) method is called as the notification that the session is about to be passivated. This is strange language so don't feel bad. They should have used another term such as alive or destroy. A and B are incorrect. D (valueBound(HttpSessionBindingEvent)) is the notification to the object that it is being bound to a session, but doesn't tell you about the session being destroyed.
Answer 10: C. The jsessionid is the parameter that is appended to URLs by the encodeURL() method when cookies are not available to maintain state. The other options are incorrect.
Answer 11: C. Cookies are stored on the client only.
Answer 12: A and C. Session IDs are stored in cookies on the client machine. If cookies are turned off, session IDs can be stored in query strings.
Answer 13: C. The removeAttribute(java.lang.String name) method removes an attribute. It deletes it from the session object. The other options are incorrect.
Answer 14: A. The getCreationTime() method returns a long containing the date stamp of creation. The other options are incorrect.
Previous Chapter: Quick Recap - Chapters 20 to 24
Next Chapter: Chapter 25 - Introduction to Servlet Exception Handling
Question 1:
Which of the following two methods are used to track or store the session ID?
A. encodeURL()
B. sessionTrack()
C. sessionUpdate()
D. encodeRedirectURL()
Question 2:
How do you create a session?
A. createSession()
B. makeSession()
C. callSession()
D. getSession()
Question 3:
How do you retrieve a session object across multiple requests to the same or different servlets within the same WebApp?
A. retrieveSession()
B. findSession()
C. getSession()
D. callSession()
Question 4:
How do you store objects into a session object?
A. put(String, Object)
B. setAttribute(String, Object)
C. addObject(Object)
D. putObject(String, Object)
Question 5:
How do you know if a session is alive?
A. Look in the cookies.
B. getSession(false)
C. isSessionAlive()
D. Exception thrown if you try to create one when one already exists.
Question 6:
How do you destroy or expunge a session?
A. Session.isAlive = false;
B. Session.isNew(false)
C. invalidate()
D. removeSession()
Question 7:
How do you know when a particular object is added to a session?
A. getCreationTime()
B. getAttribute(Date)
C. Session.attributeDate(index)
D. attributeAdded(HttpSessionBindingEvent)
Question 8:
How do you know when a session is created?
A. sessionDidActivate(HttpSessionEvent)
B. You check with sessionIsAlive().
C. You only know when it is killed.
D. When the SESSIONID becomes null.
Question 9:
How do you know when a session is destroyed?
A. sessionBound(HttpSessionEvent)
B. sessionFinalize(HttpSessionEvent)
C. sessionWillPassivate(HttpSessionEvent)
D. valueBound(HttpSessionEvent)
Question 10:
Given that URL-rewriting must be used for session management, identify the query string attribute used when URL-rewriting.
A. sessionid
B. servletid
C. jsessionid
D. containerid
Question 11:
Where are cookies stored?
A. On the server.
B. In web.xml.
C. On the client.
D. In HTML.
Question 12:
Where are session IDs stored?
A. In cookies.
B. In HTML form fields.
C. In query strings.
D. Session IDs are not stored.
Question 13:
Which two technique can be used by a Web container to manage session IDs?
A. deleteAttribute(String)
B. attributeRemove(String)
C. removeAttribute(String)
D. setAttribute(null)
Question 14:
How do you get the date stamp of the session's creation?
A. getCreationTime()
B. sessionDate()
C. getSession(Date)
D. From the response object.
Answers:
Answer 1: A and D. You append the session ID in URLs by calling the response's encodeURL(URL) (or encodeRedirectURL()) method on all URLs returned by a servlet. This method includes the session ID in the URL only if cookies are disabled; otherwise, it returns the URL unchanged.
Answer 2: D. To get the current session in a servlet, you call the getSession() method of HttpServletRequest. You have one parameter to think about. If you don't provide a boolean, this method will create a session if one doesn't exist. The same behavior occurs when you provide a true boolean. However, the container will not create a new session if it doesn't already exist when you use a false argument.
Answer 3: C. This is the same question as #2, but stated differently. You call the getSession() method of HttpServletRequest to create a session.
Answer 4: B. You use the setAttribute(java.lang.String name, java.lang.Object value) method to add objects to a session. The other methods listed are incorrect.
Answer 5: B. This is somewhat difficult. You use getSession(false) method and test for a null result.
HttpSession session = request.getSession(false);
if (session = null) {
//do something about lacking a session
}
If you get a null then the session is alive. You can also check for the session ID with getId(), which returns the id of the session as a String representing the unique identifier assigned to this session. If the session is dead, it will return a null.
Answer 6: C. Only the invalidate() method can destroy a session. Notice that the session can't be referenced after this method has been called. A and D are incorrect and B isn't used properly.
Answer 7: D. The attributeAdded(HttpSessionBindingEvent se) method gets called as the notification that an attribute has been added to a session. The other options are incorrect.
Answer 8: A. The sessionDidActivate(HttpSessionEvent) method is called when the session has just been activated. The other options are incorrect.
Answer 9: C. The sessionWillPassivate(HttpSessionEvent) method is called as the notification that the session is about to be passivated. This is strange language so don't feel bad. They should have used another term such as alive or destroy. A and B are incorrect. D (valueBound(HttpSessionBindingEvent)) is the notification to the object that it is being bound to a session, but doesn't tell you about the session being destroyed.
Answer 10: C. The jsessionid is the parameter that is appended to URLs by the encodeURL() method when cookies are not available to maintain state. The other options are incorrect.
Answer 11: C. Cookies are stored on the client only.
Answer 12: A and C. Session IDs are stored in cookies on the client machine. If cookies are turned off, session IDs can be stored in query strings.
Answer 13: C. The removeAttribute(java.lang.String name) method removes an attribute. It deletes it from the session object. The other options are incorrect.
Answer 14: A. The getCreationTime() method returns a long containing the date stamp of creation. The other options are incorrect.
Previous Chapter: Quick Recap - Chapters 20 to 24
Next Chapter: Chapter 25 - Introduction to Servlet Exception Handling
Labels:
scwcd exam,
scwcd exam questions,
self test,
self test scwcd,
session management,
using httpsession,
using http session
| Reactions: |
Wednesday, March 23, 2011
Self Test: Chapters 6 to 19
Questions:
Question 1: Which of the following methods are defined in the Servlet interface?
A. init()
B. service()
C. finalize()
D. destroy()
Question 2: Which of the following objects are passed to a servlet's service() method?
A. ServletRequest
B. HttpServletRequest
C. ServletResponse
D. HttpServletResponse
Question 3: By default, how many instances of a servlet are created by a Servlet Container?
A. One
B. One per request
C. One per session
D. None of the above
Question 4: Which of the following exceptions are defined by the Servlet API?
A. ServletException
B. InitializationException
C. UnavailableException
D. ServletContextException
Question 5: Which of the following are used by Servlet Containers to maintain session information?
A. cookies
B. hidden form fields
C. HTTPS protocol information
D. URL rewriting
Question 6: Which of the following event listeners are defined by the Servlet API?
A. HttpSessionBindingListener
B. HttpSessionEventListener
C. HttpSessionParameterListener
D. HttpSessionAttributeListener
Question 7: Which of the following methods are defined by the RequestDispatcher interface?
A. dispatch()
B. include()
C. redirect()
D. forward()
Question 8: Which of the following is the name of the cookie used by Servlet Containers to maintain session information?
A. SESSIONID
B. SERVLETID
C. JSESSIONID
D. CONTAINERID
Answers:
Answer 1: C. The finalize() method is not defined by the Servlet interface.
Answer 2: A, C. ServletRequest and ServletResponse methods are passed to the service() method.
Answer 3: A. By default, only one instance of a servlet is created by a Servlet Container.
Answer 4: A, C. The Servlet API defines ServletException and UnavailableException.
Answer 5: A, C, D. Hidden form fields are not used by Servlet Containers to maintain session information..”
Answer 6: A. Only HttpSessionBindingListener is defined by the Servlet API.
Answer 7: B, D. The RequestDispatcher interface defines the include() and forward() methods.
Answer 8: C. The JSESSIONID cookie is used by Servlet Containers to maintain session information.
Previous Chapter: Quick Recap - Chapters 6 to 19
Next Chapter: Chapter 20 - Introduction to Session Management
Question 1: Which of the following methods are defined in the Servlet interface?
A. init()
B. service()
C. finalize()
D. destroy()
Question 2: Which of the following objects are passed to a servlet's service() method?
A. ServletRequest
B. HttpServletRequest
C. ServletResponse
D. HttpServletResponse
Question 3: By default, how many instances of a servlet are created by a Servlet Container?
A. One
B. One per request
C. One per session
D. None of the above
Question 4: Which of the following exceptions are defined by the Servlet API?
A. ServletException
B. InitializationException
C. UnavailableException
D. ServletContextException
Question 5: Which of the following are used by Servlet Containers to maintain session information?
A. cookies
B. hidden form fields
C. HTTPS protocol information
D. URL rewriting
Question 6: Which of the following event listeners are defined by the Servlet API?
A. HttpSessionBindingListener
B. HttpSessionEventListener
C. HttpSessionParameterListener
D. HttpSessionAttributeListener
Question 7: Which of the following methods are defined by the RequestDispatcher interface?
A. dispatch()
B. include()
C. redirect()
D. forward()
Question 8: Which of the following is the name of the cookie used by Servlet Containers to maintain session information?
A. SESSIONID
B. SERVLETID
C. JSESSIONID
D. CONTAINERID
Answers:
Answer 1: C. The finalize() method is not defined by the Servlet interface.
Answer 2: A, C. ServletRequest and ServletResponse methods are passed to the service() method.
Answer 3: A. By default, only one instance of a servlet is created by a Servlet Container.
Answer 4: A, C. The Servlet API defines ServletException and UnavailableException.
Answer 5: A, C, D. Hidden form fields are not used by Servlet Containers to maintain session information..”
Answer 6: A. Only HttpSessionBindingListener is defined by the Servlet API.
Answer 7: B, D. The RequestDispatcher interface defines the include() and forward() methods.
Answer 8: C. The JSESSIONID cookie is used by Servlet Containers to maintain session information.
Previous Chapter: Quick Recap - Chapters 6 to 19
Next Chapter: Chapter 20 - Introduction to Session Management
Labels:
scwcd exam,
scwcd exam questions,
self assement,
self assement scwcd,
self test,
self test scwcd
| Reactions: |
Tuesday, March 1, 2011
Quick Recap: Chapters 1 to 5
Let us quickly go over the concepts we have covered in the past few chapters.
JSP & Servlet History
• ARPANET was the initial backbone based on which Internet was built
• Tim Berners Lee paved the way for the current day Internet and World Wide Web
• CGI helped people transfer data from one computer to another
• Because CGI was not scalable, people looked out for better alternatives
• JSP and Servlets became an easier and a more scalable alternative to CGI
Advantages of Using Servlets
a. They are faster than CGI scripts because each CGI script produces an entirely new process that takes a lot of time to execute, whereas a servlet creates only a new thread.
b. Servlet API is standard and available easily on the internet (like JSPs)
c. Servlets have the advantages like ease of development & platform independence (like Java)
d. They can access all the J2SE and J2EE APIs
e. Can take the full advantage & capabilities of the Java programming language
Advantages of Using JSPs
a. Write Once, Run Anywhere
b. Code Re-use
c. Support for Scripting
d. Supports Actions
e. Supports both Static & Dynamic Content
f. Supports N-tier Enterprise Application Architecture
g. Superior Quality Documentation & Examples (All over the internet)
h. Reusable Tag Libraries
Web Servers & Servlet Containers
• A web server is the server on which our J2EE application runs
• A Servlet container is similar to a JVM for java programs and executes our Servlets
• Data is transferred using the request/response model
JSP to Servlet Conversion
• A JSP file gets converted into a Servlet at run time
• The web server (Ex: Tomcat) does the conversion of the JSP
• The web server invokes the converted Servlet version of the JSP page, every time the JSP is invoked.
Previous Chapter: Chapter 5 - JSP to Servlet Conversion
Next Chapter: Self Test - Chapters 1 to 5
JSP & Servlet History
• ARPANET was the initial backbone based on which Internet was built
• Tim Berners Lee paved the way for the current day Internet and World Wide Web
• CGI helped people transfer data from one computer to another
• Because CGI was not scalable, people looked out for better alternatives
• JSP and Servlets became an easier and a more scalable alternative to CGI
Advantages of Using Servlets
a. They are faster than CGI scripts because each CGI script produces an entirely new process that takes a lot of time to execute, whereas a servlet creates only a new thread.
b. Servlet API is standard and available easily on the internet (like JSPs)
c. Servlets have the advantages like ease of development & platform independence (like Java)
d. They can access all the J2SE and J2EE APIs
e. Can take the full advantage & capabilities of the Java programming language
Advantages of Using JSPs
a. Write Once, Run Anywhere
b. Code Re-use
c. Support for Scripting
d. Supports Actions
e. Supports both Static & Dynamic Content
f. Supports N-tier Enterprise Application Architecture
g. Superior Quality Documentation & Examples (All over the internet)
h. Reusable Tag Libraries
Web Servers & Servlet Containers
• A web server is the server on which our J2EE application runs
• A Servlet container is similar to a JVM for java programs and executes our Servlets
• Data is transferred using the request/response model
JSP to Servlet Conversion
• A JSP file gets converted into a Servlet at run time
• The web server (Ex: Tomcat) does the conversion of the JSP
• The web server invokes the converted Servlet version of the JSP page, every time the JSP is invoked.
Previous Chapter: Chapter 5 - JSP to Servlet Conversion
Next Chapter: Self Test - Chapters 1 to 5
Labels:
arpanet,
internet history,
j2ee history,
jsp,
jsp and servlets,
quick recap,
quick review,
scwcd,
scwcd certification,
scwcd exam,
servlets,
servlets and jsps
| Reactions: |
Sunday, February 27, 2011
Introduction to the Web Component Developer Exam
Well, let me begin by congratulating you on your decision to get yourself a Web Component Developer certification. It is a good decision and the subsequent series of articles in my blog would help you attain your goal.
Any goal needs a start and well, this chapter is the starting point on our journey towards SCWCD certification.
So, lets get started!!!
Introduction to the Web Component Developer Certification:
The Sun Certified Web Component Developer (SCWCD) certification covers the basic Web development concepts “Servlets” and “Java Server Pages (JSP)”
Servlets are classes that look like those you use in basic Java Programming, except they extend special purpose classes that enable them to respond to Web server requests. JSP pages extend servlet technology with a simple HTML (or XML) syntax. You can also include normal Java statements inside JSP files.
The servlet container actually compiles JSP pages into a servlet the first time it is requested.
Official Definition of a JSP:
What good would this series of articles be if we dont look at the official definition of the technologies we are going to get ourselves certified with.
Benefits of using JSPs for developing Web Applications:
There are a lot of significant benefits of using JSPs for developing our Web Applications. They are:
a. Write Once, Run Anywhere
b. Code Re-use
c. Support for Scripting
d. Supports Actions
e. Supports both Static & Dynamic Content
f. Supports N-tier Enterprise Application Architecture
g. Superior Quality Documentation & Examples (All over the internet)
h. Reusable Tag Libraries
Official Definition of Servlets:
We saw the official definition of JSPs and now it is time to take a look at the same for Servlets.
Benefits of using Servlets for developing Web Applications:
Servlets are an integral part of any J2EE Web application. The key benefits of using Servlets in our web applications are:
a. They are faster than CGI scripts because each CGI script produces an entirely new process that takes a lot of time to execute, whereas a servlet creates only a new thread.
b. Servlet API is standard and available easily on the internet (like JSPs)
c. Servlets have the advantages like ease of development & platform independence (like Java)
d. They can access all the J2SE and J2EE APIs
e. Can take the full advantage & capabilities of the Java programming langauge
As you can see, there are numerous advantages of using the Servlet & JSP technologies. This is exactly why numerous organizations use them as a staple part of their J2EE application development work.
The SCWCD Exam:
The SCWCD Exam is a 90 minute exam in which the candidate is expected to answer 60 questions. A Majority of them (almost 90%) are multiple choice questions. You are expected to choose all the correct answers of a question in order to get the full marks for answering that question. If let’s say, a question has 3 right answers and you choose only 2, you will not get full points for that question.
The Exam is moderately difficult or even significantly difficult for novice programmers. You need to get atleast 37 of the 60 questions right in order to pass the exam.
Preparing for the SCWCD Exam:
First and foremost requirement to pass the exam is to prepare for the exam properly. You cant pass the exam by just going through exam questions/answers dumps over the internet. A dedicated preparation is essential. The sequence of articles in my blog would help you do that. At the same time, you need a computer that has Java in it and you should get some hands on practice in coding components that are covered in the SCWCD exam.
You’ll need the following in your computer:
• Install Java (V 1.4 or higher)
• Install Tomcat V4.0 or higher (It is a free Web Server)
• Download the JSP 1.2 and Servlets 2.3 specifications
Once you are done with this, you are all set to get yourself a SCWCD Certification.
Well, thats it for this chapter. Lets dive into concepts you need to know for the exam, one by one in the subsequent chapters.
Next Chapter: Servlet & JSP History
Any goal needs a start and well, this chapter is the starting point on our journey towards SCWCD certification.
So, lets get started!!!
Introduction to the Web Component Developer Certification:
The Sun Certified Web Component Developer (SCWCD) certification covers the basic Web development concepts “Servlets” and “Java Server Pages (JSP)”
Servlets are classes that look like those you use in basic Java Programming, except they extend special purpose classes that enable them to respond to Web server requests. JSP pages extend servlet technology with a simple HTML (or XML) syntax. You can also include normal Java statements inside JSP files.
The servlet container actually compiles JSP pages into a servlet the first time it is requested.
Official Definition of a JSP:
What good would this series of articles be if we dont look at the official definition of the technologies we are going to get ourselves certified with.
“JavaServer Pages is the Java 2 Platform, Enterprise Edition (J2EE) technology for building applications for generating dynamic Web content, such as HTML, DHTML, XHTML and XML. The JavaServer Pages technology enables the easy authoring of web pages that create dynamic content with maximum power and flexibility.”
Benefits of using JSPs for developing Web Applications:
There are a lot of significant benefits of using JSPs for developing our Web Applications. They are:
a. Write Once, Run Anywhere
b. Code Re-use
c. Support for Scripting
d. Supports Actions
e. Supports both Static & Dynamic Content
f. Supports N-tier Enterprise Application Architecture
g. Superior Quality Documentation & Examples (All over the internet)
h. Reusable Tag Libraries
Official Definition of Servlets:
We saw the official definition of JSPs and now it is time to take a look at the same for Servlets.
Servlet is a Java technology based Web component, managed by a container that generates dynamic content. Containers, also called as Servlet Engines, are Web Server extensions that provide the Servlet Functionality. Servlets interact with other web clients like JSPs via a request/response mechanism implemented by the Servlet Container
Benefits of using Servlets for developing Web Applications:
Servlets are an integral part of any J2EE Web application. The key benefits of using Servlets in our web applications are:
a. They are faster than CGI scripts because each CGI script produces an entirely new process that takes a lot of time to execute, whereas a servlet creates only a new thread.
b. Servlet API is standard and available easily on the internet (like JSPs)
c. Servlets have the advantages like ease of development & platform independence (like Java)
d. They can access all the J2SE and J2EE APIs
e. Can take the full advantage & capabilities of the Java programming langauge
As you can see, there are numerous advantages of using the Servlet & JSP technologies. This is exactly why numerous organizations use them as a staple part of their J2EE application development work.
Exam Trivia:
How would you convince your employer that you are capable in the use of JSP and Servlets and can be a useful addition to their workforce?
The answer is simple and a No Brainer – Get yourself SCWCD Certified!!!
The SCWCD Exam:
The SCWCD Exam is a 90 minute exam in which the candidate is expected to answer 60 questions. A Majority of them (almost 90%) are multiple choice questions. You are expected to choose all the correct answers of a question in order to get the full marks for answering that question. If let’s say, a question has 3 right answers and you choose only 2, you will not get full points for that question.
The Exam is moderately difficult or even significantly difficult for novice programmers. You need to get atleast 37 of the 60 questions right in order to pass the exam.
Preparing for the SCWCD Exam:
First and foremost requirement to pass the exam is to prepare for the exam properly. You cant pass the exam by just going through exam questions/answers dumps over the internet. A dedicated preparation is essential. The sequence of articles in my blog would help you do that. At the same time, you need a computer that has Java in it and you should get some hands on practice in coding components that are covered in the SCWCD exam.
You’ll need the following in your computer:
• Install Java (V 1.4 or higher)
• Install Tomcat V4.0 or higher (It is a free Web Server)
• Download the JSP 1.2 and Servlets 2.3 specifications
Once you are done with this, you are all set to get yourself a SCWCD Certification.
Well, thats it for this chapter. Lets dive into concepts you need to know for the exam, one by one in the subsequent chapters.
Next Chapter: Servlet & JSP History
Subscribe to:
Posts (Atom)
© 2013 by www.inheritingjava.blogspot.com. All rights reserved. No part of this blog or its contents may be reproduced or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without prior written permission of the Author.
