How to navigate Phoenix
  • 1. What is the primary purpose of a Phoenix Router?
A) To define Ecto schemas.
B) To render HTML templates.
C) To manage database connections.
D) To route incoming HTTP requests to the appropriate controller action.
  • 2. Which command generates a new Phoenix project?
A) elixir new
B) iex -S mix phx.new
C) mix phx.new
D) phoenix new
  • 3. What does the 'mix phx.server' command do?
A) Runs database migrations.
B) Starts the Phoenix server.
C) Compiles the Elixir code.
D) Generates a new resource.
  • 4. What file configures the application's endpoints?
A) router.ex
B) application.ex
C) endpoint.ex
D) config.exs
  • 5. Which directory contains the application's views?
A) lib/my_app/views
B) lib/my_app_web/views
C) priv/views
D) web/views
  • 6. What is the purpose of an Ecto schema?
A) Defines the application's configurations.
B) Defines the structure of a database table.
C) Defines the application's layout.
D) Defines the routes of the application.
  • 7. What is the role of a Phoenix Channel?
A) To handle HTTP requests.
B) To provide real-time communication via WebSockets.
C) To define database migrations.
D) To manage background jobs.
  • 8. Which command is used to run database migrations?
A) ecto migrate
B) mix ecto.migrate
C) elixir migrate
D) mix phx.migrate
  • 9. What does the abbreviation 'HTML' stand for?
A) Highly Textual Markup Language
B) Hyper Transfer Markup Language
C) HyperText Markup Language
D) Home Tool Markup Language
  • 10. What file contains the application's configurations?
A) web/router.ex
B) config/config.exs
C) lib/my_app_web/endpoint.ex
D) lib/my_app/application.ex
  • 11. What is the purpose of the `use MyAppWeb, :controller` macro?
A) To define a schema.
B) To define a route.
C) To import necessary modules and functions for controllers.
D) To start the server.
  • 12. Where are templates located?
A) web/templates
B) lib/my_app_web/templates
C) lib/my_app/templates
D) priv/templates
  • 13. What is EEx?
A) Extended Erlang
B) External Elixir
C) Embedded Elixir
D) Extra Elixir
  • 14. What does `mix test` command do?
A) Runs the application's tests.
B) Generates new test files.
C) Compiles the test environment.
D) Starts the test server.
  • 15. What is the purpose of `Plug`?
A) A tool for code formatting.
B) A specification for composable modules in web applications.
C) A library for database migrations.
D) A framework for building command-line applications.
  • 16. What is the main benefit of using Phoenix?
A) Easy integration with other programming languages.
B) Simplicity and rapid prototyping.
C) Speed, scalability, and maintainability.
D) Large community support and extensive documentation.
  • 17. Which function is typically used to render a template within a controller?
A) render/2
B) view/2
C) template/2
D) display/2
  • 18. What is a HEEx template?
A) A compiled EEx template.
B) A Phoenix template that uses HTML-aware syntax.
C) A Javascript templating engine.
D) An old version of EEx.
  • 19. What is the purpose of the `phx.new.ecto` generator option?
A) To remove Ecto from an existing project.
B) To install Ecto after creating a project.
C) To update Ecto to the latest version.
D) To generate a Phoenix project with Ecto pre-configured.
  • 20. Which file defines the application's supervisors?
A) lib/my_app_web/endpoint.ex
B) config/config.exs
C) lib/my_app/application.ex
D) web/router.ex
  • 21. What is the purpose of a Context in a Phoenix application?
A) To define database schemas.
B) To encapsulate business logic.
C) To render HTML templates.
D) To handle HTTP requests.
  • 22. What is the purpose of the `with` statement in Elixir?
A) To define a loop.
B) To declare a variable.
C) To chain together function calls based on success or failure.
D) To handle exceptions.
  • 23. What is the purpose of the `conn` struct in Phoenix?
A) Represents a channel connection.
B) Represents a user session.
C) Represents a database connection.
D) Represents the connection information for an incoming HTTP request.
  • 24. What is the purpose of the `phx.gen.html` task?
A) Generates all the necessary files for CRUD operations on a resource.
B) Generates a database migration.
C) Generates a single HTML template.
D) Generates a new Phoenix project.
  • 25. What is a LiveView?
A) A database management tool.
B) A client-side JavaScript framework.
C) A server-rendered interactive web application built with Phoenix.
D) A code editor plugin.
  • 26. What is the purpose of `push_event` in LiveView?
A) Sends an event from the client to the server.
B) Publishes an event to a PubSub topic.
C) Triggers a database migration.
D) Sends an event from the server to the client.
  • 27. What does `mix format` do?
A) Formats the project's Elixir code.
B) Generates new project files.
C) Compiles the project's Elixir code.
D) Runs the project's tests.
  • 28. What is PubSub in Phoenix?
A) A code formatting tool.
B) A testing framework.
C) A library for publish-subscribe messaging.
D) A database connection pool.
  • 29. What is the purpose of `assigns` in a Phoenix LiveView?
A) A configuration file for the LiveView.
B) A map containing data passed from the server to the LiveView template.
C) A function that updates the LiveView's state.
D) A list of CSS classes to apply to an HTML element.
  • 30. How do you specify a root route in Phoenix?
A) map "/", PageController, :index
B) route "/", PageController, :index
C) root PageController, :index
D) get "/", PageController, :index
Created with That Quiz — where a math practice test is always one click away.