Loading

Quipoin Menu

Learn • Practice • Grow

spring / Email with Attachments
mcq
Direction: Choose the correct option

Q1.

How do you add an attachment to an email using Spring?
A. Using MimeMessageHelper's addAttachment() method
B. Using SimpleMailMessage
C. Both A and B
D. None
Direction: Choose the correct option

Q2.

What parameters does addAttachment() take?
A. Filename and DataSource
B. Filename and File
C. Filename and InputStream
D. All of the above
Direction: Choose the correct option

Q3.

What is a DataSource in Spring?
A. An abstraction for a source of data, like a file or byte array
B. A database connection pool
C. An email attachment
D. None
Direction: Choose the correct option

Q4.

How do you set HTML content in an email?
A. mimeMessageHelper.setText(html, true)
B. mimeMessageHelper.setHtmlText(html)
C. simpleMailMessage.setHtml(html)
D. None
Direction: Choose the correct option

Q5.

What is the purpose of MimeMessageHelper.setMultipart()?
A. To indicate that the message is multipart (contains attachments or HTML)
B. To add multiple parts
C. To set multipart config
D. None
Direction: Choose the correct option

Q6.

How do you send an email with inline images?
A. Using addInline() method of MimeMessageHelper
B. Using addAttachment()
C. Using setInline()
D. None
Direction: Choose the correct option

Q7.

What is a CID in email?
A. Content-ID used to reference inline images in HTML
B. A unique identifier
C. A protocol
D. None
Direction: Choose the correct option

Q8.

How do you handle file upload before attaching to email?
A. Use MultipartFile to get InputStream and create DataSource
B. Save file first then attach
C. Both A and B
D. None
Direction: Choose the correct option

Q9.

What exception might occur when sending email?
A. MailException
B. MessagingException
C. MailSendException
D. All of the above
Direction: Choose the correct option

Q10.

How do you configure a mail sender for Gmail SMTP?
A. Set host=smtp.gmail.com, port=587, enable STARTTLS
B. Set host=gmail.com
C. Set host=smtp.gmail.com, port=25
D. None