Spring Questions and Answers – Email and Scheduling with Spring Support

This set of Java Spring online quiz focuses 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
View Answer

Answer: a
Explanation: 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
View Answer

Answer: a
Explanation: 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
View Answer

Answer: a
Explanation: 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.
advertisement
advertisement

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
View Answer

Answer: c
Explanation: 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
View Answer

Answer: a
Explanation: You send the email by making a call to Transport.send().
Note: Join free Sanfoundry classes at Telegram or Youtube

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
View Answer

Answer: d
Explanation: 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
View Answer

Answer: b
Explanation: If you have a JavaMail session configured in your Java EE application server, you can first look it up with the help of JndiObjectFactoryBean.
advertisement

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
View Answer

Answer: c
Explanation: 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
View Answer

Answer: a
Explanation: The JavaMailSenderImpl instance you injected does implement this interface, so you needn’t modify your bean configurations.
advertisement

10. Quartz supports several types of triggers:-
a) SimpleTrigger
b) CronTrigger
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: c
Explanation: 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
View Answer

Answer: d
Explanation: 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
View Answer

Answer: a
Explanation: 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
View Answer

Answer: a
Explanation: 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
View Answer

Answer: b
Explanation: 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
View Answer

Answer: c
Explanation: 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.

Sanfoundry Global Education & Learning Series – Java Spring.
To practice all areas of Java Spring for online quizzes, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.