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

Multiple choice

Which HTML element is used to define the main content of a web page?

  1. <body>

  2. <head>

  3. <title>

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

Which CSS property is used to set the background color of an element?

  1. background-color

  2. color

  3. background-image

  4. background-position

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

Which HTML element is used to create a link to another web page?

  1. <a>

  2. <link>

  3. <script>

  4. <img>

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

Which CSS property is used to set the font of an element?

  1. font-family

  2. font-size

  3. font-weight

  4. font-style

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

Which JavaScript function is used to get the value of an input field?

  1. getValue()

  2. getInputValue()

  3. getElementById()

  4. querySelector()

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

Which HTML element is used to create a heading?

  1. <h1>

  2. <h2>

  3. <h3>

  4. <h4>

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

Which JavaScript function is used to add an event listener to an element?

  1. addEventListener()

  2. attachEvent()

  3. onclick()

  4. onmouseover()

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

Which international standard provides guidelines for web accessibility?

  1. ISO 9241-11

  2. WCAG 2.0

  3. IEEE 1074-1995

  4. ANSI/HFES 100-2007

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

What is the correct syntax for accessing a property of an object in JavaScript?

  1. objectName.propertyName

  2. objectName['propertyName']

  3. Both of the above

  4. None of the above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

What is the correct syntax for calling a method of an object in JavaScript?

  1. objectName.methodName()

  2. objectName'methodName'

  3. Both of the above

  4. None of the above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

What is the default value of the align-items property?

  1. flex-start

  2. flex-end

  3. center

  4. baseline

  5. stretch

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

What is the bind() method in JavaScript?

  1. It creates a new function that, when called, has its this keyword set to the provided value.

  2. It creates a new function that, when called, has its arguments pre-filled with the provided values.

  3. It creates a new function that, when called, has its return value set to the provided value.

  4. None of the above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

What is the apply() method in JavaScript?

  1. It calls a function with a given this value and arguments provided as an array.

  2. It calls a function with a given this value and arguments provided as individual parameters.

  3. It calls a function with a given this value and no arguments.

  4. None of the above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

What is the call() method in JavaScript?

  1. It calls a function with a given this value and arguments provided as individual parameters.

  2. It calls a function with a given this value and arguments provided as an array.

  3. It calls a function with a given this value and no arguments.

  4. None of the above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice

What is the difference between the bind(), apply(), and call() methods in JavaScript?

  1. The bind() method creates a new function, while the apply() and call() methods call an existing function.

  2. The apply() method takes an array of arguments, while the call() method takes individual arguments.

  3. The bind() method can only be used with arrow functions, while the apply() and call() methods can be used with any function.

  4. None of the above

Reveal answer Fill a bubble to check yourself
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.