Java Spring online quiz on “Email and scheduling with Spring Support”.
1. The core interface of Spring email support is:-
a) MailSender
b) EMail
c) All of the mentioned
d) None of the mentioned
Answer: a
Clarification: Spring email support makes it easier to send email by providing an abstract and implementation-independent API for sending email. The core interface of Spring email support is MailSender.
2. The JavaMailSender interface is a subinterface of MailSender that includes specialized JavaMail features:-
a) Multipurpose Internet Mail Extensions
b) Multipurpose Internet Mail
c) Multipurpose Internet Extensions
d) None of the mentioned
Answer: a
Clarification: The JavaMailSender interface is a subinterface of MailSender that includes specialized JavaMail features such as Multipurpose Internet Mail Extensions (MIME) message support. To send an email message with HTML content, inline images, or attachments, you have to send it as a MIME message.
3. Before you implement the ErroNotifier interface in this way, you may need a local email server that supports the Simple Mail Transfer Protocol (SMTP) for testing purposes.
a) True
b) False
Answer: a
Clarification: Before you implement the interface in this way, you may need a local email server that supports the Simple Mail Transfer Protocol (SMTP) for testing purposes. We recommend installing Apache James Server (http://james.apache.org/server/index.html), which is very easy to install and configure.
4. You can implement the interface to send email notifications in case of errors.
a) Notify
b) Error
c) ErrorNotifier
d) None of the mentioned
Answer: c
Clarification: You can implement the ErrorNotifier interface to send email notifications in case of errors.
5. You send the email by making a call to:-
a) Transport.send()
b) Transport.sendTo()
c) All of the mentioned
d) None of the mentioned
Answer: a
Clarification: You send the email by making a call to Transport.send().
6. The default port used by JavaMailSenderImpl is the:-
a) SMTP port 24
b) SMTP port 22
c) SSH port 22
d) SMTP port 25
Answer: d
Clarification: The default port used by JavaMailSenderImpl is the standard SMTP port 25, so if your email server listens on this port for SMTP, you can simply omit this property.
7. If you have a JavaMail session configured in your Java EE application server, you can first look it up with the help of:-
a) JndiObjectFactory
b) JndiObjectFactoryBean
c) JndiObject
d) None of the mentioned
Answer: b
Clarification: If you have a JavaMail session configured in your Java EE application server, you can first look it up with the help of JndiObjectFactoryBean.
8. MIME is supported by JavaMail through the:-
a) javax.mail.internet.Mime
b) javax.mail.internet.Message
c) javax.mail.internet.MimeMessage
d) javax.mail.internet.Mail
Answer: c
Clarification: To send email that contains HTML content, inline images, or attachments, you have to construct and send a MIME message instead. MIME is supported by JavaMail through the javax.mail.internet.MimeMessage class.
9. The JavaMailSenderImpl instance you injected does implement this interface.
a) True
b) False
Answer: a
Clarification: The JavaMailSenderImpl instance you injected does implement this interface, so you needn’t modify your bean configurations.
10. Quartz supports several types of triggers:-
a) SimpleTrigger
b) CronTrigger
c) All of the mentioned
d) None of the mentioned
Answer: c
Clarification: Quartz supports two types of triggers: SimpleTrigger and CronTrigger.
11. SimpleTrigger allows you to set trigger properties:-
a) start time
b) end time
c) repeat interval
d) all of the mentioned
Answer: d
Clarification: SimpleTrigger allows you to set trigger properties such as start time, end time, repeat interval, and repeat count.
12. CronTrigger accepts a Unix cron expression for you to specify the times to run your job.
a) True
b) False
Answer: a
Clarification: For example, you can replace the preceding SimpleTrigger with the following CronTrigger to run your job at 17:30 every day:
CronTrigger trigger = new CronTrigger(); trigger.setName("documentReplicationJob"); trigger.setCronExpression("0 30 17 * * ?");
13. Spring also offers MethodInvokingJobDetailFactoryBean for you to define a job that executes a single method of a particular object.
a) True
b) False
Answer: a
Clarification: This saves you the trouble of creating a job class.
14. You can configure a Quartz SimpleTrigger object in Spring bean configuration file through:-
a) SimpleTrigger
b) SimpleTriggerBean
c) All of the mentioned
d) None of the mentioned
Answer: b
Clarification: You can configure a Quartz SimpleTrigger object in Spring bean configuration file through SimpleTriggerBean, which requires a reference to a JobDetail object. This bean provides common default values for certain trigger properties, such as using the bean name as the job name and setting indefinite repeat count.
15. Spring 3.0 debuts new support for configuring:-
a) TaskExecutors
b) TaskSchedulers
c) All of the mentioned
d) None of the mentioned
Answer: c
Clarification: Spring 3.0 debuts new support for configuring TaskExecutors and TaskSchedulers. This capability, coupled with the ability to schedule method execution using the @Scheduled annotation, makes Spring 3.0 very capable of meeting this challenge.
Java Spring for online quizzes,
