All quizzes
Free quiz · 20 questions in the bank

Twig quiz

Test your Twig knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.

Question 1/5Score 0

What is a reasonable justification for keeping business logic (like complex calculations, database queries, or validation) OUT of Twig templates, and instead computing that data in PHP controllers/services before passing it to the template?

Questions in this quiz
  1. What is a reasonable justification for keeping business logic (like complex calculations, database queries, or validation) OUT of Twig templates, and instead computing that data in PHP controllers/services before passing it to the template?
  2. How does Twig handle conditional logic (if/else) within a template?
  3. What is a Twig "filter", and how is it applied to a value?
  4. What is Twig?
  5. What is Twig's "sandbox" mode used for?
  6. What is the purpose of the `{% verbatim %}` tag in Twig?
  7. What does the `~` operator do in a Twig expression, e.g. `{{ 'Hello, ' ~ name ~ '!' }}`?
  8. What is the `default` filter used for in Twig, e.g. `{{ user.nickname|default('Anonymous') }}`?
  9. What is the purpose of Twig's `{% set %}` tag?
  10. How do you deliberately output raw, unescaped HTML in a Twig template when auto-escaping would otherwise interfere (e.g. rendering trusted, pre-sanitized HTML content)?
  11. How does Twig typically relate to the Symfony framework, and can Twig be used outside of Symfony?
  12. What is "template inheritance" in Twig, and what problem does the `{% extends %}` and `{% block %}` combination solve?
Gaps to close?
Read the curated Twig notes — core concepts, patterns, interview prep.
Twig notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web