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 route incoming HTTP requests to the appropriate controller action.
D) To manage database connections.
  • 2. Which command generates a new Phoenix project?
A) phoenix new
B) elixir new
C) iex -S mix phx.new
D) mix phx.new
  • 3. What does the 'mix phx.server' command do?
A) Generates a new resource.
B) Runs database migrations.
C) Starts the Phoenix server.
D) Compiles the Elixir code.
  • 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_web/views
B) priv/views
C) lib/my_app/views
D) web/views
  • 6. What is the purpose of an Ecto schema?
A) Defines the application's configurations.
B) Defines the application's layout.
C) Defines the structure of a database table.
D) Defines the routes of the application.
  • 7. What is the role of a Phoenix Channel?
A) To provide real-time communication via WebSockets.
B) To handle HTTP requests.
C) To manage background jobs.
D) To define database migrations.
  • 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) Highly Textual Markup Language
C) Home Tool Markup Language
D) HyperText 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 start the server.
B) To define a route.
C) To import necessary modules and functions for controllers.
D) To define a schema.
  • 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) Extra Elixir
B) Extended Erlang
C) Embedded Elixir
D) External Elixir
  • 14. What does `mix test` command do?
A) Starts the test server.
B) Generates new test files.
C) Compiles the test environment.
D) Runs the application's tests.
  • 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) Speed, scalability, and maintainability.
C) Large community support and extensive documentation.
D) Easy integration with other programming languages.
  • 17. Which function is typically used to render a template within a controller?
A) render/2
B) display/2
C) view/2
D) template/2
  • 18. What is a HEEx template?
A) A Phoenix template that uses HTML-aware syntax.
B) A compiled EEx template.
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 install Ecto after creating a project.
B) To update Ecto to the latest version.
C) To remove Ecto from an existing project.
D) To generate a Phoenix project with Ecto pre-configured.
  • 20. Which file defines the application's supervisors?
A) config/config.exs
B) lib/my_app_web/endpoint.ex
C) web/router.ex
D) lib/my_app/application.ex
  • 21. What is the purpose of a Context in a Phoenix application?
A) To encapsulate business logic.
B) To define database schemas.
C) To handle HTTP requests.
D) To render HTML templates.
  • 22. What is the purpose of the `with` statement in Elixir?
A) To declare a variable.
B) To define a loop.
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 the connection information for an incoming HTTP request.
B) Represents a user session.
C) Represents a database connection.
D) Represents a channel connection.
  • 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 single HTML template.
C) Generates a database migration.
D) Generates a new Phoenix project.
  • 25. What is a LiveView?
A) A server-rendered interactive web application built with Phoenix.
B) A database management tool.
C) A client-side JavaScript framework.
D) A code editor plugin.
  • 26. What is the purpose of `push_event` in LiveView?
A) Publishes an event to a PubSub topic.
B) Sends an event from the client to the server.
C) Triggers a database migration.
D) Sends an event from the server to the client.
  • 27. What does `mix format` do?
A) Runs the project's tests.
B) Formats the project's Elixir code.
C) Generates new project files.
D) Compiles the project's Elixir code.
  • 28. What is PubSub in Phoenix?
A) A library for publish-subscribe messaging.
B) A database connection pool.
C) A code formatting tool.
D) A testing framework.
  • 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) get "/", PageController, :index
D) root PageController, :index
Created with That Quiz — where a math practice test is always one click away.