MCQs Of Class 10: Forms in HTML - Part 1

Rashmi Mishra
0

 

MCQs Of Class 10
Forms in HTML - Part 1

1.    What is the purpose of the <form> element in HTML?

o    A) To display text

o    B) To create interactive forms for user input

o    C) To insert images

o    D) To define document metadata

Answer: B) To create interactive forms for user input

2.    Which attribute specifies the URL where form data will be sent upon submission?

o    A) method

o    B) action

o    C) enctype

o    D) target

Answer: B) action

3.    Which of the following is the correct syntax for creating a text input field?

o    A) <input type="text" name="username">

o    B) <text name="username">

o    C) <input name="username" type="text">

o    D) <input type="username" text>

Answer: A) <input type="text" name="username">

4.    What is the default method for sending form data?

o    A) GET

o    B) POST

o    C) PUT

o    D) DELETE

Answer: A) GET

5.    How can you make an input field required in an HTML form?

o    A) Add required attribute

o    B) Add mandatory attribute

o    C) Add validate attribute

o    D) Add need attribute

Answer: A) Add required attribute

6.    Which input type is used for passwords?

o    A) text

o    B) password

o    C) hidden

o    D) email

Answer: B) password

7.    What does the <label> element do in a form?

o    A) Provides a description or label for form controls

o    B) Defines the form action URL

o    C) Specifies the form method

o    D) Sets the form's target

Answer: A) Provides a description or label for form controls

8.    Which attribute is used to specify the method for sending form data?

o    A) method

o    B) action

o    C) enctype

o    D) target

Answer: A) method

9.    What is the purpose of the enctype attribute in a form?

o    A) Specifies the form action URL

o    B) Specifies the HTTP method for form submission

o    C) Specifies the encoding type for form data

o    D) Defines the target window for form submission

Answer: C) Specifies the encoding type for form data

10.                       Which attribute is used to define the placeholder text in an input field?

o    A) placeholder

o    B) value

o    C) label

o    D) hint

Answer: A) placeholder

11.                       How can you include a submit button in a form?

o    A) <input type="button" value="Submit">

o    B) <button type="submit">Submit</button>

o    C) <input type="submit" value="Submit">

o    D) <button type="button">Submit</button>

Answer: C) <input type="submit" value="Submit">

12.                       Which tag is used to create a dropdown list in a form?

o    A) <select>

o    B) <dropdown>

o    C) <list>

o    D) <option>

Answer: A) <select>

13.                       What is the purpose of the target="_blank" attribute in a form's link?

o    A) Opens the link in the same frame

o    B) Opens the link in a new tab or window

o    C) Opens the link in the parent frame

o    D) Opens the link in a new section

Answer: B) Opens the link in a new tab or window

14.                       Which input type is used to select a file from the user's system?

o    A) file

o    B) upload

o    C) document

o    D) image

Answer: A) file

15.                       What does the value attribute of an input element specify?

o    A) The default text displayed in the input field

o    B) The type of input field

o    C) The form's action URL

o    D) The method for submitting the form

Answer: A) The default text displayed in the input field

16.                       Which HTML element is used to group multiple form elements together for styling purposes?

o    A) <fieldset>

o    B) <group>

o    C) <section>

o    D) <div>

Answer: A) <fieldset>

17.                       What is the purpose of the name attribute in form elements?

o    A) To specify the URL where form data is sent

o    B) To identify the form element for server-side processing

o    C) To provide a default value for the form element

o    D) To define the method for form submission

Answer: B) To identify the form element for server-side processing

18.                       Which of the following attributes is used with the <input> element to specify a text box that spans multiple lines?

o    A) rows

o    B) cols

o    C) size

o    D) type

Answer: A) rows

19.                       How do you create a radio button group where only one option can be selected at a time?

o    A) Use the same name attribute for all radio buttons

o    B) Use different name attributes for each radio button

o    C) Use the multiple attribute

o    D) Use the checked attribute

Answer: A) Use the same name attribute for all radio buttons

20.                       Which attribute of the <input> element specifies the maximum number of characters that can be entered?

o    A) maxlength

o    B) size

o    C) length

o    D) limit

Answer: A) maxlength

21.                       What does the action attribute of the <form> element specify?

o    A) The location to redirect after form submission

o    B) The URL where the form data will be sent

o    C) The method used for form submission

o    D) The encoding type for form data

Answer: B) The URL where the form data will be sent

22.                       Which HTML element is used to create a text area input field?

o    A) <textarea>

o    B) <input type="text">

o    C) <textbox>

o    D) <field>

Answer: A) <textarea>

23.                       What does the autocomplete attribute of the <form> element control?

o    A) Whether form data is automatically filled in by the browser

o    B) The type of form submission

o    C) The alignment of form elements

o    D) The URL for form submission

Answer: A) Whether form data is automatically filled in by the browser

24.                       How do you specify that an input field is of type "email"?

o    A) <input type="text" name="email">

o    B) <input type="email" name="email">

o    C) <input type="address" name="email">

o    D) <input type="emailAddress" name="email">

Answer: B) <input type="email" name="email">

25.                       Which attribute of the <input> element is used to define a default value that appears in the input field?

o    A) default

o    B) placeholder

o    C) value

o    D) label

Answer: C) value

26.                       Which HTML element allows users to select multiple options from a list?

o    A) <select multiple>

o    B) <input type="checkbox">

o    C) <input type="radio">

o    D) <option multiple>

Answer: A) <select multiple>

27.                       Which input type creates a checkbox input field?

o    A) checkbox

o    B) radio

o    C) button

o    D) text

Answer: A) checkbox

28.                       What is the purpose of the method attribute in a form?

o    A) To specify the way form data is submitted to the server

o    B) To set the URL for form data submission

o    C) To define the type of input elements

o    D) To determine the form's visual appearance

Answer: A) To specify the way form data is submitted to the server

29.                       Which HTML element is used to provide a button that users can click to submit the form?

o    A) <input type="button">

o    B) <button type="submit">

o    C) <input type="submit">

o    D) <button type="click">

Answer: C) <input type="submit">

30.                       What does the placeholder attribute do in a text input field?

o    A) Displays a default value in the field

o    B) Shows a hint or example text within the input field

o    C) Limits the number of characters that can be entered

o    D) Sets the size of the input field

Answer: B) Shows a hint or example text within the input field

31.                       Which attribute is used with the <input> element to define a maximum number of characters that can be entered?

o    A) maxlength

o    B) maxchars

o    C) size

o    D) limit

Answer: A) maxlength

32.                       How do you create a form that sends data using the POST method?

o    A) <form method="post" action="url">

o    B) <form method="get" action="url">

o    C) <form method="submit" action="url">

o    D) <form action="url" method="post">

Answer: A) <form method="post" action="url">

33.                       Which attribute of the <input> element specifies that the field should only accept numerical input?

o    A) type="number"

o    B) type="text"

o    C) type="integer"

o    D) type="digits"

Answer: A) type="number"

34.                       Which HTML element is used to create a drop-down list?

o    A) <dropdown>

o    B) <select>

o    C) <list>

o    D) <option>

Answer: B) <select>

35.                       What is the correct way to create a multi-line text input field?

o    A) <input type="text" rows="5">

o    B) <textarea rows="5"></textarea>

o    C) <input type="textarea" rows="5">

o    D) <textarea></textarea>

Answer: B) <textarea rows="5"></textarea>

36.                       Which HTML element allows users to submit a form using a button?

o    A) <input type="submit">

o    B) <button type="submit">

o    C) Both A and B

o    D) <button>Submit</button>

Answer: C) Both A and B

37.                       What does the required attribute do in a form element?

o    A) Marks the field as optional

o    B) Specifies that the field must be filled out before form submission

o    C) Sets the default value for the field

o    D) Limits the number of characters allowed

Answer: B) Specifies that the field must be filled out before form submission

38.                       How do you create a fieldset to group related form elements?

o    A) <fieldset>

o    B) <group>

o    C) <section>

o    D) <container>

Answer: A) <fieldset>

39.                       Which attribute specifies that an input field should be hidden from the user?

o    A) type="hidden"

o    B) type="password"

o    C) type="text"

o    D) type="hiddenfield"

Answer: A) type="hidden"

40.                       How do you create a form that sends data to a server and reloads the page?

o    A) <form action="url" method="get">

o    B) <form action="url" method="post">

o    C) <form action="url" method="put">

o    D) <form action="url" method="delete">

Answer: A) <form action="url" method="get">

41.                       Which HTML attribute is used to provide additional information about a form field when hovered over?

o    A) tooltip

o    B) info

o    C) title

o    D) description

Answer: C) title

42.                       What is the purpose of the action attribute in the <form> element?

o    A) To specify the URL where the form data is sent

o    B) To define the method used for sending form data

o    C) To set the form’s visual style

o    D) To identify the form on the page

Answer: A) To specify the URL where the form data is sent

43.                       How can you specify multiple options in a drop-down list?

o    A) Use multiple <select> elements

o    B) Use multiple <option> elements within a single <select> element

o    C) Use multiple <input> elements

o    D) Use a single <option> element with multiple values

Answer: B) Use multiple <option> elements within a single <select> element

44.                       Which HTML tag is used to create a button that performs an action when clicked?

o    A) <button>

o    B) <input type="button">

o    C) Both A and B

o    D) <submit>

Answer: C) Both A and B

45.                       What attribute is used to specify a URL that will open when a link within a form is clicked?

o    A) href

o    B) src

o    C) action

o    D) url

Answer: A) href

46.                       Which HTML attribute specifies that an input field must be filled out before submitting the form?

o    A) mandatory

o    B) required

o    C) validate

o    D) necessary

Answer: B) required

47.                       Which attribute is used to set the default value of an input field?

o    A) default

o    B) value

o    C) placeholder

o    D) initial

Answer: B) value

48.                       What is the default value of the method attribute in the <form> element if not specified?

o    A) post

o    B) get

o    C) put

o    D) delete

Answer: B) get

49.                       Which HTML element is used to create a drop-down menu in a form?

o    A) <list>

o    B) <dropdown>

o    C) <select>

o    D) <menu>

Answer: C) <select>

50.                       What is the purpose of the name attribute in the <input> element?

o    A) To set the placeholder text

o    B) To identify the input field for form submission

o    C) To specify the type of input

o    D) To set the default value of the field

Answer: B) To identify the input field for form submission

51.                       Which attribute of the <input> element specifies that the input field should be a password field?

o    A) type="password"

o    B) type="hidden"

o    C) type="text"

o    D) type="secure"

Answer: A) type="password"

52.                       How do you create a form that allows users to upload files?

o    A) <form enctype="multipart/form-data" method="post">

o    B) <form enctype="text/plain" method="post">

o    C) <form enctype="application/x-www-form-urlencoded" method="post">

o    D) <form enctype="multipart/form-data" method="get">

Answer: A) <form enctype="multipart/form-data" method="post">

53.                       Which element is used to create a clickable button that performs an action in a form?

o    A) <button>

o    B) <input type="button">

o    C) <input type="submit">

o    D) Both A and B

Answer: D) Both A and B

54.                       How do you specify that an <input> field should only accept a specific set of characters?

o    A) pattern attribute

o    B) type attribute

o    C) maxlength attribute

o    D) validate attribute

Answer: A) pattern attribute

55.                       What does the action attribute of the <form> element define?

o    A) The method for form submission

o    B) The URL where the form data is sent

o    C) The type of form data encoding

o    D) The form's visual style

Answer: B) The URL where the form data is sent

56.                       Which HTML element is used to include a field for a user to select a date?

o    A) <input type="date">

o    B) <calendar>

o    C) <datepicker>

o    D) <input type="datetime">

Answer: A) <input type="date">

57.                       Which attribute specifies the way the browser should handle form data when the form is submitted?

o    A) method

o    B) action

o    C) encoding

o    D) type

Answer: A) method

58.                       What is the role of the placeholder attribute in an <input> element?

o    A) To define a default value for the input field

o    B) To provide a short hint or description inside the input field

o    C) To set the maximum number of characters

o    D) To specify the field's width

Answer: B) To provide a short hint or description inside the input field

59.                       Which attribute is used to specify that a <select> element should allow multiple selections?

o    A) multiple

o    B) select

o    C) choice

o    D) option

Answer: A) multiple

60.                       What is the purpose of the <label> element in a form?

o    A) To provide a caption or description for an input field

o    B) To define the method of form submission

o    C) To create a group of form elements

o    D) To set the width of the input field

Answer: A) To provide a caption or description for an input field

61.                       Which HTML element is used to create a form control that allows users to select a single item from a list?

o    A) <input>

o    B) <textarea>

o    C) <select>

o    D) <option>

Answer: C) <select>

62.                       How do you create a checkbox input field in HTML?

o    A) <input type="checkbox">

o    B) <input type="check">

o    C) <checkbox>

o    D) <input type="box">

Answer: A) <input type="checkbox">

63.                       What attribute is used to provide a default option for a drop-down menu?

o    A) default

o    B) selected

o    C) value

o    D) option

Answer: B) selected

64.                       Which attribute in the <input> element specifies the type of input field?

o    A) formtype

o    B) inputtype

o    C) type

o    D) fieldtype

Answer: C) type

65.                       How can you create a text area with a specified number of rows and columns?

o    A) <textarea rows="4" cols="50"></textarea>

o    B) <textarea size="4,50"></textarea>

o    C) <input type="text" rows="4" columns="50">

o    D) <textarea height="4" width="50"></textarea>

Answer: A) <textarea rows="4" cols="50"></textarea>

66.                       Which attribute specifies a URL for a form to submit data to when using a file upload input?

o    A) url

o    B) action

o    C) destination

o    D) submitto

Answer: B) action

67.                       What is the function of the accept attribute in an <input> element with type="file"?

o    A) To specify which file types are allowed to be uploaded

o    B) To define the size of the file

o    C) To set a default file to be uploaded

o    D) To define the location where the file will be saved

Answer: A) To specify which file types are allowed to be uploaded

68.                       Which HTML element allows users to select multiple options from a list?

o    A) <input type="select">

o    B) <select multiple>

o    C) <option multiple>

o    D) <checkbox>

Answer: B) <select multiple>

69.                       What does the name attribute in a form control represent?

o    A) The value of the form control

o    B) The label of the form control

o    C) The identifier used to reference form control data on the server

o    D) The type of form control

Answer: C) The identifier used to reference form control data on the server

70.                       How can you include a submit button in an HTML form?

o    A) <input type="submit">

o    B) <button type="submit">

o    C) <submit>

o    D) Both A and B

Answer: D) Both A and B

71.                       Which HTML tag creates a hidden input field that is not visible to the user?

o    A) <input type="hidden">

o    B) <input type="invisible">

o    C) <input type="secret">

o    D) <hidden>

Answer: A) <input type="hidden">

72.                       Which attribute of the <textarea> element specifies the number of visible text lines?

o    A) height

o    B) rows

o    C) size

o    D) columns

Answer: B) rows

73.                       How do you ensure that a form field must be filled out before form submission?

o    A) Use the mandatory attribute

o    B) Use the required attribute

o    C) Use the validate attribute

o    D) Use the empty attribute

Answer: B) Use the required attribute

74.                       Which HTML attribute specifies the action to be performed when a form is submitted?

o    A) action

o    B) method

o    C) target

o    D) enctype

Answer: A) action

75.                       What does the method attribute in the <form> element define?

o    A) The URL where the form data will be sent

o    B) The form's encoding type

o    C) The way the form data will be sent (GET or POST)

o    D) The visual style of the form

Answer: C) The way the form data will be sent (GET or POST)

76.                       Which attribute is used to provide additional information when a user hovers over a form control?

o    A) info

o    B) tooltip

o    C) title

o    D) description

Answer: C) title

77.                       What is the purpose of the action attribute in the <form> element?

o    A) To specify the URL where the form data will be sent

o    B) To specify the form's method

o    C) To define the form's encoding type

o    D) To create the form's visual style

Answer: A) To specify the URL where the form data will be sent

78.                       Which attribute allows you to set a pre-defined value in a form field?

o    A) value

o    B) placeholder

o    C) default

o    D) init

Answer: A) value

79.                       How can you create a radio button group in HTML?

o    A) Use multiple <input type="radio"> elements with the same name attribute

o    B) Use multiple <input type="checkbox"> elements with the same name attribute

o    C) Use a single <input type="radio"> element

o    D) Use a <select> element

Answer: A) Use multiple <input type="radio"> elements with the same name attribute

80.                       What does the multiple attribute in a <select> element do?

o    A) Allows the selection of multiple options

o    B) Sets a default option

o    C) Provides additional options

o    D) Limits the number of options

Answer: A) Allows the selection of multiple options

81.                       Which attribute is used to specify that a form field is read-only?

o    A) readonly

o    B) disabled

o    C) locked

o    D) editable

Answer: A) readonly

82.                       What is the purpose of the <fieldset> element in a form?

o    A) To group related elements within a form

o    B) To specify the form's encoding type

o    C) To create a clickable button

o    D) To define a section of the form for submission

Answer: A) To group related elements within a form

83.                       Which element is used to provide a description for a form control, typically associated with a <label> element?

o    A) <help>

o    B) <description>

o    C) <legend>

o    D) <info>

Answer: C) <legend>

84.                       How do you specify the maximum length of input text in an <input> element?

o    A) maxlength attribute

o    B) size attribute

o    C) length attribute

o    D) limit attribute

Answer: A) maxlength attribute

85.                       Which HTML element is used to create a multi-line text input field?

o    A) <input type="text">

o    B) <textarea>

o    C) <input type="textarea">

o    D) <field>

Answer: B) <textarea>

86.                       What does the enctype attribute in the <form> element specify?

o    A) The form's method of submission

o    B) The form's action URL

o    C) The encoding type for form data

o    D) The visual style of the form

Answer: C) The encoding type for form data

87.                       Which input type would you use for a form field that should accept a color?

o    A) <input type="color">

o    B) <input type="palette">

o    C) <input type="hex">

o    D) <input type="text">

Answer: A) <input type="color">

88.                       How can you ensure that an input field only accepts numeric values?

o    A) Use type="number"

o    B) Use type="text" with a pattern

o    C) Use type="integer"

o    D) Use type="digits"

Answer: A) Use type="number"

89.                       Which attribute in a <button> element specifies that the button is used to submit a form?

o    A) type="submit"

o    B) type="action"

o    C) type="button"

o    D) type="form"

Answer: A) type="submit"

90.                       What is the default value of the method attribute in the <form> element if it is not specified?

o    A) POST

o    B) GET

o    C) PUT

o    D) DELETE

Answer: B) GET

91.                       Which attribute of the <input> element specifies the placeholder text displayed when the field is empty?

o    A) hint

o    B) placeholder

o    C) caption

o    D) default

Answer: B) placeholder

92.                       How can you create a form control that allows users to input multiple email addresses?

o    A) <input type="email" multiple>

o    B) <input type="text" multiple>

o    C) <textarea>

o    D) <input type="list">

Answer: A) <input type="email" multiple>

93.                       Which HTML element is used to create a group of related checkboxes?

o    A) <group>

o    B) <fieldset>

o    C) <checkbox-group>

o    D) <options>

Answer: B) <fieldset>

94.                       What does the autocomplete attribute in a form control do?

o    A) Enables or disables the browser's autocomplete feature for the field

o    B) Automatically completes the form field's value

o    C) Sets a default value for the field

o    D) Specifies the number of characters allowed

Answer: A) Enables or disables the browser's autocomplete feature for the field

95.                       How do you create a form that sends data using the POST method?

o    A) <form method="post">

o    B) <form method="send">

o    C) <form action="post">

o    D) <form type="post">

Answer: A) <form method="post">

96.                       Which attribute is used to make a form control not interactable by the user?

o    A) disabled

o    B) readonly

o    C) inactive

o    D) uneditable

Answer: A) disabled

97.                       What is the purpose of the target attribute in the <form> element?

o    A) To specify where to open the response after form submission

o    B) To define the form's action URL

o    C) To set the form's method

o    D) To specify the form's encoding type

Answer: A) To specify where to open the response after form submission

98.                       Which HTML element is used to create a clickable button in a form that does not submit the form?

o    A) <button type="button">

o    B) <input type="button">

o    C) <input type="submit">

o    D) Both A and B

Answer: D) Both A and B

99.                       How can you specify that a form should be submitted when the user presses the Enter key?

o    A) By using a submit button with type="submit"

o    B) By adding an onsubmit event to the form

o    C) By setting the form's action attribute to the submit URL

o    D) By including a submit input element

Answer: A) By using a submit button with type="submit"

100.                 Which input type would you use to create a slider control in a form? - A) <input type="range"> - B) <input type="slider"> - C) <input type="scale"> - D) <input type="control">

Answer: A) `<input type="range">`


Tags

Post a Comment

0Comments

Post a Comment (0)