The Action Attribute in HTML Forms: 16 MCQs

All 16 multiple-choice questions from this kit, free and with no sign-up.

Warm-up · 5 questions

Q1. What is the primary purpose of the `action` attribute on a `<form>` element?

Beginner
A To specify the URL where form data is sent on submission
B To validate the user's input before submission
C To define the HTTP method used to send the data
D To style the form's submit button

Answers and explanations are in the Veda app.

Q2. A developer writes `<form action="/process.php" method="post">`. Where will the form data be sent?

Beginner
A To the current page's URL
B Nowhere, because the action is relative
C To the `/process.php` path on the same site
D To an external server at process.php

Answers and explanations are in the Veda app.

Q3. If a `<form>` tag has no `action` attribute, what does the browser do on submission?

Beginner
A Refuses to submit and shows an error
B Submits the data to the current page's URL
C Submits to a default server page called action.html
D Submits to the browser's homepage

Answers and explanations are in the Veda app.

Q4. Which attribute works together with `action` to fully define a form submission?

Beginner
A `enctype`
B `method`
C `name`
D `target`

Answers and explanations are in the Veda app.

Q5. The `action` attribute specifies the URL to which a form's data is submitted; if omitted, the browser submits to the current page's URL.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Building up · 6 questions

Q6. A student writes `action="submit"` expecting the browser to submit the form. What actually happens?

Intermediate
A The browser treats `submit` as a relative URL and tries to navigate to a page named `submit`.
B The browser recognizes `submit` as a command and submits the form normally.
C The browser throws a syntax error and blocks submission.
D The form submits to the current page automatically.

Answers and explanations are in the Veda app.

Q7. A login form has `action="http://example.com/login"`. What is the main security concern?

Intermediate
A Credentials are sent in plain text and can be intercepted.
B The server will reject the request due to the missing S.
C The browser will automatically upgrade the request to HTTPS.
D The form will not submit because HTTP is blocked.

Answers and explanations are in the Veda app.

Q8. Which of the following is a legitimate use of an empty `action` (`action=""`)?

Intermediate
A A form that sends data to an external API
B A form that should never be submitted
C A form that uses JavaScript only and never submits
D A page that both displays and processes a form, submitting back to itself

Answers and explanations are in the Veda app.

Q9. In the browser's form submission sequence, at which step does `action` participate?

Intermediate
A Encode — values are turned into a query string.
B Resolve — the action URL is resolved against the base URL.
C Collect — the browser gathers input values.
D Navigate — the browser displays the response.

Answers and explanations are in the Veda app.

Q10. A search form should produce results in the URL so users can bookmark them. Which pairing is best?

Intermediate
A `action="/search"` with `method="get"`
B `action="/search"` with `method="post"`
C `action=""` with `method="post"`
D `action="search"` with `method="get"`

Answers and explanations are in the Veda app.

Q11. A form submits but the server returns a 404. What is the most likely cause?

Intermediate
A The `action` URL points to a page or endpoint that does not exist.
B The `method` attribute is set to POST.
C The form has no submit button.
D The input fields are missing `name` attributes.

Answers and explanations are in the Veda app.

Topper level · 5 questions

Q12. Which statement best explains why `action` and `method` are not interchangeable?

Advanced
A `action` is optional, but `method` is required for submission.
B Both set the destination, but `method` also validates input.
C `action` sets the destination URL, while `method` sets how data travels (GET or POST).
D `action` sets the HTTP method, while `method` sets the URL.

Answers and explanations are in the Veda app.

Q13. A developer builds an `action` URL from a query parameter without validation. What risk does this introduce?

Advanced
A An attacker could redirect submissions to their own server.
B The form data will be automatically encrypted.
C The `method` attribute will be ignored.
D The browser will refuse to submit the form.

Answers and explanations are in the Veda app.

Q14. A form on `https://shop.example.com/checkout` has `action="pay.php"`. To what full URL will the data be sent?

Advanced
A `https://shop.example.com/pay.php`
B `https://shop.example.com/checkout/pay.php`
C `https://pay.php`
D `https://shop.example.com/checkout`

Answers and explanations are in the Veda app.

Q15. Which statement about `action` is correct?

Advanced
A It runs JavaScript on the destination page automatically.
B It does not validate input, run JavaScript, or guarantee the destination exists.
C It guarantees the destination endpoint is reachable.
D It validates input before sending data to the server.

Answers and explanations are in the Veda app.

Q16. A developer is creating a form with `action` set to a relative URL and `method` set to `POST`. The form is intended to submit user credentials to a secure server. However, the developer mistakenly leaves the `action` attribute empty. What is the most likely outcome of this error?

Advanced
A The form will submit credentials to the current page, potentially exposing sensitive data.
B The form will redirect to the homepage after submission.
C The form will submit credentials to the server specified in the site's base URL.
D The form will throw an error and not submit at all.

Answers and explanations are in the Veda app.

Make your own

Your notes can be a kit like these

Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free to start, in more than 40 languages.

  • Chapter notes
  • Flashcards
  • Practice MCQs
  • Scored tests
  • Paper Solver

Get Veda free See what students get

Free to start · Android app and web · More than 40 languages