Important Questions
12 exam-focused answers with examples and code snippets
Q1. Explain Web Publishing process
Answer:
- Plan content and structure: sitemap, pages, assets.
- Develop locally: HTML for structure, CSS for presentation, JS for behavior.
- Validate and optimize: W3C validator, accessibility, compress images, minify CSS/JS.
- Get a domain: register
example.com. - Choose hosting: shared/VPS/dedicated/cloud (see Q7).
- Upload site: via FTP/SFTP or provider deploy tools.
- Configure DNS: point domain to host (A/CNAME records).
- Enable HTTPS: install TLS certificate (e.g., Let’s Encrypt).
- Test live: links, forms, responsive, performance.
- Maintain: backups, updates, analytics, SEO (sitemap.xml, robots.txt).
Q2. Web page vs Website
Answer:
| Aspect | Web page | Website |
|---|---|---|
| Definition | Single HTML document | Collection of related pages under a domain |
| Scope | One document/view | Complete information system |
| Navigation | Links to other pages | Global nav, hierarchy (home, sections) |
| Updates | Update that page only | Site-wide consistency and design |
| Examples | About.html | example.com with Home, About, Contact |
Q3. Components of a website
Answer:
- Client-side: HTML (structure), CSS (style), JS (behavior), images/fonts/assets.
- Server-side: Web server (Apache/Nginx), app server (Node/Python/PHP), database (MySQL/MongoDB).
- Networking: Domain Name System (DNS), CDN for static assets, SSL/TLS for HTTPS.
- Management: Hosting platform, version control (Git), CI/CD, backups, monitoring/analytics.
- Auxiliary: Email/SMTP, third‑party APIs, payment gateways, search, caching.
Q4. HTML form for Student Registration
Answer:
Example form:
<form id="reg" action="/submit" method="post">
<fieldset>
<legend>Student Registration</legend>
<label>Full Name: <input name="name" required /></label>
<label>Email: <input type="email" name="email" required /></label>
<label>Phone: <input name="phone" pattern="^[0-9]{10}$" title="10 digits" required /></label>
<label>DOB: <input type="date" name="dob" required /></label>
<label>Gender:
<select name="gender" required>
<option value="" disabled selected>Select</option>
<option>Male</option><option>Female</option><option>Other</option>
</select>
</label>
<label>Branch: <input name="branch" required /></label>
<label>Year: <input type="number" name="year" min="1" max="4" required /></label>
<label>Roll No: <input name="roll" required /></label>
<label>Password: <input type="password" name="pwd" minlength="6" required /></label>
<label>Confirm Password: <input type="password" name="cpwd" minlength="6" required /></label>
<label>Address: <textarea name="addr" rows="3"></textarea></label>
<button type="submit">Register</button>
<button type="reset">Reset</button>
</fieldset>
</form>
<script>
reg.addEventListener('submit', (e) => {
const { pwd, cpwd } = e.target;
if (pwd.value !== cpwd.value) { e.preventDefault(); alert('Passwords must match'); }
});
</script>
Q5. JavaScript language elements
Answer:
- Identifiers: names for variables/functions. Start with letter/_/$, case-sensitive. Example:
totalSum. - Keywords: reserved words like
let, const, if, else, for, return, class, import. - Expressions: produce a value, e.g.,
a + b,user?.name ?? 'N/A'. - Operators: arithmetic
+ - * / %, comparison=== !== < >, logical&& || !, spread..., ternarycond ? A : B. - Functions: declaration, expression, arrow.
function add(a,b){ return a+b } const mul = function(a,b){ return a*b } const square = x => x*x
Q6. What is CSS? Types of CSS
Answer:
CSS (Cascading Style Sheets) describes how HTML elements are displayed. It separates content from presentation.
- Inline CSS: style attribute inside element.
<p style="color:blue; font-weight:bold;">Hello</p>
- Internal CSS: <style> in the document head.
<head> <style> .title { color:#185a9d; } </style> </head> <h1 class="title">Welcome</h1> - External CSS: separate .css file linked via <link> (best practice).
<head> <link rel="stylesheet" href="styles.css" /> </head>
Q7. Web hosting and its types
Answer:
- Shared hosting: Many sites on one server. Low cost; limited resources.
- VPS (Virtual Private Server): Virtualized slices. More control; moderate cost.
- Dedicated server: Entire server for one client. High performance; costly.
- Cloud hosting: Scalable resources across multiple servers. Pay-as-you-go.
- Managed hosting: Provider manages updates, security (common for WordPress).
- Static hosting: Hosts static files (Netlify, GitHub Pages). Simple and fast.
- Serverless: Functions as a Service for dynamic backends (AWS Lambda, Vercel).
- Colocation: Your hardware in provider’s data center.
Q8. JavaScript arrays with example
Answer:
An array holds ordered values (any type). Common methods: push/pop, shift/unshift, map, filter, reduce.
Example:
const marks = [72, 81, 56, 90];
const passed = marks.filter(m => m >= 60); // [72,81,90]
const avg = marks.reduce((s,m) => s + m, 0) / marks.length; // 74.75
const curved = marks.map(m => Math.min(100, m + 5));
Q9. XML and how it differs from HTML
Answer:
| Aspect | XML | HTML |
|---|---|---|
| Purpose | Transport/store data (self-descriptive) | Display data (presentation) |
| Tags | User-defined/custom allowed | Predefined set |
| Case sensitivity | Case-sensitive | Not case-sensitive |
| Well-formedness | Strict: proper nesting, one root, closed tags | More forgiving |
| Parsing | General-purpose parsers | Web browsers |
Q10. Write XML syntax with example
Answer:
- Exactly one root element; elements properly nested.
- Tags are case-sensitive; every start tag has an end tag.
- Attributes in quotes; special characters escaped:
< > &. - Optional XML declaration:
<?xml version="1.0" encoding="UTF-8"?>
Example:
<?xml version="1.0" encoding="UTF-8"?>
<students>
<student id="101">
<name>Anita</name>
<branch>CSE</branch>
<year>3</year>
</student>
<student id="102">
<name>Rahul</name>
<branch>IT</branch>
<year>2</year>
</student>
</students>
Q11. What is the purpose of HTML head?
Answer:
The <head> contains document metadata (not displayed) used by browsers, search engines, and services.
- Title and metadata:
<title>,<meta charset>,<meta name="viewport">. - Resources: CSS via
<link>, icons, preconnect/preload hints. - SEO/social: description, canonical URL, Open Graph/Twitter cards, robots.
- Scripts: critical scripts with
deferortype=module. - Base URL:
<base href="/">to resolve relative links.
Typical head:
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>CSE Study Portal</title>
<meta name="description" content="Study resources" />
<link rel="stylesheet" href="/styles.css" />
<link rel="icon" href="/favicon.ico" />
<script defer src="/main.js"></script>
</head>
Q12. What is FTP and why is it used?
Answer:
FTP (File Transfer Protocol) transfers files between a client and server over a network. In web development, it’s used to upload website files to a hosting server.
- How: Connect with host, username, password, port (21). Modes: active/passive.
- Security: Prefer SFTP (SSH File Transfer) or FTPS (FTP over TLS) to encrypt data.
- Clients: FileZilla, WinSCP; or command line (
ftp,sftp). - Use cases: Initial deploys, updating static assets, backups.