Computer Knowledge
Markup and Web Languages
1,492 Questions
Test your understanding of HTML tags, XML structures, and web page creation technologies. The questions cover elements like CSS styling, parsing documents, and defining web attributes. This section is essential for candidates appearing for computer proficiency tests in various competitive exams.
HTML tags and attributesXML document parsingCSS styling levelsWeb page creation basicsBrowser compatibility
Markup and Web Languages Questions
Which HTML element is used to define the main content of a web page?
A
Correct answer
Explanation
The `` element is used to define the main content of a web page. It contains all the elements that are visible to the user, such as text, images, and links.
Which CSS property is used to set the background color of an element?
-
background-color
-
color
-
background-image
-
background-position
A
Correct answer
Explanation
The background-color property is used to set the background color of an element. It can be set to a color name, a hexadecimal color code, or an RGB color value.
Which HTML element is used to create a link to another web page?
-
<a>
-
<link>
-
<script>
-
<img>
A
Correct answer
Explanation
The <a> element is used to create a link to another web page. It has a href attribute that specifies the URL of the web page to link to.
Which CSS property is used to set the font of an element?
-
font-family
-
font-size
-
font-weight
-
font-style
A
Correct answer
Explanation
The font-family property is used to set the font of an element. It can be set to a font name, a generic font family name, or a system font name.
Which JavaScript function is used to get the value of an input field?
-
getValue()
-
getInputValue()
-
getElementById()
-
querySelector()
D
Correct answer
Explanation
The querySelector() function is used to get the value of an input field. It takes a CSS selector as an argument and returns the first element that matches the selector.
Which HTML element is used to create a heading?
A
Correct answer
Explanation
The <h1> element is used to create a heading. It is the most important heading element and should be used for the main title of a web page.
Which JavaScript function is used to add an event listener to an element?
-
addEventListener()
-
attachEvent()
-
onclick()
-
onmouseover()
A
Correct answer
Explanation
The addEventListener() function is used to add an event listener to an element. It takes two arguments: the event type and the event handler function.
Which international standard provides guidelines for web accessibility?
-
ISO 9241-11
-
WCAG 2.0
-
IEEE 1074-1995
-
ANSI/HFES 100-2007
B
Correct answer
Explanation
WCAG 2.0 (Web Content Accessibility Guidelines) is an international standard that provides guidelines for making web content accessible to people with disabilities.
What is the correct syntax for accessing a property of an object in JavaScript?
-
objectName.propertyName
-
objectName['propertyName']
-
Both of the above
-
None of the above
C
Correct answer
Explanation
In JavaScript, you can access a property of an object using the dot (.) operator or the square bracket ([]) notation. The dot operator is used when the property name is a valid JavaScript identifier, while the square bracket notation is used when the property name is not a valid JavaScript identifier.
What is the correct syntax for calling a method of an object in JavaScript?
-
objectName.methodName()
-
objectName'methodName'
-
Both of the above
-
None of the above
C
Correct answer
Explanation
In JavaScript, you can call a method of an object using the dot (.) operator or the square bracket ([]) notation. The dot operator is used when the method name is a valid JavaScript identifier, while the square bracket notation is used when the method name is not a valid JavaScript identifier.
What is the default value of the align-items property?
-
flex-start
-
flex-end
-
center
-
baseline
-
stretch
E
Correct answer
Explanation
The default value of the align-items property is stretch, which means that flex items are stretched to fill the entire height of the flex container.
What is the bind() method in JavaScript?
-
It creates a new function that, when called, has its this keyword set to the provided value.
-
It creates a new function that, when called, has its arguments pre-filled with the provided values.
-
It creates a new function that, when called, has its return value set to the provided value.
-
None of the above
A
Correct answer
Explanation
The bind() method in JavaScript creates a new function that, when called, has its this keyword set to the provided value. This is useful for creating functions that can be called with a specific context.
What is the apply() method in JavaScript?
-
It calls a function with a given this value and arguments provided as an array.
-
It calls a function with a given this value and arguments provided as individual parameters.
-
It calls a function with a given this value and no arguments.
-
None of the above
A
Correct answer
Explanation
The apply() method in JavaScript calls a function with a given this value and arguments provided as an array. This is useful for calling functions with a specific context and arguments.
What is the call() method in JavaScript?
-
It calls a function with a given this value and arguments provided as individual parameters.
-
It calls a function with a given this value and arguments provided as an array.
-
It calls a function with a given this value and no arguments.
-
None of the above
A
Correct answer
Explanation
The call() method in JavaScript calls a function with a given this value and arguments provided as individual parameters. This is useful for calling functions with a specific context and arguments.
What is the difference between the bind(), apply(), and call() methods in JavaScript?
-
The bind() method creates a new function, while the apply() and call() methods call an existing function.
-
The apply() method takes an array of arguments, while the call() method takes individual arguments.
-
The bind() method can only be used with arrow functions, while the apply() and call() methods can be used with any function.
-
None of the above
A
Correct answer
Explanation
The bind() method creates a new function that, when called, has its this keyword set to the provided value. The apply() and call() methods call an existing function with a given this value and arguments.