
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Easiest way to ans ADP ques in no time
Typology: Cheat Sheet
1 / 24
This page cannot be seen from the preview
Don't miss anything!

















Experiments 1–12 | 60 Periods
Ex Experiment Title Topics
1A Simple Webpage using HTML Tags, Structure, Nav, Tables
1B Bootstrap Registration Form Bootstrap Grid, CSS3, Forms
2 Product Catalogue — Internal CSS Internal CSS, Tables, Selectors
3 Multi-Column Layout — External CSS External CSS, Flexbox, Grid
4 JS Form Validation JavaScript, DOM, Regex, Events
5 Form Creation via DOM createElement, appendChild, Events
6 Fetch API Asynchronously fetch(), Promises, JSON, async
7 TypeScript OOP Classes, Inheritance, Polymorphism
8 Shell Script File Management mkdir, cp, mv, rm, ls
9 Cron Job Scheduling cron, loops, sleep, log files
10 Git Version Control clone, commit, branch, merge
11 GitHub Collaboration fork, pull request, conflicts
12 GitHub Pages Deployment Static site, git push, Pages
EX NO: 1A · Simple Webpage Creation Using HTML
n HTML Document Structure
ä HTML stands for HyperText Markup Language. It is the standard markup language for creating web pages — it defines the structure and content of a webpage using elements/tags.
ä tells the browser which version of HTML the document uses. In HTML5 it ensures the browser renders in standards mode, preventing quirks-mode rendering.
ä [html] is the root element wrapping all content. [head] contains metadata (title, links, scripts) not visible to the user. [body] contains all visible page content.
ä The [title] tag defines the text shown in the browser's title bar or tab. It is also used by search engines as the page title in results.
ä bgcolor, text, link, vlink, alink are all deprecated in HTML5. Styling should be done via CSS (background-color, color, etc.).
n Tags Used in Ex 1A
ä The [center] tag horizontally centers content. It is deprecated in HTML5 — use CSS text-align:center or margin:auto instead.
ä The [font] tag sets font size, face, and color. It is obsolete in HTML5 because CSS handles all text styling, keeping structure and presentation separate.
ä [b] is purely presentational (bold), while [strong] carries semantic meaning (important content). Similarly [i] is presentational italic, while [em] means emphasized content — screen readers treat them differently.
ä [hr] renders a horizontal rule (divider line). Attributes include width, color, size, align — though in HTML5 all styling should be done via CSS.
ä [br] inserts a single line break within the current block, while [/p][p] creates a new paragraph with margin spacing. [br] has no closing tag in HTML5.
n Links and Navigation
ä href='#' links to the top of the current page (a null anchor). It keeps the link clickable without navigating away. To link to a section, use href='#sectionId'.
ä Give the target element an id attribute:. Then link to it: [a href='#about'>About[/a].
ä Absolute URLs include the full protocol and domain (https://example.com/page). Relative URLs are relative to the current page (games.html, ../folder/page.html).
ä _Use the target='blank' attribute on the anchor tag. Best practice also includes rel='noopener noreferrer' for security.
EX NO: 1B · Responsive Registration Form — HTML5, CSS3, Bootstrap
n Bootstrap Grid System
ä Bootstrap is a free CSS framework with pre-built components, grid system, and JS plugins. It solves responsive design by providing a 12-column fluid grid and reusable UI components.
ä Bootstrap divides each row into 12 equal columns. You assign classes like col-md-6 to elements to specify how many columns they span. Rows must be inside a .container or .container-fluid.
ä .container has a fixed max-width that changes at each breakpoint (sm/md/lg/xl/xxl). .container-fluid always stretches 100% width of the viewport.
ä xs (<576px), sm ( ≥ 576px), md ( ≥ 768px), lg ( ≥ 992px), xl ( ≥ 1200px), xxl ( ≥ 1400px). Classes: col-, col-sm-, col-md-, col-lg-, col-xl-, col-xxl-.
ä The element spans 6 out of 12 columns on medium screens ( ≥ 768px) and above. On smaller screens it defaults to full width (col-12) unless a smaller breakpoint class is also specified.
ä .row creates a flex container that houses columns and applies negative margins. Without .row, columns won't align properly and Bootstrap's gutter system won't work.
n HTML5 Form Elements
ä email, tel, url, number, range, date, time, datetime-local, month, week, color, search. These provide native validation and appropriate mobile keyboards.
ä Radio buttons (sharing the same name) allow only one selection from a group. Checkboxes allow multiple selections independently.
ä Radio buttons with the same name attribute belong to the same group, ensuring only one can be selected at a time. Without matching names, they behave independently.
ä [label] provides a description for an input. Linked via for='inputId' matching the input's id attribute. Clicking the label focuses/activates the input — improves UX and accessibility.
ä action specifies the URL where the form data is submitted. Without it, the form submits to the current page. In the lab code, action='ATTI 1232.html' redirects after submission.
ä [select] creates a dropdown list. Options are defined with [option] tags. The selected attribute on an [option] tag sets it as the default choice.
n Bootstrap CSS Classes Used
ä Applies full-width display, consistent padding, border, border-radius, background-color, and focus styles to input, textarea, and select elements.
ä .btn is the base button class (provides padding, cursor, transition). .btn-warning applies Bootstrap's yellow color scheme. .btn-custom is a user-defined class for custom colors.
ä Sets display:grid on the element. Combined with a .btn inside, it makes the button stretch to full container width without needing width:100%.
ä mb-3 applies margin-bottom of 1rem (16px by default). Bootstrap uses a spacing scale: 0=0, 1=0.25rem, 2=0.5rem, 3=1rem, 4=1.5rem, 5=3rem.
ä [meta name="viewport" content="width=device-width, initial-scale=1.0"> tells the browser to set the viewport width equal to the device width and don't zoom by default. Without it, mobile browsers render at desktop width.
n CSS3 Properties in Ex 1B
ä box-shadow: 0 6px 20px rgba(0,0,0,0.5) — no horizontal offset, 6px vertical offset, 20px blur radius, semi-transparent black. Adds depth to the form card.
ä border-radius rounds the corners of an element's border box. border-radius:10px applies 10px rounding to all corners. Can be set per corner: top-left, top-right, bottom-right, bottom-left.
ä :hover applies styles when the user's pointer is over the element. Used in .btn-custom:hover to change background color, providing visual feedback on interaction.
ä Applying to tr sets the entire row background. Applying to td sets individual cell backgrounds. If td also has a background set, it overrides the tr background due to specificity.
n CSS Colors and Values
ä Named colors (red, maroon), Hex (#800000), RGB (rgb(128,0,0)), RGBA (rgba(128,0,0,0.5)), HSL (hsl(0,100%,25%)), HSLA. RGBA and HSLA include an alpha transparency channel.
ä px is an absolute unit (pixels). rem is relative to the root element's font-size (usually 16px), so 1.5rem = 24px. rem is preferred for accessibility as it respects user font size settings.
EX NO: 3 · Multi-Column Layout Using External CSS
n External CSS
ä [link rel="stylesheet" href="style.css"> placed in the [head]. rel="stylesheet" specifies the relationship type, href points to the file path. Multiple [link] tags can be used for multiple CSS files.
ä Separation of concerns (structure vs style), reusability across multiple pages, browser caching (CSS file cached separately), easier maintenance, smaller HTML files.
ä The cascade determines which styles apply when multiple rules conflict. Order: browser defaults → external → internal → inline. Later declarations override earlier ones at the same specificity level.
n CSS Layout Techniques
ä Flexbox is one-dimensional — arranges items in a row or column. Grid is two-dimensional — controls both rows and columns simultaneously. Flexbox is ideal for navigation bars; Grid suits page layouts.
ä Set float:left on column divs with defined widths (e.g., width:30%). Add a clearfix or overflow:hidden on the parent to contain floated children.
ä display:grid enables CSS Grid. Key properties: grid-template-columns, grid-template-rows, gap, grid-column, grid-row, justify-items, align-items, grid-template-areas.
ä justify-content aligns flex items along the main axis (horizontal for row). align-items aligns items along the cross axis (vertical for row). Values: flex-start, flex-end, center, space-between, space-around, stretch.
n CSS Positioning
ä static (default, normal flow), relative (offset from own normal position), absolute (positioned relative to nearest positioned ancestor), fixed (relative to viewport), sticky (toggles between relative and fixed).
ä Places the element at the top-left corner of its nearest ancestor that has position set to anything other than static. If no such ancestor exists, it's relative to the initial containing block (viewport).
ä z-index controls the stacking order of positioned elements (position != static). Higher z-index appears on top. Elements with the same z-index are stacked by source order.
n Responsive Design
ä @media (max-width: 768px) { ... } applies styles only when the viewport is 768px or less. Common breakpoints: 576px (phones), 768px (tablets), 992px (laptops), 1200px (desktops).
ä Mobile-first: write base styles for mobile, use min-width media queries to enhance for larger screens. Desktop-first: write for desktop, use max-width queries to adapt for smaller screens. Mobile-first is generally recommended.
EX NO: 4 · Form Validation Using JavaScript
n JavaScript Basics
ä JavaScript is a high-level, interpreted scripting language. It adds interactivity to webpages — form validation, DOM manipulation, event handling, animations, and API communication. It runs in the browser (client-side) and on servers (Node.js).
ä var: function-scoped, hoisted, re-declarable. let: block-scoped, not hoisted to usable state, reassignable. const: block-scoped, must be initialized, cannot be reassigned (though object properties can change).
ä Returning false from an onsubmit event handler prevents the default form submission action (page reload/navigation). The form data is not sent to the server, allowing validation to stop the process.
ä Event bubbling means events propagate from the target element up through ancestors. For form validation, we typically call event.preventDefault() rather than return false to stop submission while still handling the event.
n DOM Manipulation in Validation
ä Returns the first element in the document with the specified id, or null if none exists. It returns an HTMLElement object — you can then access .value, .innerHTML, .style, etc.
ä .value reads/sets the value of form inputs (input, select, textarea). .innerHTML reads/sets HTML content including tags — XSS risk. .textContent reads/sets plain text only — safer.
ä Set innerHTML = "" on each error div before running validation checks. This clears previous messages and ensures only current errors show. Alternatively use classList.remove() to hide error elements.
ä trim() removes whitespace (spaces, tabs, newlines) from both ends of a string. Critical in validation — without it, a user entering only spaces would pass an empty-check but submit meaningless data.
n Validation Logic
ä Use a regular expression: /^[^\s@]+@[^\s@]+.[^\s@]+$/.test(email). The HTML5 type='email' also provides basic validation, but JS regex allows custom error messages and more control.
ä A regex is a pattern for matching strings. /^(0[1-9]|1[0-2])/\d{2}$/ matches MM/YY: ^ anchors start, (0[1-9]|1[0-2]) matches months 01-12, / matches the slash, \d{2} matches 2 digits, $ anchors end.
ä isNaN() (is Not a Number) returns true if the argument cannot be converted to a number. isNaN('abc') = true, isNaN('123') = false. Used to ensure CVV/card number contains only digits.
ä == (loose equality) compares values after type coercion: '5' == 5 is true. === (strict equality) compares both value and type: '5' === 5 is false. Always prefer === to avoid unexpected coercion bugs.
ä After field-level validation passes (valid=true), it checks if email equals '[email protected]' AND password equals '1234'. If both match, shows 'Login Successful!' alert. Otherwise 'Invalid Credentials'. Real apps use server-side authentication.
n CSS in Login Form
ä ::before inserts a pseudo-element as the first child of .login-container. Here it creates the red top accent bar (height:3px, background:#ff2e2e, position:absolute) without adding extra HTML.
ä input:focus applies when the input is active. border-color:#ff2e2e changes border to red and box-shadow:0 0 8px rgba(255,46,46,0.4) adds a glowing red effect, providing clear visual focus feedback.
ä element.classList.add('className') adds a class, classList.remove('className') removes it, classList.toggle('className') toggles it. classList.contains() checks if the class exists.
EX NO: 6 · Fetch Data from API — JavaScript Asynchronous
n Asynchronous JavaScript
ä Synchronous code executes line by line — each operation waits for the previous one to complete (blocking). Asynchronous code doesn't block — operations like network requests run in the background, and callbacks/promises handle results when ready.
ä A callback is a function passed as an argument to another function, to be executed later. Nested callbacks create 'callback hell' — deeply nested, hard-to-read pyramid code that's difficult to maintain and debug.
ä A Promise represents a value that may be available now, in the future, or never. It has three states: pending (initial), fulfilled (resolved with a value), rejected (failed with a reason). Promises chain with .then() and .catch().
ä async/await is syntactic sugar over Promises. An async function returns a Promise. await pauses execution until the Promise resolves, making async code read like synchronous code. Errors handled with try/catch.
ä The event loop monitors the call stack and callback queue. When the call stack is empty, it pushes callbacks from the queue. This allows async operations (timers, network) to run without blocking the main thread.
n Fetch API
ä fetch() is a built-in browser API for making HTTP requests. It returns a Promise that resolves to a Response object. It replaces older XMLHttpRequest (XHR) with a cleaner, Promise-based interface.
ä The first .then(response => response.json()) waits for the HTTP response headers and parses the body as JSON — this itself returns a Promise. The second .then(data => ...) runs when the JSON parsing is complete.
ä JSON (JavaScript Object Notation) is a lightweight data-interchange format. response.json() reads the response body stream and parses it as JSON, returning a Promise that resolves with the resulting JavaScript object/array.
ä JSONPlaceholder (jsonplaceholder.typicode.com/users) — a free fake REST API for testing. It returns an array of 10 user objects, each with name, email, address, phone, website, and company properties.
ä .catch(error => ...) handles any rejection in the promise chain — network errors, parsing failures, etc. Without it, unhandled rejections are silently swallowed. Always include error handling in production code.
ä GET (default, fetch data), POST (create data), PUT (replace data), PATCH (update partial data), DELETE (remove data). Specify with: fetch(url, { method: 'POST', body: JSON.stringify(data), headers: {...} }).
ä CORS (Cross-Origin Resource Sharing) is a browser security mechanism that blocks requests to a different origin (domain/protocol/port). Servers must include Access-Control-Allow-Origin headers to permit cross-origin fetch calls.
ä forEach() iterates over each element of an array, executing a callback function for each. It doesn't return a value (unlike map()). Here: data.forEach(user => result += '[li]' + user.name + '[/li]') builds an HTML list.
EX NO: 8 · File Management Using Linux Shell Script
n Shell Scripting Basics
ä A shell script is a text file containing a sequence of shell commands executed by the shell interpreter. It automates repetitive tasks. Begins with a shebang line: #!/bin/bash specifying the interpreter.
ä The shebang (#!) at the start of a script specifies which interpreter to use. #!/bin/bash means use Bash. #!/usr/bin/env bash is more portable, finding bash in PATH. Without it, the system's default shell is used.
ä Use chmod +x script.sh to add execute permission. Then run it with ./script.sh (relative path) or provide the full path. Alternatively run with bash script.sh without needing execute permission.
n File Management Commands Used
ä mkdir creates a directory. mkdir myfolder creates 'myfolder'. mkdir -p path/to/nested/dir creates all intermediate directories without error if they exist. Without -p, it fails if a parent directory is missing.
ä touch creates an empty file if it doesn't exist. If the file exists, it updates its access and modification timestamps. Used here to create file1.txt and file2.txt inside myfolder.
ä ls lists directory contents. -l: long format (permissions, size, date). -a: all files including hidden (dot files). -h: human-readable sizes. -la or -lah combines flags. Here ls myfolder lists files inside myfolder.
ä cp source destination copies files. cp file1.txt backup.txt creates a copy. cp -r folder/ dest/ copies a directory recursively. Here: cp myfolder/file1.txt myfolder/file1_copy.txt creates a copy in the same directory.
ä mv source destination moves files. If source and destination are in the same directory, it renames the file: mv file2.txt file2_renamed.txt. To move: mv file.txt /other/dir/file.txt.
ä rm removes files. rm file.txt deletes a single file. rm -r dir/ deletes a directory recursively. rm -rf dir/ forces recursive deletion without prompting — extremely dangerous if run with wrong path as it cannot be undone.
ä > redirects output to a file, overwriting existing content. >> appends output to a file. echo 'text' >> file.txt adds 'text' as a new line. Used in Ex 9 to append log entries: echo 'Log' >> logfile.txt.
ä echo prints its arguments to standard output (terminal). echo 'Hello' prints Hello. echo $variable prints the variable's value. With -e flag, interprets escape sequences like \n (newline) and \t (tab).
n File Permissions
ä Permissions are shown as rwxrwxrwx — three groups of three: owner, group, others. r=read(4), w=write(2), x=execute(1). chmod 755 = rwxr-xr-x: owner has all, group/others have read+execute.
ä Absolute (numeric): chmod 644 file sets exact permissions. Symbolic: chmod +x file adds execute, chmod -w file removes write, chmod u+x file adds execute for owner only.
EX NO: 10 · Git Version Control Operations
n Git Fundamentals
ä Git is a distributed version control system (VCS) created by Linus Torvalds. It tracks changes to files over time, allows multiple people to collaborate, enables branching for parallel development, and lets you revert to any previous state.
ä Git is the version control tool that runs locally. GitHub is a cloud hosting platform for Git repositories that adds collaboration features: pull requests, issues, Actions (CI/CD), project boards, and code review.
ä Working Directory: files you're editing. Staging Area (Index): files marked for the next commit with git add. Repository (.git folder): committed snapshots. Workflow: modify → stage → commit.
ä Initializes a new Git repository in the current directory, creating a hidden .git folder containing the repository data (object store, refs, HEAD, config). Run once per project.
ä HEAD is a pointer to the currently checked-out commit (usually the tip of the current branch). 'Detached HEAD' means HEAD points directly to a commit, not a branch. HEAD~1 refers to one commit before HEAD.
n Core Git Commands
ä git clone creates a local copy of a remote repository, including all commits, branches, and files. It sets up 'origin' as the remote name pointing to the cloned URL.
ä git add. stages all modified and new files in the current directory and subdirectories. git add filename stages only the specified file. git add -p stages changes interactively, hunk by hunk.
ä Creates a permanent snapshot of staged changes in the repository with the given message. Each commit has a unique SHA- hash, author, timestamp, and reference to parent commit(s).
ä Shows the state of the working directory and staging area: which files are modified, untracked, or staged. Also shows the current branch and whether it's ahead/behind the remote.
ä git push origin main uploads local commits to the remote repository (GitHub). git pull origin main fetches remote changes and merges them into the current branch. git fetch only downloads without merging.
ä git log shows commit history with full hash, author, date, and message. --oneline shows condensed one-line-per-commit format with short hash. --graph adds ASCII branch visualization.
n Branching and Merging
ä A branch is a lightweight pointer to a specific commit. Branches allow parallel development — features, bugfixes, and experiments in isolation without affecting main/production code. Merging integrates changes back.
ä git branch feature creates a new branch without switching to it. git checkout feature switches to an existing branch. git checkout -b feature creates AND switches in one command. Modern Git uses git switch instead.
ä git merge integrates changes from one branch into another. Fast-forward merge moves the pointer forward when no divergence. Three-way merge creates a new merge commit when both branches have diverged.
ä A merge conflict occurs when the same lines in a file were modified differently in both branches. Git marks the conflict in the file with <<<<<<, =======, >>>>>>>. You manually edit to resolve, then git add and git commit.
ä git commit -am 'message' stages ALL tracked modified files (-a) and commits them. It cannot stage new/untracked files (git add still needed for those). A convenience shortcut for tracked files only.