1. Which of the following best describes the purpose of Web Technology as covered in this course?
A) To only design HTML pages
B) To learn HTTP, HTML, CSS, JavaScript, PHP, and Client-Server architecture
C) To design only server-side applications
D) To understand mobile application development only
Correct: B
Explanation: Course objectives include HTTP, HTML, CSS, JS, PHP, and understanding Client-Server
applications.
2. In a Client-Server model, the server’s role is to:
A) Only display results
B) Host, deliver, and manage resources/services for clients
C) Always initiate requests
D) Act as a peer in a P2P network
Correct: B
Explanation: In client-server architecture, servers provide resources and services that clients request.
3. Which is NOT true about Peer-to-Peer (P2P) architecture?
A) Peers are equally privileged participants
B) Peers act as both clients and servers
C) Peers always connect through a central server
D) It partitions tasks among peers
Correct: C
Explanation: P2P does not require a central server — participants communicate directly.
4. The Internet can best be described as:
A) A system of interlinked hypertext documents
B) An application running on the WWW
C) A global network of interconnected computer networks using TCP/IP
D) A peer-to-peer chat system
Correct: C
Explanation: The Internet is the infrastructure; WWW is an application on top of it.
5. Which statement about WWW is correct?
A) It is another name for the Internet
B) It is a service running on the Internet providing hypertext documents
C) It is a protocol used for file transfer
D) It is a search engine
Correct: B
Explanation: WWW is an application on the Internet that uses protocols like HTTP to deliver hypertext
content.
6. Which is the correct sequence when viewing a web page?
A) DNS resolution → Browser sends HTTP request → Server sends response → Browser renders content
B) Browser sends HTTP request → DNS resolution → Browser renders content → Server sends response
C) Server sends response → Browser sends request → DNS resolution
D) DNS resolution → Server renders content → Browser sends HTTP request → Display
Correct: A
Explanation: DNS resolves domain → request sent → server responds → browser renders.
7. Which organization develops most WWW standards like HTML and XHTML?
A) ICANN
B) W3C
C) IETF
D) ISO
Correct: B
Explanation: The World Wide Web Consortium (W3C) develops web standards.
8. A Uniform Resource Identifier (URI) can contain:
A) Scheme, hierarchical part, query, fragment
B) Hostname, username, password, port
C) Protocol, MAC address, domain, resource name
D) Scheme, DNS record, subdomain, SSL certificate
Correct: A
Explanation: A URI structure: <scheme>:<hierarchical part>[?<query>][#<fragment>].
9. In the URI http://en.wikipedia.org/wiki/URI?page=2#Examples, what is page=2?
A) Fragment
B) Path
C) Query
D) Scheme
Correct: C
Explanation: Everything after ? is the query, containing key=value pairs.
10. HTTP is described as “connectionless” because:
A) It maintains a continuous open connection
B) Client and server know each other only during a single request-response cycle
C) It uses FTP for connections
D) The server remembers all previous requests
Correct: B
Explanation: HTTP opens a connection for each request/response, then closes it.
11. Which HTTP method is used to delete a resource on the server?
A) GET
B) POST
C) DELETE
D) PUT
Correct: C
Explanation: DELETE requests removal of the resource from the server.
12. HTML elements are represented by:
A) Commands in square brackets
B) Tags in angle brackets
C) Only CSS rules
D) Only JavaScript functions
Correct: B
Explanation: HTML uses tags like <h1> and <p> inside angle brackets.
13. Which statement is true about XML?
A) It is used for displaying data
B) It has predefined tags
C) It is self-descriptive and used to store/transport data
D) It must be viewed in a browser only
Correct: C
Explanation: XML is designed for storing/transporting data and defining custom tags.
14. Which of the following is NOT allowed in XML element names?
A) Letters
B) Numbers
C) Spaces
D) Underscores
Correct: C
Explanation: XML names cannot contain spaces.
15. XHTML differs from HTML mainly because XHTML:
A) Is not supported in browsers
B) Requires proper nesting and lowercase tags
C) Allows missing closing tags
D) Is less strict than HTML
Correct: B
Explanation: XHTML follows XML rules — proper nesting, lowercase, all tags closed.
16. The DOM is:
A) A markup language
B) A protocol for transferring data
C) A standard interface for accessing and manipulating document content
D) A JavaScript function library
Correct: C
Explanation: DOM represents a document as a tree structure, allowing programmatic access.
17. DHTML is different from HTML because DHTML:
A) Is static and non-interactive
B) Combines HTML, CSS, JS, and DOM to create dynamic pages
C) Uses only CSS styling
D) Is a replacement for JavaScript
Correct: B
Explanation: DHTML integrates HTML, CSS, JS, and DOM for interactive content.
18. Which of the following best represents the structure of a three-tier client-server architecture?
A) Client → Resource Manager → Database
B) Client → Application Server → Resource Manager
C) Server → Application Server → Database
D) Client → Client → Server
Correct: B
Explanation: Three-tier: client (UI), application server (business logic), resource manager (data storage).
19. In P2P architecture, peers are described as:
A) Hierarchical participants
B) Equally privileged and equipotent
C) Dependent on a central coordinator
D) Only consumers of resources
Correct: B
Explanation: Peers can act as both clients and servers with equal capabilities.
20. Which step comes first when you type a web address into a browser?
A) HTTP request is sent
B) DNS resolves the server name to an IP address
C) The page is rendered
D) TCP connection is closed
Correct: B
Explanation: Domain name is first translated to IP via DNS.
21. Which is NOT part of the URI structure?
A) Query
B) Path
C) Fragment
D) Protocol version
Correct: D
Explanation: Protocol version is not part of the URI syntax.
22. In a URI, the fragment part:
A) Identifies the resource location
B) Points to a secondary resource, such as a section in a document
C) Must be included in all URIs
D) Contains authentication information
Correct: B
Explanation: Fragment follows # and refers to a specific location inside the resource.
23. HTTP is stateless because:
A) Data is encrypted during transfer
B) Server and client forget each other after each request
C) TCP connections are reused
D) It uses cookies for memory
Correct: B
Explanation: Each request is independent; server does not store session info unless explicitly
implemented.
24. Which HTTP status code means "Forbidden"?
A) 200
B) 403
C) 404
D) 500
Correct: B
Explanation: 403 means request understood but refused.
25. Which HTTP method is typically used when submitting an HTML form with sensitive data?
A) GET
B) POST
C) PUT
D) DELETE
Correct: B
Explanation: POST sends data in request body, not URL, making it more secure than GET.
26. Which statement is correct about HTML?
A) HTML is a programming language
B) HTML describes the structure of web pages
C) HTML is used to style web pages
D) HTML must be compiled before use
Correct: B
Explanation: HTML defines page structure using tags.
27. Which HTML tag is used to create the largest heading?
A) <heading>
B) <h6>
C) <h1>
D) <head>
Correct: C
Explanation: <h1> is the largest heading.
28. XML differs from HTML in that:
A) XML displays data and HTML stores data
B) XML is for data storage/transport, HTML is for display
C) XML must have predefined tags
D) XML ignores case sensitivity
Correct: B
Explanation: XML is data-focused; HTML is presentation-focused.
29. Which of these is NOT a valid XML naming rule?
A) Names cannot start with "xml"
B) Names cannot start with a number
C) Names must be lowercase
D) Names cannot contain spaces
Correct: C
Explanation: XML names can be mixed case; lowercase is not mandatory.
30. Which is true about XHTML syntax?
A) Tags may be uppercase or lowercase
B) All elements must be properly nested and closed
C) Self-closing tags are not allowed
D) Browsers ignore bad XHTML
Correct: B
Explanation: XHTML follows strict XML rules.
31. The primary reason XHTML was introduced is:
A) HTML was too complex
B) HTML allowed bad markup that mobile/limited browsers couldn’t interpret
C) XML was not supported in browsers
D) XHTML loads faster than HTML
Correct: B
Explanation: Strict rules improve compatibility across devices.
32. Which of the following is a core part of the DOM?
A) XML DOM
B) HTML DOM
C) Core DOM
D) All of the above
Correct: D
Explanation: DOM is divided into Core, XML DOM, and HTML DOM.
33. In the DOM tree, the topmost node is:
A) <html> element
B) Document object
C) Root tag
D) Body element
Correct: B
Explanation: DOM tree begins with the Document object as root.
34. Which of the following is an example of changing content using DHTML?
A) Changing the font color in CSS file
B) Using JavaScript to change an element’s innerHTML
C) Writing HTML manually in Notepad
D) Using PHP to fetch a page
Correct: B
Explanation: DHTML uses JS and DOM to modify content dynamically.
35. In DHTML, changing an element’s style dynamically is done using:
A) HTML tags only
B) CSS with inline styles only
C) JavaScript to modify style properties via DOM
D) PHP embedded code
Correct: C
Explanation: DOM methods allow JS to change CSS properties on the fly.
36. Which software is NOT listed as a required tool for this course?
A) Sublime Text
B) Notepad++
C) VS Code
D) Photoshop
Correct: D
Explanation: Required tools are text editors, browsers, and servers — Photoshop is not mentioned.
37. Which is a modern web browser mentioned in the slides?
A) Google Chrome
B) Firefox
C) Safari
D) All of the above
Correct: D
Explanation: All are listed as examples of browsers.
38. Which is NOT true about HTTP GET method?
A) Can be bookmarked
B) Data is sent in the URL
C) Good for sensitive data
D) Used for retrieving resources
Correct: C
Explanation: GET exposes data in URL, not secure for sensitive data.
39. Which is a valid example of a query in URI syntax?
A) /page?id=5&sort=asc
B) /page#section
C) /page;id=5
D) /page*id=5
Correct: A
Explanation: Queries follow ? and use key=value pairs separated by &.
40. Which is the correct XML statement?
A) <note><to>Tove</note>
B) <note><to>Tove</to></note>
C) <note><to>Tove</note></to>
D) <note><to>Tove</TO></note>
Correct: B
Explanation: XML requires proper nesting and case sensitivity.
41. Which part of the URI http://abc.com/index.html#top is the fragment?
A) http
B) /index.html
C) #top
D) abc.com
Correct: C
Explanation: Fragment is the part after #, pointing to a section within the resource.
42. Which HTTP status code represents "Not Found"?
A) 200
B) 301
C) 404
D) 500
Correct: C
Explanation: 404 indicates the resource could not be found.
43. Which is an example of an absolute URI?
A) /home/page.html
B) page.html
C) http://example.com/home/page.html
D) ../page.html
Correct: C
Explanation: Absolute URI contains scheme, host, and full path.
44. Which layer is NOT part of the three-tier architecture described?
A) Client
B) Application Server
C) Database/Resource Manager
D) Networking Layer
Correct: D
Explanation: Networking layer is not mentioned; the three tiers are client, application server, resource
manager.
45. Which protocol does the Internet use for communication between networks?
A) FTP
B) TCP/IP
C) SMTP
D) HTTP
Correct: B
Explanation: TCP/IP is the underlying protocol suite of the Internet.
46. The WWW is abbreviated for:
A) World Web Wide
B) World Wide Web
C) Wide World Web
D) Web World Wide
Correct: B
Explanation: WWW stands for World Wide Web.
47. Which example demonstrates proper XHTML syntax for an image tag?
A) <img src="image.jpg">
B) <img src="image.jpg"/>
C) <IMG SRC=image.jpg>
D) <img src=image.jpg />
Correct: B
Explanation: XHTML requires lowercase tags and self-closing format for empty elements.
48. Which is true about HTML tags?
A) Browsers display them as part of the page content
B) They instruct browsers how to display content
C) They cannot have attributes
D) They are always uppercase
Correct: B
Explanation: HTML tags describe structure, not directly visible unless displayed intentionally.
49. Which XML example is valid?
A) <note date="2025"><to>John</to></note>
B) <note><to>John</to>
C) <note>John<to></note>
D) <note><to>John</TO></note>
Correct: A
Explanation: Properly nested, case-sensitive, with optional attributes.
50. Which is NOT an HTTP request method mentioned in the slides?
A) GET
B) POST
C) PATCH
D) DELETE
Correct: C
Explanation: PATCH was not listed; only GET, POST, PUT, DELETE were mentioned.
51. Which HTTP step involves mapping a URL path to a file or program?
A) Browser sends request
B) DNS resolves address
C) Server processes request
D) Client renders content
Correct: C
Explanation: Server interprets the request and maps it to a resource or program.
52. Which is a valid reason for using POST instead of GET?
A) To make the request cacheable
B) To send data securely in the body, not in the URL
C) To retrieve data faster
D) To avoid using TCP
Correct: B
Explanation: POST hides parameters from the URL, suitable for sensitive data.
53. Which is NOT a required software tool mentioned for this course?
A) XAMPP
B) Notepad++
C) Google Chrome
D) Microsoft Excel
Correct: D
Explanation: Excel is not part of the listed tools.
54. Which best describes DHTML?
A) HTML with database connectivity
B) HTML + CSS + JS + DOM for dynamic pages
C) HTML used only for forms
D) HTML for static content only
Correct: B
Explanation: DHTML uses HTML, CSS, JS, and DOM for interactivity.
55. Which is true about XML syntax rules?
A) Tags can be left open
B) Attribute values must be quoted
C) Element names can start with numbers
D) Tags are not case sensitive
Correct: B
Explanation: XML requires all attribute values in quotes.
56. The DOM allows programs to:
A) Only read a document’s structure
B) Dynamically access and update document content, structure, and style
C) Store documents in XML format
D) Translate HTML to XML
Correct: B
Explanation: DOM is an API for manipulating documents in memory.
57. Which is NOT a WWW standard mentioned?
A) HTML/XHTML from W3C
B) ECMAScript from Ecma International
C) HTTP from W3C
D) URI from IETF
Correct: C
Explanation: HTTP is specified by IETF, not W3C.
58. Which HTTP status code indicates success?
A) 200 OK
B) 301 Moved Permanently
C) 403 Forbidden
D) 404 Not Found
Correct: A
Explanation: 200 means request succeeded.
59. Which part of the URI is en.wikipedia.org?
A) Scheme
B) Path
C) Authority/Host
D) Fragment
Correct: C
Explanation: Authority/host identifies the server location.
60. In XML, what is the root element?
A) The first child element in the document
B) The parent of all elements
C) Any element with attributes
D) The title element
Correct: B
Explanation: Root contains all other elements in the document.
61. Which XHTML rule is violated in <B><I>text</B></I>?
A) Lowercase tags required
B) Proper nesting required
C) Attributes must be quoted
D) Only one root element allowed
Correct: B
Explanation: <i> is closed after <b>, violating nesting order.
62. Which is true about HTML documents?
A) They are also called web pages
B) They cannot contain plain text
C) They must contain XML tags
D) They always need a DOCTYPE
Correct: A
Explanation: HTML documents are web pages, containing HTML tags and text.
63. Which is a valid XHTML empty element?
A) <br>
B) <br/>
C) <break>
D) <line/>
Correct: B
Explanation: XHTML requires self-closing empty tags.
64. Which DHTML example changes style dynamically?
A) <p style="color:blue;">text</p>
B) document.getElementById("p2").style.color="blue";
C) <style>p{color:blue;}</style>
D) <font color="blue">text</font>
Correct: B
Explanation: This JavaScript DOM method changes style at runtime.
65. Which of the following is a benefit of three-tier architecture?
A) Reduces scalability
B) Separates presentation, logic, and data layers
C) Increases dependency on client hardware
D) Requires no network communication
Correct: B
Explanation: Separation allows better maintenance and scalability.
66. Which browser was NOT listed in the slides?
A) Netscape
B) Opera
C) Firefox
D) Edge
Correct: D
Explanation: Edge is not listed; others are.
67. Which part of the URI can contain key=value pairs separated by &?
A) Scheme
B) Path
C) Query
D) Fragment
Correct: C
Explanation: Queries hold additional parameters.
68. In HTTP, after a request is completed:
A) The connection stays open permanently
B) Client and server forget each other unless session tracking is implemented
C) Server keeps all request history by default
D) Browser must restart to send another request
Correct: B
Explanation: HTTP is stateless — no memory of past requests.
69. Which XML example violates naming rules?
A) <note1>
B) <_note>
C) <1note>
D) <note>
Correct: C
Explanation: Names cannot start with a number.
70. Which is true about HTML tags like <p>?
A) They are used for styling only
B) They define structure and meaning of content
C) They must always be uppercase
D) They can start with numbers
Correct: B
Explanation: HTML tags indicate content type and structure.
Lecture 02 – CSS
1. What does CSS stand for?
A) Cascading Script Sheets
B) Cascading Style Sheets
C) Computer Style System
D) Color Style Syntax
Correct: B
Explanation: CSS stands for Cascading Style Sheets, used to control web page design and layout.
2. Which is NOT a benefit of using CSS?
A) Saves work by controlling multiple pages at once
B) Supports layout variations for different devices
C) Stores HTML content in .css files
D) Separates style from HTML structure
Correct: C
Explanation: .css files store styles, not HTML content.
3. In the given CSS example, p { color: red; text-align: center; }, what is p?
A) Property
B) Selector
C) Value
D) Attribute
Correct: B
Explanation: p is the selector targeting <p> elements.
4. Which statement about CSS syntax is true?
A) Declaration blocks are surrounded by parentheses
B) Property and value are separated by a colon
C) A semicolon is optional between declarations
D) Spaces are required between value and unit
Correct: B
Explanation: CSS uses property: value; format; units cannot have space before them.
5. Which selector type selects all HTML elements on a page?
A) Universal selector
B) Grouping selector
C) Class selector
D) ID selector
Correct: A
Explanation: The universal selector * applies to all elements.
6. How do you target an element with id="main" in CSS?
A) .main { }
B) #main { }
C) id.main { }
D) main { }
Correct: B
Explanation: ID selectors use # followed by the ID name.
7. Which is NOT true about ID selectors?
A) They are unique within a page
B) They use the # symbol
C) An ID name can start with a number
D) They target a single specific element
Correct: C
Explanation: ID names cannot start with a number.
8. How would you style only <p> elements with the class highlight?
A) .highlight p { }
B) p.highlight { }
C) #highlight p { }
D) .p.highlight { }
Correct: B
Explanation: p.highlight targets <p> elements with the class highlight.
9. Which selector groups <h1>, <h2>, and <p> with the same styles?
A) h1+h2+p { }
B) h1 h2 p { }
C) h1, h2, p { }
D) h1.h2.p { }
Correct: C
Explanation: Grouping selectors use commas.
10. Which CSS insertion type requires the <link> tag in HTML?
A) Inline CSS
B) Internal CSS
C) External CSS
D) Embedded CSS
Correct: C
Explanation: External CSS uses <link> inside <head>.
11. Which is true about external CSS files?
A) They can contain HTML tags
B) They must have .css extension and no HTML tags
C) They must be inline in the HTML file
D) They can only style one page
Correct: B
Explanation: External CSS contains only style rules, not HTML.
12. Internal CSS is best used when:
A) Many pages share the same style
B) One single HTML page has unique styling
C) You want to style elements directly in HTML tags
D) Styles must change dynamically with JavaScript
Correct: B
Explanation: Internal CSS is defined inside <style> in <head> for a single page.
13. Which CSS method is applied directly to the HTML element via style attribute?
A) External CSS
B) Internal CSS
C) Inline CSS
D) Embedded CSS
Correct: C
Explanation: Inline CSS uses style="property:value;" within the element.
14. Which is NOT part of the CSS Box Model?
A) Content
B) Padding
C) Spacing
D) Border
Correct: C
Explanation: Box model parts are content, padding, border, margin.
15. Which box model component clears space inside the border and around content?
A) Margin
B) Padding
C) Border
D) Content
Correct: B
Explanation: Padding is space between content and border.
16. What is the total width of an element with: width=300px, padding=10px, border=5px, margin=20px
(left and right each)?
A) 330px
B) 350px
C) 370px
D) 370px excluding margin
Correct: C
Explanation: Total width = 300 + (10×2) + (5×2) + (20×2) = 370px.
17. Which CSS position value keeps an element fixed relative to the viewport, even when scrolling?
A) Static
B) Relative
C) Fixed
D) Sticky
Correct: C
Explanation: fixed positions element relative to the viewport.
18. Which position value is default for HTML elements?
A) Static
B) Relative
C) Absolute
D) Sticky
Correct: A
Explanation: All elements are static by default.
19. An element with position: relative; left: 30px; will:
A) Move 30px from left edge of the viewport
B) Move 30px from its normal position
C) Be fixed in place when scrolling
D) Float above all other elements
Correct: B
Explanation: Relative moves element from its normal position.
20. Which position value toggles between relative and fixed based on scroll position?
A) Absolute
B) Sticky
C) Static
D) Scroll
Correct: B
Explanation: Sticky acts relative until a set point, then sticks like fixed.
21. Which positioning method uses the nearest positioned ancestor as reference?
A) Static
B) Relative
C) Absolute
D) Sticky
Correct: C
Explanation: absolute positions relative to the nearest non-static ancestor.
22. In the CSS box model, which part is transparent by default and lies outside the border?
A) Margin
B) Padding
C) Border
D) Content
Correct: A
Explanation: Margins create space outside the border and are transparent.
23. Which selector is an example of a pseudo-class?
A) p.center
B) a:hover
C) #main
D) *
Correct: B
Explanation: :hover applies styles when an element is in a specific state.
24. Which selector styles part of an element’s content, such as the first letter?
A) Attribute selector
B) Pseudo-element selector
C) ID selector
D) Universal selector
Correct: B
Explanation: Pseudo-elements like ::first-letter target specific parts.
25. Which CSS selector matches elements based on a given attribute value?
A) Universal selector
B) Attribute selector
C) Class selector
D) Grouping selector
Correct: B
Explanation: Attribute selectors match [attr="value"].
26. Which grouping selector example applies the same style to <h1> and <h2>?
A) h1 h2 { }
B) h1, h2 { }
C) h1+h2 { }
D) .h1, .h2 { }
Correct: B
Explanation: Commas separate multiple selectors in grouping.
27. Inline styles have:
A) Lower precedence than external styles
B) Higher precedence than internal and external styles
C) No precedence
D) Same precedence as internal
Correct: B
Explanation: Inline styles override internal and external unless !important is used.
28. In the code .topnav a:hover { color: black; }, a:hover means:
A) All anchor tags with hover class
B) All anchor tags in .topnav on mouse hover
C) The .topnav element is hovered
D) The first anchor tag in .topnav
Correct: B
Explanation: Applies to <a> tags inside .topnav during hover state.
29. Which is true about position: fixed;?
A) It moves with page scroll
B) It stays fixed in viewport regardless of scroll
C) It is relative to nearest positioned ancestor
D) It behaves like sticky after offset
Correct: B
Explanation: Fixed remains in place relative to viewport.
30. Which property is used to clear space inside the border around the content?
A) Margin
B) Padding
C) Border
D) Gap
Correct: B
Explanation: Padding is between content and border.
31. In website layout, the <header> section usually contains:
A) Footer links
B) Logo or site name and navigation bar
C) Scripts and styles
D) Sidebars only
Correct: B
Explanation: Header often includes branding and navigation.
32. In a typical layout, the footer contains:
A) Navigation menu
B) Logo
C) Copyright and contact info
D) Main content
Correct: C
Explanation: Footer stores copyright and contact details.
33. In a 3-column layout where side columns are 25% each, the middle column width is:
A) 25%
B) 50%
C) 40%
D) 60%
Correct: B
Explanation: 25% + 50% + 25% = 100%.
34. Which CSS property sets space outside the border?
A) Padding
B) Margin
C) Border-spacing
D) Gap
Correct: B
Explanation: Margin clears space outside the border.
35. Which selector targets all elements within a page?
A) html
B) body
C) *
D) .all
Correct: C
Explanation: * is the universal selector.
36. Which CSS property changes an element’s font family?
A) font-size
B) font-family
C) text-align
D) font-weight
Correct: B
Explanation: font-family sets the typeface.
37. Which position value removes the element from normal document flow and positions it relative to
the nearest positioned ancestor?
A) Absolute
B) Fixed
C) Sticky
D) Relative
Correct: A
Explanation: Absolute removes the element from normal flow.
38. In .column.side { width: 25%; }, .column.side targets:
A) All elements with class column
B) Elements with class side inside elements with class column
C) Elements with both column and side classes
D) First side column only
Correct: C
Explanation: .class1.class2 targets elements having both classes.
39. Which CSS method is best for applying the same style to multiple pages?
A) Inline CSS
B) Internal CSS
C) External CSS
D) Script-based styling
Correct: C
Explanation: External CSS can be linked to multiple pages.
40. Which CSS property affects the order in which elements overlap?
A) display
B) z-index
C) position
D) overflow
Correct: B
Explanation: z-index controls stacking order.
41. Which is true about position: static;?
A) It is the default positioning
B) Top/left properties apply
C) It positions relative to viewport
D) It sticks to top on scroll
Correct: A
Explanation: Static ignores top/left/bottom/right values.
42. The :hover pseudo-class is triggered when:
A) An element is clicked
B) The cursor is over an element
C) An element is focused
D) The page loads
Correct: B
Explanation: :hover applies styles during mouse-over.
43. Which property controls the horizontal alignment of inline content inside a block element?
A) text-align
B) align-items
C) margin-left
D) float
Correct: A
Explanation: text-align affects inline content alignment.
44. The CSS declaration border: 5px solid gray; sets:
A) Border size, style, and color
B) Padding, style, and color
C) Margin, style, and color
D) Box shadow and color
Correct: A
Explanation: Border property syntax is width style color.
45. Which unit is NOT a valid CSS length unit?
A) px
B) em
C) cm
D) pm
Correct: D
Explanation: pm is not a standard CSS unit.
46. Which CSS rule will make all <h1> elements red and centered?
A) h1 { color: red; align: center; }
B) h1 { color: red; text-align: center; }
C) h1 { font-color: red; text-align: center; }
D) h1 { text-color: red; center: text; }
Correct: B
Explanation: color sets text color, text-align centers it.
47. Which CSS property changes the background color?
A) color
B) bgcolor
C) background-color
D) bg-color
Correct: C
Explanation: background-color sets the background fill.
48. Which selector is more specific: .center or p.center?
A) .center
B) p.center
C) Both equal
D) Depends on position in CSS file
Correct: B
Explanation: p.center is more specific because it targets an element + class.
49. Which position value allows an element to scroll with the page until a threshold, then remain fixed?
A) Fixed
B) Sticky
C) Relative
D) Static
Correct: B
Explanation: Sticky acts relative until offset is met, then fixed.
50. Which selector applies styles to <a> elements regardless of state?
A) a:hover
B) a:visited
C) a
D) a:active
Correct: C
Explanation: a targets all links without state condition.
51. Which CSS property sets the space between content and border?
A) Padding
B) Margin
C) Border-spacing
D) Gap
Correct: A
Explanation: Padding is inside the border.
52. In external CSS linking, which attribute specifies the path to the CSS file?
A) type
B) rel
C) href
D) src
Correct: C
Explanation: href provides the file path.
53. Which HTML tag is used to define internal CSS?
A) <style>
B) <css>
C) <script>
D) <link>
Correct: A
Explanation: <style> encloses internal CSS rules.
54. Which layout technique uses float to arrange columns?
A) Flexbox
B) Float-based layout
C) Grid
D) Absolute positioning
Correct: B
Explanation: Slides show .column classes using float: left;.
55. In .topnav a:hover { background-color: #ddd; }, #ddd represents:
A) RGB color value
B) Hexadecimal color code
C) Named CSS color
D) Decimal color value
Correct: B
Explanation: Hex codes start with #.
56. Which part of the CSS rule p { font-size: 20px; } is the declaration block?
A) p
B) { font-size: 20px; }
C) font-size
D) 20px
Correct: B
Explanation: Declaration block is inside {}.
57. Which selector matches all elements with the class menu?
A) .menu
B) #menu
C) menu
D) *menu
Correct: A
Explanation: Class selectors use ..
58. Which is true about position: absolute; without a positioned ancestor?
A) It positions relative to the document body
B) It behaves like fixed
C) It is relative to viewport
D) It stays in normal flow
Correct: A
Explanation: Without positioned ancestor, absolute refers to body.
59. Which property changes the text size?
A) font-size
B) text-size
C) size
D) text-font
Correct: A
Explanation: font-size sets the text size.
60. In .footer { padding: 10px; }, what does this do?
A) Adds space outside footer
B) Adds space inside footer between content and border
C) Changes footer height
D) Creates a footer margin
Correct: B
Explanation: Padding adds space inside the element.
61. Which is true about the CSS float property?
A) It places an element in a fixed position
B) It moves elements left or right and allows text wrapping
C) It hides an element
D) It removes the element from the DOM
Correct: B
Explanation: Float positions elements to left/right with wrapping.
62. Which unit is relative to the parent element’s font size?
A) px
B) %
C) em
D) cm
Correct: C
Explanation: em is relative to parent’s font size.
63. In a navigation bar, which property removes underline from links?
A) text-style: none;
B) text-decoration: none;
C) underline: none;
D) decoration: no;
Correct: B
Explanation: text-decoration controls underline.
64. Which CSS value makes an element hidden but still occupying space?
A) display: none;
B) visibility: hidden;
C) opacity: 0;
D) position: hidden;
Correct: B
Explanation: visibility: hidden; hides but keeps layout space.
65. Which is true about grouping selectors?
A) They use commas
B) They use spaces
C) They must be for same element type
D) They must have same class
Correct: A
Explanation: Commas group selectors to share styles.
66. Which CSS property changes the style of the cursor?
A) cursor
B) pointer
C) mouse-style
D) hover
Correct: A
Explanation: cursor changes pointer type.
67. Which CSS method is least recommended for large websites?
A) External CSS
B) Internal CSS
C) Inline CSS
D) Linked stylesheets
Correct: C
Explanation: Inline CSS is hard to maintain.
68. Which property is used to set multiple background images?
A) background-images
B) background
C) multi-background
D) bg-image
Correct: B
Explanation: background shorthand supports multiple images.
69. In .header { text-align: center; }, what is affected?
A) Header alignment in DOM
B) Horizontal alignment of inline content in .header
C) Position of .header element
D) Vertical alignment of header text
Correct: B
Explanation: text-align affects inline content horizontally.
70. Which is true about CSS?
A) It replaces HTML structure
B) It defines design, layout, and display variations for devices
C) It must be inline
D) It works only with HTML 5
Correct: B
Explanation: CSS styles structure provided by HTML, adapting layouts for devices.
Lecture 03 – JavaScript (100% Coverage)
JavaScript Basics & History
1. JavaScript is primarily a:
A. Server-side compiled language
B. Client-side interpreted language
C. Server-side interpreted language
D. Database query language
2. JavaScript is considered a:
A. Heavyweight programming language
B. Lightweight scripting language
C. Low-level language
D. Compiled language
3. “Interpreted” in JavaScript means:
A. The code is translated to machine code before execution
B. The script executes without preliminary compilation
C. The script must be compiled first
D. Code is converted to binary files
4. JavaScript is also known as:
A. JScript
B. ECMAScript
C. JavaLang
D. WebScript
5. Who developed JavaScript?
A. James Gosling
B. Tim Berners-Lee
C. Brendan Eich
D. Rasmus Lerdorf
6. When was JavaScript developed?
A. 1990
B. September 1995
C. 2000
D. 1998
7. Which statement about JavaScript and Java is correct?
A. They are the same
B. They have almost nothing in common
C. JavaScript was based on Java
D. JavaScript is a subset of Java
Usage & Applications
8. One reason JavaScript is popular is:
A. Few libraries are available
B. Many frameworks/libraries already exist
C. Only works with HTML
D. Requires manual installation
9. JavaScript usage has extended to:
A. Mobile app development
B. Desktop app development
C. Game development
D. All of the above
10. JavaScript is easy to use because:
A. It is pre-installed in modern browsers
B. It needs a special compiler
C. It works only online
D. It cannot run without servers
11. JavaScript can be used in:
A. Front-end only
B. Back-end only
C. Both front-end and back-end
D. Neither
Where & How to Use JS
12. To add JavaScript in HTML, use:
A. <java>
B. <script>
C. <js>
D. <code>
13. Old HTML examples may show <script type="text/javascript">. Why is type no longer required?
A. It causes errors
B. JavaScript is the default scripting language in HTML
C. It slows the page
D. It is deprecated by browsers
14. Scripts can be placed:
A. In <body>
B. In <head>
C. In both <body> and <head>
D. Only in <html>
15. Placing scripts at the bottom of <body> improves:
A. Page loading speed
B. Browser cache
C. SEO ranking
D. Security
16. JavaScript code can also be stored in:
A. .html files only
B. External .js files
C. .exe files
D. .java files
17. To link an external JavaScript file:
A. <link src="file.js">
B. <script src="file.js"></script>
C. <script file="file.js">
D. <external file="file.js">
18. External JS files are useful because:
A. Same code can be reused
B. They prevent caching
C. They can include HTML tags
D. They run faster without caching
19. Extension for an external JavaScript file is:
A. .java
B. .js
C. .html
D. .script
20. External JS files:
A. Must contain <script> tags
B. Must NOT contain <script> tags
C. Cannot contain variables
D. Must be in the same folder as HTML
21. One benefit of external JS is:
A. Easier maintainability
B. More complex syntax
C. Cannot be reused
D. Slower page load
22. Modern browsers cache JS files to:
A. Reduce page load time
B. Increase security
C. Prevent execution
D. Block scripts
23. During development, to see changes in cached JS files:
A. Refresh normally
B. Clear cache (Ctrl+F5)
C. Close and reopen browser
D. Rename the file
JS Variables & Naming Rules
24. JavaScript is:
A. Strongly typed
B. Loosely typed
C. Type-restricted
D. Data-locked
25. Loosely typed means:
A. Variables store only one type
B. Variables can store different data types at different times
C. Variables must store text only
D. Variable types must be declared
26. Declaring a variable in JavaScript can be done:
A. Only with var
B. With or without var
C. Only with let
D. Only with const
27. By default, declared variables have value:
A. null
B. undefined
C. 0
D. empty string
28. Valid variable name:
A. var name1
B. var 1name
C. var *value
D. var name space
29. Variable names:
A. Are case-insensitive
B. Are case-sensitive
C. Can start with numbers
D. Must start with symbols
30. Reserved keywords:
A. Can be used as variable names
B. Cannot be used as variable names
C. Must be used in all code
D. Can be overwritten
31. Re-declaring a variable with var will:
A. Lose its value
B. Keep its value
C. Cause syntax error
D. Reset it to undefined
JS Data Types
32. JavaScript has how many primitive data types?
A. 3
B. 4
C. 5
D. 6
33. JavaScript has how many complex data types?
A. 1
B. 2
C. 3
D. 4
34. Primitive data types in JS:
A. Boolean, Number, String, Undefined
B. Boolean, Integer, Float, Null
C. Number, String, Object, Function
D. Number, Array, String, JSON
35. Complex data types in JS:
A. Object, Function
B. Array, JSON
C. Class, Module
D. HTML, CSS
36. typeof keyword:
A. Changes a variable’s type
B. Returns a variable’s type
C. Declares a variable
D. Deletes a variable
Numbers in JavaScript
37. In JavaScript, numbers are stored as:
A. 32-bit integers
B. 64-bit floating point
C. 128-bit decimal
D. Binary only
38. Integers are accurate up to:
A. 10 digits
B. 15 digits
C. 17 digits
D. 20 digits
39. Max number of decimal places JS can store:
A. 10
B. 17
C. 20
D. Unlimited
40. 0.2 + 0.1 in JavaScript gives:
A. 0.3
B. 0.30000000000000004
C. NaN
D. Infinity
41. To fix floating-point inaccuracy, use:
A. Rounding only
B. Multiply, add, then divide
C. Avoid decimals
D. String conversion
42. NaN stands for:
A. Null and Null
B. Not a Number
C. Number and Null
D. Null as Number
Strings in JavaScript
43. Strings can be written with:
A. Only single quotes
B. Only double quotes
C. Both single and double quotes
D. Only backticks
44. "My name is 'Jon'" is valid because:
A. Nested single quotes are allowed inside double quotes
B. It is a syntax error
C. Double quotes cannot contain single quotes
D. It uses escape characters
45. "ABCDEFGHIJKLMNOPQRSTUVWXYZ".length returns:
A. 25
B. 26
C. 26
D. 27
46. String properties and methods are accessed using:
A. Dot operator
B. Arrow operator
C. Colon
D. get keyword
Null vs Undefined
47. Null means:
A. The variable was never declared
B. The variable has been explicitly set to have no value
C. Default for undeclared variables
D. Same as NaN
48. Undefined means:
A. Variable was declared but not assigned
B. Explicitly assigned nothing
C. Always equals null
D. Means error
49. Null and undefined:
A. Have same type
B. Have same value but different type
C. Are interchangeable
D. Are unrelated
Syntax, Statements & Output
50. Fixed values in JS are called:
A. Literals
B. Variables
C. Operators
D. Tokens
51. Each JS instruction is called:
A. Statement
B. Command
C. Syntax
D. Token
52. Each statement should end with:
A. Colon
B. Semicolon
C. Comma
D. Nothing
53. Single-line comment in JS:
A. // comment
B. <!-- comment -->
C. # comment
D. /* comment */
54. Multi-line comment in JS:
A. /* comment */
B. // comment
C. <!-- comment -->
D. ** comment **
Output Methods
55. Which output method changes HTML element content?
A. innerHTML
B. alert
C. console.log
D. document.write
56. document.getElementById("demo") returns:
A. HTML element as object
B. String only
C. Array of elements
D. Null always
57. innerHTML property sets/returns:
A. HTML code inside an element
B. CSS styling
C. Event handlers
D. File paths
58. document.write() writes:
A. In the console
B. Directly into the HTML page
C. In alert box
D. In a file
59. alert("Hello") displays:
A. Message in HTML
B. Pop-up alert
C. Console message
D. Tooltip
60. console.log("Hello") displays:
A. Message in HTML
B. In browser developer console
C. In alert box
D. Nowhere
Operators
61. The + operator in JS:
A. Only adds numbers
B. Adds numbers or concatenates strings
C. Only concatenates strings
D. Multiplies numbers
62. The += operator:
A. Adds numbers only
B. Adds numbers or concatenates strings
C. Only concatenates strings
D. Only assigns
63. Comparison operator === checks:
A. Value only
B. Value and type
C. Type only
D. Case only
64. If a=10; b="10";, a==b is:
A. true
B. false
C. NaN
D. undefined
65. If a=10; b="10";, a===b is:
A. true
B. false
C. NaN
D. undefined
Arithmetic Operations
66. Arithmetic precedence in JS is:
A. Addition before multiplication
B. Multiplication/division before addition/subtraction
C. Always left to right
D. Random
67. Parentheses in JS expressions:
A. Change precedence
B. Cause errors
C. Are ignored
D. Only work in strings
68. When operators have same precedence:
A. Right to left
B. Left to right
C. Random order
D. By variable length
Lecture_01_WT_Lab – HTML
1. An HTML element usually consists of:
A. Only a start tag
B. A start tag, content, and an end tag
C. Content only
D. Only an end tag
2. HTML attributes:
A. Are always in the end tag
B. Provide extra information about an element
C. Can only be used with images
D. Must always have numeric values
3. Attributes in HTML are written as:
A. value=name
B. name:value
C. name="value"
D. value-name
4. The <a> tag is used for:
A. Images
B. Hyperlinks
C. Forms
D. Headings
5. In <a href="https://www.aiub.edu">AIUB</a>, href specifies:
A. Image source
B. Background color
C. Link address
D. File location
6. <img src="img_girl.jpg"> uses which attribute?
A. href
B. alt
C. src
D. link
7. HTML <form> is used to:
A. Create tables
B. Collect user input
C. Display headings
D. Link external CSS
8. <input type="text"> is an example of:
A. A form attribute
B. A form element
C. A hyperlink
D. An HTML tag without attributes
9. In <label for="fname">First name:</label>, the for attribute:
A. Matches the form action
B. Links the label to an input field’s id
C. Specifies font size
D. Links to a URL
10. <textarea> is used for:
A. Multi-line text input
B. Single-line text input
C. File uploads
D. Dropdown menus
11. Which is not a valid HTML input type?
A. checkbox
B. number
C. password
D. picture
12. <input type="hidden"> is used to:
A. Hide the form
B. Send data to the server without displaying it
C. Store CSS code
D. Block the page
13. Which HTML input type would you use for file uploads?
A. <input type="text">
B. <input type="file">
C. <input type="hidden">
D. <input type="password">
14. <input type="radio"> allows:
A. Multiple selections
B. Only one selection from a group
C. Hidden values
D. Image uploads
15. <input type="range"> is used for:
A. Numeric slider input
B. Selecting multiple options
C. Text input
D. File upload
16. The slides recommend exploring HTML tags from:
A. developer.mozilla.org
B. w3schools.com
C. php.net
D. stackoverflow.com
17. An HTML document can be created using:
A. Photoshop
B. A text editor and web browser
C. Only a server
D. PowerPoint
18. Examples of HTML editors include:
A. Eclipse, NetBeans
B. Sublime Text, VS Code
C. Word, Excel
D. Chrome, Firefox
19. In the sample HTML form, <input type="text" id="fname" name="fname"> means:
A. The input field is unnamed
B. It has both an id and a name
C. It cannot be submitted
D. It is a password field
20. The <input> element without a closing tag:
A. Is invalid
B. Is self-closing
C. Requires <input/>
D. Cannot have attributes
21. The HTML registration page task in the slide requires:
A. A dynamic form
B. A static personal website
C. PHP scripting
D. JavaScript validation
22. Which of these is a valid source for learning HTML?
A. https://www.w3schools.com/html/html_intro.asp
B. https://facebook.com/html
C. https://php.net/html
D. https://wikipedia.org/html
Lecture_03_WT – JavaScript
23. JavaScript is:
A. Client-side scripting
B. Compiled
C. Only used for servers
D. Not supported in browsers
24. Who developed JavaScript?
A. Tim Berners-Lee
B. Brendan Eich
C. Bill Gates
D. James Gosling
25. JavaScript and Java:
A. Are the same
B. Have almost nothing in common
C. Have identical syntax
D. Are compiled
26. JavaScript is:
A. Lightweight
B. Heavyweight
C. A database language
D. Server hardware
27. One major benefit of JavaScript:
A. No libraries exist
B. Many prebuilt frameworks
C. Must be installed
D. Only runs in Firefox
28. JavaScript can be used in:
A. Frontend only
B. Backend only
C. Both frontend and backend
D. None of these
29. In HTML, JavaScript is added inside:
A. <java>
B. <script>
C. <js>
D. <code>
30. Placing <script> in <body> bottom improves:
A. Browser security
B. Display speed
C. SEO ranking
D. Server load
31. External JS files must have the extension:
A. .java
B. .js
C. .html
D. .script
32. The src attribute in <script src="file.js"></script> specifies:
A. Script name only
B. Path to the external JS file
C. Function name
D. HTML element
33. External JS cannot contain:
A. JavaScript code
B. <script> tags
C. Variables
D. Functions
34. One benefit of external JS:
A. Slower pages
B. Reusability
C. Forces duplication
D. Increases file size
35. When browsers cache external JS files, developers must:
A. Restart the browser
B. Clear cache (Ctrl+F5)
C. Rename files
D. Delete JS
36. JavaScript is:
A. Strongly typed
B. Loosely typed
C. Type-restricted
D. Memory-typed
37. Valid variable name:
A. var 2value
B. var $amount
C. var *star
D. var space name
38. Reserved words in JS:
A. Can be used as variables
B. Cannot be used as variable names
C. Must be used as function names
D. Are case-insensitive
39. Re-declaring a variable with var in JS:
A. Resets its value
B. Keeps its value
C. Throws error
D. Makes it undefined
40. JS primitive data types include:
A. Boolean, Number, String, Undefined
B. Integer, Float, Double
C. JSON, XML, HTML
D. Function, Object, Array
41. typeof in JavaScript:
A. Returns a variable’s name
B. Returns a variable’s type
C. Declares a variable
D. Converts a type
42. In JS, all numbers are:
A. Integers
B. 64-bit floating point
C. 32-bit integers
D. 128-bit decimal
43. Max integer precision in JS is:
A. 10 digits
B. 15 digits
C. 20 digits
D. 32 digits
44. 0.2 + 0.1 equals:
A. 0.3
B. 0.30000000000000004
C. NaN
D. Infinity
45. NaN stands for:
A. Not a Name
B. Not a Number
C. Null and Null
D. Number and Null
46. Strings in JS can be written in:
A. Single quotes
B. Double quotes
C. Both
D. Triple quotes only
47. To find a string’s length:
A. string.size
B. string.length
C. len(string)
D. size(string)
48. Null vs Undefined:
A. Same value, different type
B. Different value, same type
C. Always interchangeable
D. Null is default for undeclared variables
49. In JS, fixed values are called:
A. Literals
B. Variables
C. Constants only
D. Properties
50. Each JS instruction is called:
A. Syntax
B. Statement
C. Operator
D. Block
51. Comments in JS:
A. Single-line with //
B. Multi-line with /* */
C. Cannot exist
D. Only inside HTML
52. JS can output via:
A. HTML elements (innerHTML)
B. document.write()
C. alert()
D. console.log()
53. document.getElementById() returns:
A. An array
B. An object reference to the element
C. HTML code as string
D. Undefined
54. The innerHTML property:
A. Sets or returns the HTML content inside an element
B. Changes CSS style
C. Runs scripts
D. Creates new elements
55. document.write() executes:
A. Before the HTML loads
B. At the script’s position
C. Only in console
D. After all scripts finish
56. alert("Hello") produces:
A. A console message
B. A popup alert
C. An HTML change
D. No visible result
57. console.log() displays output:
A. In the HTML page
B. In the developer console
C. In an alert box
D. As a file
58. The === operator checks:
A. Value and type
B. Value only
C. Memory location
D. Case
59. Given a=10; b="10";, a==b is:
A. false
B. true
C. NaN
D. undefined
60. Given same variables, a===b is:
A. true
B. false
C. NaN
D. undefined
61. In JS operator precedence:
A. Multiplication before addition
B. Addition before multiplication
C. Left to right always
D. No fixed order
62. Using parentheses in expressions:
A. Changes precedence
B. Makes no difference
C. Causes errors
D. Only works with numbers
63. When operators have same precedence, JS evaluates:
A. Right to left
B. Left to right
C. Randomly
D. Only the first
64. A reliable learning resource for JS according to slides:
A. https://www.w3schools.com/js/
B. https://php.net
C. https://java.com
D. https://css-tricks.com