Fundamental of HTML
1. What does HTML stand for?
a) Hypertext Markup Language
b) Hyper Transfer Markup Language
c) Hyper Technical Markup Language
d) Hyper Touch Markup Language
Explanation: The correct answer is (a) Hypertext Markup Language. HTML is a markup language used for creating web pages and applications.
2.Which HTML tag is used to define a hyperlink?
a) <link>
b) <href>
c) <a>
d) <img>
Answer :(c)
Explanation: The correct answer is (c) <a>. The <a> tag is used to define a hyperlink in HTML. The href attribute is used to specify the URL of the page to which the link goes.
3.Which HTML tag is used to define a heading?
a) <p>
b) <head>
c) <title>
d) <h1>
Answer :(d)
Explanation: The correct answer is (d) <h1>. The <h1> tag is used to define a heading in HTML. The heading can range from h1 to h6, with h1 being the largest and h6 being the smallest.
4.Which HTML tag is used to display an image?
a) <image>
b) <img>
c) <picture>
d) <figure>
Answer :(b)
Explanation: The correct answer is (b) <img>. The <img> tag is used to display an image in HTML. The src attribute is used to specify the URL of the image.
5.Which HTML attribute is used to define the width of a table?
a) width
b) size
c) style
d) color
Answer :(a)
Explanation: The correct answer is (a) width. The width attribute is used to define the width of a table in HTML.
6.Which HTML tag is used to define a paragraph?
a) <p>
b) <para>
c) <pg>
d) <text>
Answer :(a)
Explanation: The correct answer is (a) <p>. The <p> tag is used to define a paragraph in HTML.
7.Which HTML tag is used to define a list item?
a) <li>
b) <ul>
c) <ol>
d) <list>
Answer :(a)
Explanation: The correct answer is (a) <li>. The <li> tag is used to define a list item in HTML. It is used within the <ul> or <ol> tag, depending on whether the list is unordered or ordered.
8.Which HTML attribute is used to specify alternative text for an image?
a) alt
b) title
c) src
d) href
Answer :(a)
Explanation: The correct answer is (a) alt. The alt attribute is used to specify alternative text for an image in HTML. This text is displayed if the image cannot be loaded or if the user is using a screen reader.
9.Which HTML tag is used to define a table header?
a) <thead>
b) <th>
c) <tr>
d) <td>
Answer :(b)
Explanation: The correct answer is (b) <th>. The <th> tag is used to define a table header in HTML. It is used within the <thead> section of the table.
10.Which HTML tag is used to define a line break?
a) <lb>
b) <br>
c) <break>
d) <newline>
Answer :(b)
Explanation: The correct answer is (b) <br>. The <br> tag is used to define a line break in HTML. It is a self-closing tag, meaning it does not require a closing tag.
11.Which HTML tag is used to create a form?
a) <form>
b) <input>
c) <button>
d) <label>
Answer: b) first_place
Explanation: In Python, variable names must begin with a letter or underscore. They can then be followed by any combination of letters, numbers, and underscores. Therefore, option b) first_place is a valid variable name in Python. Option a) 1st_place is invalid because variable names cannot begin with a number. Option c) first-place is invalid because variable names cannot contain hyphens. Option d) FirstPlace is valid, but not the recommended convention as the convention for variable names in Python is lowercase_with_underscores.
11.What is the result of the following operation: 4 + 5.0?
a) 9
b) 9.0
c) 45
d) TypeError
Answer: b) 9.0
Explanation: In Python, when you add an integer to a float, the result will be a float. Therefore, the result of 4 + 5.0 would be 9.0.
12.What is the result of the following operation: 2 ** 3 ** 2?
a) 64
b) 512
c) 40353607
d) 134217728
Answer: d) 134217728
Explanation: In Python, exponentiation has right-to-left associativity. Therefore, the expression 3 ** 2 will be evaluated first, resulting in 9. Then, the expression 2 ** 9 will be evaluated, resulting in 512. Therefore, the final result is 512.
13.Which operator is used to check if two values are not equal in Python?
a) !=
b) ==
c) =
d) <>
Answer: a) !=
Explanation: The “!=” operator is used to check if two values are not equal in Python. For example, 5 != 3 would return True, because 5 is not equal to 3.
14.Which operator is used to concatenate two strings in Python?
a) +
b) –
c) *
d) /
Answer: a) +
Explanation: The plus operator (+) is used to concatenate two strings in Python. For example, “hello” + “world” would result in the string “helloworld”.
15.What is the result of the following operation: 10 // 3.0?
a) 3.33
b) 3
c) 3.0
d) 4
Answer: b) 3
Explanation: In Python, when you perform floor division on an integer and a float, the result will be a float. Therefore, the expression 10 // 3.0 would first perform floor division, resulting in 3, and then return the result as a float because one of the operands is a float.
16.Which operator is used to compare two values and return True if the first value is greater than the second value in Python?
a) >
b) <
c) ==
d) >=
Answer: a) >
Explanation: The greater than operator (>) is used to compare two values and return True if the first value is greater than the second value in Python. For example, 5 > 3 would return True, because 5 is greater than 3.
17.What is the result of the following operation: 7 / 2?
a) 3.5
b) 3
c) 4
d) 2
Answer: a) 3.5
Explanation: In Python, when you divide two integers, the result will be a float if the division results in a decimal. Therefore, the result of 7 / 2 would be 3.5.
Answer :(a)
Explanation: The correct answer is (a) width. The width attribute is used to define the width of a table in HTML.