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