Trend.NXT HTML5 Mock Test

The name part of the name/value pair associated with this element for the purposes of form submission. Ⓘ disabled = 'disabled' or ' (empty string) or empty # Specifies that the element represents a disabled control. Ⓘ form = ID reference NEW # The value of the id attribute on the form with which to associate the element. Mar 01, 2017  The element specifies a key-pair generator field in a form. When the form is submitted, two keys are generated, one private and one public. The private key is stored locally, and the public key is sent to the server. The public key could be used to generate a client certificate to authenticate the user in the future.

  1. HTML5 browsers support which technology?

    • CSS2
    • CSS3
    • CSS1
    • CSS2.5
  2. Which HTML5 form attribute is used to instruct browser automatically complete values based on values that the user has entered before

    • Autoaction
    • Autofocus
    • Autocomplete
    • Autovalidate
  3. Which HTML5 attribute specifies the URL of a file that will process the input control when the form is submitted

    • Formaction
    • Formenctype
    • Formmethod
    • Formvalidate
  4. What is the HTML5 syntax to enable autocomplete feature?

    • <input type = “text” name = “creditcardno” autocomplete = “1”>
    • <input type = “text” name = “creditcardno” autocomplete = “on”>
    • <input type = “text” name = “creditcardno” autocomplete = “true”>
    • <input type = “text” name = “creditcardno” autocomplete = “enable”>
  5. HTML5 attribute that specifies that an input field must be filled out before submitting the form

    • Regular expression
    • Mandatory
    • Validate
    • Required
  6. Correct syntax in HTML5 for designing a telephone number field?

    • <input type = “telephone” name = “telephone”>
    • <input type = “tel” name = “telephone”>
    • <input type = “tele” name = “telephone”>
    • <input type = “phone” name = “telephone”>
  7. In HTML5, ------- tag is not supported?

    • Code
    • <basefont>
    • Base
    • Canvas
  8. Which HTML5 input type allows users to select a date and time with time zone?

    • Datetime
    • Datetime-local
    • Datetime-timezone
    • Datetime-zone
  9. Below is new HTML5 input type

    • Search
    • Block
    • Layout
    • List
  10. Which HTML5 input type allows a user to select a year and week

    • Input type = “yearandweek”
    • Input type = “weekandyear”
    • Input type = “weekyear”
    • Input type = “week”
  11. What type the input field has to be to contain email address

    • Email
    • Datetime-local
    • Datetime
    • Html
  12. How many video formats supported for <video> element

    • 4
    • 2
    • 3
    • 1
  13. How many audio formats supported for <audio> element

    • 4
    • 2
    • 3
    • 1
  14. Track tag

  15. Preload attribute of Audio tag

  16. Which is not semantic

    • <form>
    • <table>
    • <img>
    • <div>
  17. The sims complete collection key generator. In HTML5, semantic element is used for defining marking or highlighting text?

    • <highlight>
    • <mark>
    • <markup>
    • <marktext>
  18. Which HTML5 element is used to define a caption for <figure> element?

    • <figtext>
    • <figurecaption>
    • <figcaption>
    • <figuretext>
  19. To draw straight lines on canvas, which methods are used?

    • moveTo(x,y) and lineTo(x,y)
    • moveTo(x,y)
    • moveTo(x,y) and strokeText(x,y)
    • lineTo(x,y)
  20. Which element in HTML5 is used to draw graphics?

    • <canvas>
    • <video>
    • <svg>
    • <audio>
  21. Which method in canvas is used to create a rectangle?

    • Rectangle(x,y,width,height)
    • Rect (x,y,width,height)
    • CreateRect (x,y,width,height)
    • CreateRectangle(x,y,width,height)
  22. Transformations in HTML5 are applied using

    • Transform
    • Canvas
    • Geolocation
    • Web Storage
  23. Which tag specifies a key-pair generator field in a form

    • <output>
    • <datalist>
    • <keygen>
    • <input>
  24. Where the keys are stored which has been generated using <keygen> element?

    • Private key is stored locally. public key is sent to the client
    • Private key is stored in server. public key is stored locally
    • Private key is sent to the client. public key is stored locally
    • Private key is stored locally. public key is sent to the server
  25. Use of <embed> tag?

    • Used to embed plugin
    • Used to embed text
    • Used to embed canvas
    • Used to embed JS
  26. Which tag defines a caption for <figure> element?

    • <form>
    • <figure>
    • <figcaption>
    • <output>
  27. Elements which are not supported in HTML5?

    • <font>
    • <q>
    • <menu>
    • <ins>
  28. Doom cd key generator tooent. HTML5 is a cooperation between WWW Consortium and

    • XML
    • XAML
    • HTML
    • WHATWG
  29. Which tag is obsolete and not supported in HTML5?

    • <dd>
    • <br>
    • <b>
    • <big>
  30. Out of following options, which is new element in HTML5?

    • <noframes>
    • <site>
    • <div>
    • <canvas>

HTML Form Example

Try it Yourself »

The <form> Element

The HTML <form> element defines a form that is used to collect user input:

An HTML form contains form elements.

Form elements are different types of input elements, like: text fields, checkboxes, radio buttons, submit buttons, and more.

The <input> Element

The <input> element is the most important form element.

The <input> element is displayed in several ways, depending on the type attribute.

Here are some examples:

TypeDescription
<input type='text'>Defines a single-line text input field
<input type='radio'>Defines a radio button (for selecting one of many choices)
<input type='submit'>Defines a submit button (for submitting the form)

You will learn a lot more about input types later in this tutorial.

Text Fields

<input type='text'> defines a single-line input field for text input.

Example

A form with two text input fields:

<form>
<label for='fname'>First name:</label><br>
<input type='text' name='fname'><br>
<label for='lname'>Last name:</label><br>
<input type='text' name='lname'>
</form>
Try it Yourself »

This is how it will look like in a browser:

Note: The form itself is not visible. Also note that the default width of an input field is 20 characters.

The <label> Element

Notice the use of the <label> element in the example above.

The <label> tag defines a label for many form elements.

The <label> element is useful for screen-reader users, because the screen-reader will read out load the label when the user is focused on the input element.

The <label> element also help users who have difficulty clicking on very small regions (such as radio buttons or checkboxes) - because when the user clicks the text within the <label> element, it toggles the radio button/checkbox.

The for attribute of the <label> tag should be equal to the id attribute of the <input> element to bind them together.

Radio Buttons

<input type='radio'> defines a radio button.

Radio buttons let a user select ONE of a limited number of choices.

Example

A form with radio buttons:

<form>
<input type='radio' name='gender' value='male'>
<label for='male'>Male</label><br>
<input type='radio' name='gender' value='female'>
<label for='female'>Female</label><br>
<input type='radio' name='gender' value='other'>
<label for='other'>Other</label>
</form>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:



The Submit Button

<input type='submit'> defines a button for submitting the form data to a form-handler.

The form-handler is typically a page on the server with a script for processing input data.

The form-handler is specified in the form's action attribute.

Example

A form with a submit button:

<form action='/action_page.php'>
<label for='fname'>First name:</label><br>
<input type='text' name='fname' value='John'><br>
<label for='lname'>Last name:</label><br>
<input type='text' name='lname' value='Doe'><br><br>
<input type='submit' value='Submit'>
</form>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:

The Action Attribute

The action attribute defines the action to be performed when the form is submitted.

Usually, the form data is sent to a page on the server when the user clicks on the submit button.

In the example above, the form data is sent to a page on the server called '/action_page.php'. This page contains a server-side script that handles the form data:

If the action attribute is omitted, the action is set to the current page.

The Target Attribute

The target attribute specifies if the submitted result will open in a new browser tab, a frame, or in the current window.

The default value is '_self' which means the form will be submitted in the current window.

To make the form result open in a new browser tab, use the value '_blank'.

Example

Here, the submitted result will open in a new browser tab:

Try it Yourself »

Other legal values are '_parent', '_top', or a name representing the name of an iframe.

The Method Attribute

The method attribute specifies the HTTP method (GET or POST) to be used when submitting the form data.

Example

Use the GET method when submitting the form:

Try it Yourself »

or:

Example

Use the POST method when submitting the form:

Try it Yourself »

When to Use GET?

The default HTTP method when submitting form data is GET.

However, when GET is used, the form data will be visible in the page's address field:

Which Tag Specifies A Key-pair Generator Field In A Form Pdf

Notes on GET:

  • Appends form-data into the URL in name/value pairs
  • The length of a URL is limited (2048 characters)
  • Never use GET to send sensitive data! (will be visible in the URL)
  • Useful for form submissions where a user wants to bookmark the result
  • GET is better for non-secure data, like query strings in Google

When to Use POST?

Always use POST if the form data contains sensitive or personal information. The POST method does not display the form data in the page address field.

Notes on POST:

  • POST has no size limitations, and can be used to send large amounts of data.
  • Form submissions with POST cannot be bookmarked

The Name Attribute

Each input field must have a name attribute to be submitted.

If the name attribute is omitted, the data of that input field will not be sent at all.

Example

This example will not submit the value of the 'First name' input field:

<form action='/action_page.php'>
<label for='fname'>First name:</label><br>
<input type='text' value='John'><br><br>
<input type='submit' value='Submit'>
</form>
Try it Yourself »

Which Tag Specifies A Key-pair Generator Field In A Form Pdf

HTML Exercises

Here is the list of all <form> attributes:

AttributeDescription
accept-charsetSpecifies the charset used in the submitted form (default: the page charset).
actionSpecifies an address (url) where to submit the form (default: the submitting page).
autocompleteSpecifies if the browser should autocomplete the form (default: on).
enctypeSpecifies the encoding of the submitted data (default: is url-encoded).
methodSpecifies the HTTP method used when submitting the form (default: GET).
nameSpecifies a name used to identify the form (for DOM usage: document.forms.name).
novalidateSpecifies that the browser should not validate the form.
targetSpecifies the target of the address in the action attribute (default: _self).

Which Tag Specifies A Key-pair Generator Field In A Form Download

You will learn more about the form attributes in the next chapters.

Which Tag Specifies A Key-pair Generator Field In A Form Free


Coments are closed
Scroll to top