Here are 25 multiple-choice questions (MCQs) covering HTML, CSS, and JavaScript for practice:
HTML Questions (1-8)
What does HTML stand for?
a) Hyper Text Markup Language
b) High Tech Markup Language
c) Hyperlinks and Text Markup Language
d) Home Tool Markup Language
Answer: a) Hyper Text Markup LanguageWhich tag is used to define an unordered list in HTML?
a)<ol>
b)<ul>
c)<li>
d)<list>
Answer: b)<ul>What is the correct HTML element for inserting a line break?
a)<break>
b)<lb>
c)<br>
d)<line>
Answer: c)<br>Which attribute is used to specify a unique ID for an HTML element?
a)class
b)id
c)name
d)type
Answer: b)idWhich HTML5 element is used for playing video files?
a)<media>
b)<video>
c)<movie>
d)<play>
Answer: b)<video>What is the purpose of the
<meta>tag in HTML?
a) To define a paragraph
b) To store data for server-side use
c) To provide metadata about the document
d) To create a hyperlink
Answer: c) To provide metadata about the documentWhich HTML tag is used to define a table row?
a)<tr>
b)<td>
c)<th>
d)<table>
Answer: a)<tr>What does the
altattribute in an<img>tag do?
a) Sets the image alignment
b) Provides alternative text if the image fails to load
c) Defines the image source
d) Specifies image dimensions
Answer: b) Provides alternative text if the image fails to load
CSS Questions (9-16)
What does CSS stand for?
a) Computer Style Sheets
b) Creative Style Sheets
c) Cascading Style Sheets
d) Colorful Style Sheets
Answer: c) Cascading Style SheetsWhich property is used to change the text color of an element?
a)font-color
b)text-color
c)color
d)text-style
Answer: c)colorHow do you select an element with the ID "header" in CSS?
a)#header
b).header
c)header
d)*header
Answer: a)#headerWhich CSS property controls the space between elements' borders?
a)padding
b)margin
c)spacing
d)border-space
Answer: b)marginWhat is the default value of the
positionproperty in CSS?
a)fixed
b)absolute
c)relative
d)static
Answer: d)staticWhich CSS property is used to make text bold?
a)font-weight
b)text-bold
c)bold
d)font-style
Answer: a)font-weightHow do you apply a style to all
<p>elements inside a<div>?
a)div + p
b)div.p
c)div p
d)div > p
Answer: c)div pWhich CSS property is used to add rounded corners?
a)border-radius
b)corner-radius
c)round-corner
d)border-style
Answer: a)border-radius
JavaScript Questions (17-25)
Which keyword is used to declare a variable in JavaScript?
a)var
b)let
c)const
d) All of the above
Answer: d) All of the aboveWhat will
console.log(typeof 42)output?
a)"number"
b)"string"
c)"integer"
d)"float"
Answer: a)"number"Which method adds an element to the end of an array?
a)array.push()
b)array.pop()
c)array.shift()
d)array.unshift()
Answer: a)array.push()What does the
===operator check?
a) Value only
b) Value and type
c) Type only
d) Neither
Answer: b) Value and typeHow do you write an
ifstatement in JavaScript?
a)if (x == 5)
b)if x = 5
c)if x == 5 then
d)if x === 5
Answer: a)if (x == 5)What is the output of
"5" + 2in JavaScript?
a)7
b)"52"
c)Error
d)"7"
Answer: b)"52"(string concatenation)Which event occurs when a user clicks an HTML element?
a)onhover
b)onclick
c)onchange
d)onload
Answer: b)onclickWhat does
document.getElementById("demo")do?
a) Gets an element with class "demo"
b) Gets an element with ID "demo"
c) Gets all elements with tag "demo"
d) None of the above
Answer: b) Gets an element with ID "demo"How do you declare a function in JavaScript?
a)function myFunction() {}
b)def myFunction() {}
c)func myFunction() {}
d)function = myFunction() {}
Answer: a)function myFunction() {}
These questions cover fundamental concepts in HTML, CSS, and JavaScript and are great for practice!
No comments:
Post a Comment