0% found this document useful (0 votes)
4 views

Lecture 5

Uploaded by

umarmalikk64
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lecture 5

Uploaded by

umarmalikk64
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Multiple Choice Questions (MCQs):

1. What does CSS stand for?


o A) Color Style Sheet
o B) Cascading Style Sheet
o C) Computer Style Sheet
o D) Content Style Sheet
o Answer: B) Cascading Style Sheet
2. Who created CSS?
o A) Tim Berners-Lee
o B) Mark Zuckerberg
o C) Håkon Lie
o D) Brendan Eich
o Answer: C) Håkon Lie
3. Which of the following is an advantage of CSS?
o A) Slower development time
o B) Consistency in appearance
o C) Limited control over layout
o D) Requires more code repetition
o Answer: B) Consistency in appearance
4. In CSS, what is an “inline style” used for?
o A) Defining styles in an external file
o B) Applying styles to multiple elements
o C) Styling a single element directly in the HTML tag
o D) Applying styles across all web pages
o Answer: C) Styling a single element directly in the HTML tag
5. How is an external CSS file linked to an HTML document?
o A) Using the <script> tag
o B) Using the <link> tag
o C) Using the <embed> tag
o D) Using the <include> tag
o Answer: B) Using the <link> tag
6. Which of these CSS methods is ideal for a consistent style across multiple pages?
o A) Inline style
o B) Internal style
o C) External style
o D) Dynamic style
o Answer: C) External style
7. What is the correct syntax for creating a CSS rule?
o A) property : value;
o B) selector { property: value; }
o C) <selector> property: value;
o D) selector property: value;
o Answer: B) selector { property: value; }
8. What is the primary difference between an ID and a Class in CSS?
o A) An ID can be used on multiple elements; a Class is unique.
o B) A Class can be used on multiple elements; an ID is unique.
o C) Both are always unique in a document.
o D) Both can be used on multiple elements.
o Answer: B) A Class can be used on multiple elements; an ID is unique.
9. Which of the following is used to create dynamic effects on a webpage with CSS?
o A) JavaScript
o B) PHP
o C) HTML
o D) SQL
o Answer: A) JavaScript
10. In the following CSS rule, what is color? p { color: blue; }
o A) Selector
o B) Property
o C) Value
o D) Style
o Answer: B) Property

Short Answer Questions:

1. What is the purpose of CSS?


o CSS is used to control the presentation of HTML elements on a web page, making
content visually attractive and consistent.
2. Why is CSS called a "cascading" style sheet?
o It’s called "cascading" because styles can be applied in layers, with priority given
to different sources (like inline, internal, and external styles).
3. Explain the role of a selector in a CSS rule.
o A selector identifies the HTML element(s) to which the CSS rule will apply, such
as p for paragraphs.
4. What are the advantages of using CSS?
o CSS saves time, keeps style consistency, simplifies change management, provides
more control over layout, and allows dynamic effects with JavaScript.
5. What is an inline style?
o Inline style is CSS written directly in an HTML tag to style that specific element
only.
6. How do you link an external CSS file to an HTML document?
o You link an external CSS file using the <link> tag in the HTML <head> section,
with attributes like href, rel, and type.
7. When would you use an ID instead of a Class in CSS?
o An ID is used when styling a single, unique element on a page, whereas a class
can style multiple elements.
8. What is the difference between internal and external CSS?
o Internal CSS is defined in the <style> section of an HTML document, applying
only to that page, while external CSS is in a separate file and can style multiple
pages.
9. Give an example of a CSS rule for an <h1> tag with a green color and a font size of
36px.
o h1 { color: green; font-size: 36px; }
10. Why is it beneficial to keep styles in an external CSS file?
o Keeping styles in an external CSS file allows for a consistent look across multiple
pages and makes updating styles more efficient.

You might also like