Application Developement MCQs and 2 marks cheat sheet, Cheat Sheet of Web Application Development

Easiest way to ans ADP ques in no time

Typology: Cheat Sheet

2025/2026

Available from 04/01/2026

ash-de-cruze
ash-de-cruze 🇮🇳

5 documents

1 / 24

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Ash was Here
VIVA VOCE
QUESTION BANK
Internet Programming Lab
HTML5 · CSS3 · Bootstrap · JavaScript · TypeScript · Linux · Git
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
2Product Catalogue — Internal CSS Internal CSS, Tables, Selectors
3Multi-Column Layout — External CSS External CSS, Flexbox, Grid
4JS Form Validation JavaScript, DOM, Regex, Events
5Form Creation via DOM createElement, appendChild, Events
6Fetch API Asynchronously fetch(), Promises, JSON, async
7TypeScript OOP Classes, Inheritance, Polymorphism
8Shell Script File Management mkdir, cp, mv, rm, ls
9Cron 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
"Prepared with precision. Every question counts."
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download Application Developement MCQs and 2 marks cheat sheet and more Cheat Sheet Web Application Development in PDF only on Docsity!

VIVA VOCE

QUESTION BANK

Internet Programming Lab

HTML5 · CSS3 · Bootstrap · JavaScript · TypeScript · Linux · Git

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

"Prepared with precision. Every question counts."

EX NO: 1A · Simple Webpage Creation Using HTML

Date: 26.02.

n HTML Document Structure

Q1. What does HTML stand for and what is its purpose?

ä 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.

Q2. Explain the DOCTYPE declaration. Why is it used?

ä tells the browser which version of HTML the document uses. In HTML5 it ensures the browser renders in standards mode, preventing quirks-mode rendering.

Q3. What is the difference between [html], [head], and [body] tags?

ä [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.

Q4. What is the role of the [title] tag?

ä 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.

Q5. What attributes does the [body] tag support and which are deprecated in HTML5?

ä 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

Q6. What is the purpose of the [center] tag? Is it valid in HTML5?

ä The [center] tag horizontally centers content. It is deprecated in HTML5 — use CSS text-align:center or margin:auto instead.

Q7. What does the font tag do and why is it obsolete?

ä 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.

Q8. Explain the difference between [b] and [strong], and [i] and [em].

ä [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.

Q9. What does [hr] do and what attributes can it take?

ä [hr] renders a horizontal rule (divider line). Attributes include width, color, size, align — though in HTML5 all styling should be done via CSS.

Q10. What is the [br] tag and how is it different from a paragraph break?

ä [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

Q11. What is the href='#' in anchor tags, and what does it do?

ä 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'.

Q12. How do you link to a specific section on the same page?

ä Give the target element an id attribute:. Then link to it: [a href='#about'>About[/a].

Q13. What is the difference between relative and absolute URLs in href?

ä 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).

Q14. How do you open a link in a new tab?

ä _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

Date: 26.02.

n Bootstrap Grid System

Q21. What is Bootstrap and what problem does it solve?

ä 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.

Q22. Explain Bootstrap's 12-column grid system.

ä 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.

Q23. What is the difference between .container and .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.

Q24. List all Bootstrap 5 breakpoints and their pixel widths.

ä xs (<576px), sm (576px), md (768px), lg (992px), xl (1200px), xxl (1400px). Classes: col-, col-sm-, col-md-, col-lg-, col-xl-, col-xxl-.

Q25. What does col-md-6 mean?

ä 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.

Q26. What are .row and .col classes? What happens without .row?

ä .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

Q27. What new input types were introduced in HTML5?

ä email, tel, url, number, range, date, time, datetime-local, month, week, color, search. These provide native validation and appropriate mobile keyboards.

Q28. What is the difference between [input type='radio'> and [input type='checkbox'>?

ä Radio buttons (sharing the same name) allow only one selection from a group. Checkboxes allow multiple selections independently.

Q29. What does the name attribute on a radio group do?

ä 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.

Q30. What is the purpose of the [label] element and how is it linked to inputs?

ä [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.

Q31. What does the action attribute on a [form] tag specify?

ä 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.

Q32. What is the [select] element and how is a default option set?

ä [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

Q33. What does the .form-control class do in Bootstrap?

ä Applies full-width display, consistent padding, border, border-radius, background-color, and focus styles to input, textarea, and select elements.

Q34. What is the .btn class and how is .btn-warning different from .btn-custom?

ä .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.

Q35. What does the .d-grid class do?

ä Sets display:grid on the element. Combined with a .btn inside, it makes the button stretch to full container width without needing width:100%.

Q36. How does Bootstrap's .mb-3 class work?

ä 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.

Q37. What is the viewport meta tag and why is it essential for responsiveness?

ä [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

Q38. Explain box-shadow with example from the code.

ä 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.

Q39. What is border-radius and how does it work?

ä 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.

Q40. What does the :hover pseudo-class do?

ä :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

Q54. What are the different ways to specify color values in CSS?

ä 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.

Q55. What does font-size:22px vs font-size:1.5rem mean?

ä 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

Date: 04.03.

n External CSS

Q56. How do you link an external CSS file to HTML?

ä [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.

Q57. What are the advantages of external CSS over internal and inline?

ä Separation of concerns (structure vs style), reusability across multiple pages, browser caching (CSS file cached separately), easier maintenance, smaller HTML files.

Q58. What is the CSS cascade and how do multiple stylesheets interact?

ä The cascade determines which styles apply when multiple rules conflict. Order: browser defaultsexternalinternalinline. Later declarations override earlier ones at the same specificity level.

n CSS Layout Techniques

Q59. What is CSS Flexbox and how is it different from CSS Grid?

ä 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.

Q60. How do you create a multi-column layout using CSS float?

ä 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.

Q61. What is the CSS Grid layout? Name key properties.

ä 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.

Q62. What is the difference between justify-content and align-items in Flexbox?

ä 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

Q63. Explain the five CSS position values.

ä 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).

Q64. What does position:absolute with top:0 and left:0 do?

ä 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).

Q65. What is z-index and when does it apply?

ä 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

Q66. What is a CSS media query and how do you write one?

ä @media (max-width: 768px) { ... } applies styles only when the viewport is 768px or less. Common breakpoints: 576px (phones), 768px (tablets), 992px (laptops), 1200px (desktops).

Q67. What is mobile-first vs desktop-first CSS design?

ä 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

Date: 04.03.

n JavaScript Basics

Q71. What is JavaScript and what role does it play in web development?

ä 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).

Q72. What is the difference between var, let, and const?

ä 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).

Q73. What does the return false statement do inside a form's onsubmit handler?

ä 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.

Q74. What is event bubbling and how does it relate to form validation?

ä 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

Q75. What does document.getElementById() return?

ä 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.

Q76. What is the difference between .value, .innerHTML, and .textContent?

ä .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.

Q77. How do you reset all error messages before re-validating?

ä 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.

Q78. What does the trim() method do and why is it important in validation?

ä 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

Q79. How do you validate an email format using JavaScript?

ä 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.

Q80. What is a regular expression (regex)? Explain the expiry pattern used.

ä 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.

Q81. What does isNaN() do in the CVV validation?

ä 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.

Q82. What is the difference between == and === in JavaScript?

ä == (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.

Q83. How does the dummy login check work in the code?

ä 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

Q84. What does the ::before pseudo-element do in the login container?

ä ::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.

Q85. Explain the CSS for the input focus state.

ä 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

Date: 10.03.

n Asynchronous JavaScript

Q99. What is synchronous vs asynchronous programming?

ä 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.

Q100. What is a callback function and what problems does it cause?

ä 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.

Q101. What is a Promise in JavaScript?

ä 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().

Q102. Explain the async/await syntax and how it relates to Promises.

ä 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.

Q103. What is the event loop and how does it enable async JavaScript?

ä 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

Q104. What is the 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.

Q105. Why does fetch() require two .then() calls?

ä 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.

Q106. What is JSON and what does response.json() do?

ä 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.

Q107. What API was used in Ex 6 and what does it return?

ä 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.

Q108. What does .catch() do in the fetch chain?

ä .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.

Q109. What HTTP methods does fetch support?

ä 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: {...} }).

Q110. What is CORS and when does it affect fetch requests?

ä 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.

Q111. What does forEach() do on an array?

ä 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

Date: 16.03.

n Shell Scripting Basics

Q125. What is a shell script?

ä 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.

Q126. What is the shebang line (#!/bin/bash)?

ä 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.

Q127. How do you make a shell script executable?

ä 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

Q128. What does mkdir do and what is the -p flag?

ä 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.

Q129. What does the touch command do?

ä 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.

Q130. What does ls do and what are common flags?

ä 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.

Q131. Explain the cp command syntax.

ä 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.

Q132. What does mv do and how is it used for both moving and renaming?

ä 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.

Q133. What does rm do and what is the danger with rm -rf?

ä 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.

Q134. What is the difference between > and >> in shell?

ä > 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.

Q135. What does echo do?

ä 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

Q136. What are Linux file permissions and how are they read?

ä 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.

Q137. What is the difference between absolute and symbolic chmod?

ä 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

Date: 25.03.

n Git Fundamentals

Q149. What is Git and what problem does it solve?

ä 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.

Q150. What is the difference between Git and GitHub?

ä 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.

Q151. Explain the three states in Git's workflow.

ä Working Directory: files you're editing. Staging Area (Index): files marked for the next commit with git add. Repository (.git folder): committed snapshots. Workflow: modifystagecommit.

Q152. What does git init do?

ä 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.

Q153. What is the HEAD in Git?

ä 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

Q154. What does git clone do?

ä 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.

Q155. What is the difference between git add. and git add filename?

ä 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.

Q156. What does git commit -m 'message' do?

ä 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).

Q157. What does git status show?

ä 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.

Q158. What is git push and git pull?

ä 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.

Q159. What does git log show and what is git log --oneline?

ä 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

Q160. What is a Git branch and why use them?

ä 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.

Q161. What is the difference between git branch and git checkout?

ä 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.

Q162. What happens during a git merge?

ä 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.

Q163. What is a merge conflict and how do you resolve it?

ä 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.

Q164. What is git commit -am and when can it be used?

ä 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.