πŸŽ‰ New: Top 75 PHP Interview Questions for 2026 β€” Free for all learners

MongoDB Cheatsheet β€” Complete MongoDB Commands, Queries & Aggregation Guide

MongoDB Cheatsheet β€” Quick Reference for NoSQL Developers

MongoDB is a NoSQL document-based database designed for high scalability, flexibility, and performance. Instead of storing data in tables like SQL, MongoDB uses JSON-like documents known as BSON (Binary JSON).

This MongoDB Cheatsheet provides essential syntax, commands, and examples to help you query and manage databases effectively.


Basic MongoDB Concepts

TermDescription
DatabaseA container for collections.
CollectionSimilar to a table in SQL.
DocumentJSON-like data structure.
FieldKey-value pair inside a document.
BSONBinary JSON format used for data storage.

Example Document:

{
  "_id": 1,
  "name": "John Doe",
  "age": 30,
  "skills": ["Python", "MongoDB", "Node.js"]
}

MongoDB Shell Basics

CommandDescription
show dbsList all databases
use myDatabaseSwitch or create a database
show collectionsList collections in the current database
db.dropDatabase()Delete current database

CRUD Operations in MongoDB

CRUD = Create, Read, Update, Delete β€” the four basic operations in MongoDB.


Insert Documents

Insert a single document:

db.users.insertOne({ name: "Alice", age: 28, city: "New York" });

Insert multiple documents:

db.users.insertMany([
  { name: "Bob", age: 32 },
  { name: "Charlie", age: 25 }
]);

Read Documents

Retrieve all documents:

db.users.find();

Find documents with condition:

db.users.find({ age: { $gt: 25 } });

Pretty print results:

db.users.find().pretty();

Update Documents

Update one document:

db.users.updateOne(
  { name: "Alice" },
  { $set: { age: 29 } }
);

Update multiple documents:

db.users.updateMany(
  { city: "New York" },
  { $set: { city: "Los Angeles" } }
);

Delete Documents

Delete one:

db.users.deleteOne({ name: "Charlie" });

Delete many:

db.users.deleteMany({ age: { $lt: 25 } });

MongoDB Query Operators

OperatorDescriptionExample
$eqEquals{ age: { $eq: 25 } }
$neNot equal{ city: { $ne: "London" } }
$gt / $ltGreater/Less than{ age: { $gt: 20 } }
$in / $ninIn/Not in list{ city: { $in: ["Delhi", "Paris"] } }
$andLogical AND{ $and: [{ age: { $gt: 20 } }, { city: "Paris" }] }
$orLogical OR{ $or: [{ city: "London" }, { city: "Berlin" }] }
$existsCheck if field exists{ phone: { $exists: true } }
mongodb cheatsheet, mongodb tutorial for beginners, mongodb commands list, mongodb query examples, mongodb aggregation pipeline, mongodb vs sql, mongodb update query, mongodb insert example, mongodb index, nosql database guide

MongoDB Projection

Select specific fields to return in the query result.

db.users.find({}, { name: 1, city: 1, _id: 0 });

MongoDB Sorting and Limiting

db.users.find().sort({ age: 1 }); // Ascending
db.users.find().sort({ age: -1 }); // Descending
db.users.find().limit(5); // First 5 documents

Aggregation Pipeline

Aggregation allows data transformation and computation like SQL GROUP BY.

Basic example:

db.users.aggregate([
  { $match: { age: { $gte: 25 } } },
  { $group: { _id: "$city", total: { $sum: 1 } } }
]);

Common Aggregation Operators:

OperatorUsageExample
$matchFilter documents{ $match: { city: "London" } }
$groupGroup by field{ $group: { _id: "$city", total: { $sum: 1 } } }
$sortSort results{ $sort: { total: -1 } }
$projectSelect specific fields{ $project: { name: 1, city: 1 } }
$limitLimit number of results{ $limit: 10 }

MongoDB Indexing

Indexes speed up data retrieval operations.

Create an index:

db.users.createIndex({ name: 1 });

View indexes:

db.users.getIndexes();

Drop an index:

db.users.dropIndex("name_1");

MongoDB Relationships (Embedding vs Referencing)

TypeDescriptionExample
EmbeddingStore related data in the same document.{ name: "Alice", address: { city: "NY", zip: 10001 } }
ReferencingStore reference (ID) to another collection.{ user_id: ObjectId("..."), order_id: ObjectId("...") }

Tip: Use embedding for one-to-few and referencing for one-to-many relationships.


MongoDB Backup and Restore

Backup a database:

mongodump --db myDatabase --out /backup/

Restore a database:

mongorestore /backup/myDatabase

FAQ β€” MongoDB Cheatsheet

Q1: What is MongoDB used for?
MongoDB is used for storing unstructured or semi-structured data in JSON format for web apps, analytics, and IoT platforms.

Q2: Is MongoDB faster than SQL?
For large, unstructured data and high read/write operations, MongoDB can outperform traditional SQL databases.

Q3: How is data stored in MongoDB?
MongoDB stores data as BSON documents inside collections.

Q4: What language is MongoDB written in?
MongoDB is written in C++, JavaScript, and Go.

Q5: What is the default port for MongoDB?
The default port number is 27017.

SQL Cheatsheet β€” Quick Reference for Beginners and Professionals

Structured Query Language (SQL) is the standard language used for managing and manipulating databases.
This SQL Cheatsheet is your complete quick reference for creating, updating, and managing data β€” whether you use MySQL, SQL Server, PostgreSQL, or Oracle.


SQL Basics for Beginners

CommandPurposeExample
CREATE DATABASECreates a new databaseCREATE DATABASE company;
USESelects a databaseUSE company;
CREATE TABLECreates a new tableCREATE TABLE employees (id INT, name VARCHAR(50));
DROP TABLEDeletes a tableDROP TABLE employees;
ALTER TABLEModifies a table structureALTER TABLE employees ADD salary INT;

SQL Data Types

CategoryData TypesExample
NumericINT, FLOAT, DECIMALsalary DECIMAL(10,2)
StringCHAR, VARCHAR, TEXTname VARCHAR(100)
Date/TimeDATE, TIME, DATETIME, TIMESTAMPcreated_at DATETIME
BooleanBOOLEAN, BITis_active BOOLEAN

Inserting and Updating Data in SQL

Insert Data into a Table

INSERT INTO employees (id, name, salary)
VALUES (1, 'John Doe', 60000);

Update Existing Records

UPDATE employees
SET salary = 70000
WHERE id = 1;

Delete a Record

DELETE FROM employees
WHERE id = 1;

SQL SELECT Statement Explained

The SELECT statement is used to retrieve data from one or more tables.

SELECT name, salary FROM employees;

Aliases Example:

SELECT name AS EmployeeName, salary AS MonthlySalary FROM employees;

SQL WHERE Clause

Used to filter records based on a condition.

SELECT * FROM employees WHERE salary > 50000;

Common Operators:
=, !=, >, <, >=, <=, BETWEEN, IN, LIKE, IS NULL

Example:

SELECT * FROM employees WHERE name LIKE 'J%';

SQL ORDER BY Clause

Sorts the result in ascending (ASC) or descending (DESC) order.

SELECT * FROM employees ORDER BY salary DESC;

SQL GROUP BY and HAVING Clauses

GROUP BY groups similar data.
HAVING filters aggregated data.

SELECT department, COUNT(*) AS total_employees
FROM employees
GROUP BY department
HAVING COUNT(*) > 5;

SQL Joins β€” Combining Data from Multiple Tables

TypeDescriptionExample
INNER JOINReturns matching records from both tablesSELECT * FROM employees e INNER JOIN departments d ON e.dept_id = d.id;
LEFT JOINAll records from left + matched from rightSELECT * FROM employees e LEFT JOIN departments d ON e.dept_id = d.id;
RIGHT JOINAll records from right + matched from leftSELECT * FROM employees e RIGHT JOIN departments d ON e.dept_id = d.id;
FULL JOINAll records when there is a matchSELECT * FROM employees e FULL JOIN departments d ON e.dept_id = d.id;

SQL Aggregate Functions

FunctionDescriptionExample
COUNT()Returns number of rowsSELECT COUNT(*) FROM employees;
SUM()Returns total sumSELECT SUM(salary) FROM employees;
AVG()Returns average valueSELECT AVG(salary) FROM employees;
MIN()Returns minimum valueSELECT MIN(salary) FROM employees;
MAX()Returns maximum valueSELECT MAX(salary) FROM employees;
sql cheatsheet, sql tutorial, sql queries with examples, sql commands list, sql joins explained, sql functions, sql interview questions, database query guide, mysql cheatsheet, sql for beginners

SQL Constraints

ConstraintPurposeExample
PRIMARY KEYUniquely identifies each recordid INT PRIMARY KEY
FOREIGN KEYLinks to another tableFOREIGN KEY (dept_id) REFERENCES departments(id)
NOT NULLEnsures column cannot be nullname VARCHAR(50) NOT NULL
UNIQUEPrevents duplicate valuesemail VARCHAR(100) UNIQUE
CHECKValidates dataCHECK (salary > 0)
DEFAULTSets default valuestatus VARCHAR(10) DEFAULT 'Active'

SQL Subqueries

A subquery is a query inside another query.

SELECT name, salary
FROM employees
WHERE salary > (SELECT AVG(salary) FROM employees);

SQL Views

A view is a virtual table.

CREATE VIEW high_salary AS
SELECT name, salary FROM employees WHERE salary > 70000;

SQL Indexes

Indexes improve query performance.

CREATE INDEX idx_name ON employees(name);

SQL Transactions

Used for safe execution of multiple statements.

BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;

Use ROLLBACK; to undo changes.


SQL Interview Questions

Q1. What is the difference between WHERE and HAVING?
➑️ WHERE filters rows before grouping, HAVING filters after grouping.

Q2. What is normalization?
➑️ The process of organizing data to reduce redundancy.

Q3. What is a foreign key?
➑️ It’s a constraint that creates a relationship between two tables.

Q4. What is the difference between INNER JOIN and OUTER JOIN?
➑️ INNER JOIN returns matched rows only, while OUTER JOIN returns all rows including unmatched ones.


FAQ β€” SQL Cheatsheet

Q1: What is SQL used for?
SQL is used to store, retrieve, and manipulate data in relational databases.

Q2: Which databases use SQL?
MySQL, PostgreSQL, SQL Server, Oracle, and SQLite all use SQL syntax.

Q3: Is SQL case-sensitive?
SQL keywords are not case-sensitive, but string comparisons may be.

Q4: What are DDL, DML, and DCL commands?

  • DDL: Data Definition Language (CREATE, ALTER, DROP)
  • DML: Data Manipulation Language (INSERT, UPDATE, DELETE)
  • DCL: Data Control Language (GRANT, REVOKE)

C# Cheat Sheet β€” Complete Syntax, OOP Concepts, and Examples

C# Cheat Sheet β€” Quick Reference Guide for Developers

C# (C-Sharp) is a modern, object-oriented programming language developed by Microsoft. It runs on the .NET framework and is widely used for building desktop apps, web apps, games, and enterprise software.

This C# Cheatsheet gives you a quick and complete overview of all major topics β€” from basic syntax to advanced OOP and LINQ β€” with easy-to-understand examples for practical learning.


C# Basics for Beginners

ConceptDescriptionExample
File Extension.csProgram.cs
NamespaceOrganizes classesnamespace DemoApp { }
Entry PointMain methodstatic void Main()
CommentsSingle or multi-line// Comment or /* Comment */

Example:

using System;

namespace HelloWorld {
    class Program {
        static void Main() {
            Console.WriteLine("Hello, C#!");
        }
    }
}

Data Types in C#

TypeKeywordSize (bytes)Example
Integerint4int age = 25;
Floating-pointfloat, double, decimal4 / 8 / 16float price = 12.5F;
Characterchar2char grade = 'A';
Booleanbool1bool isValid = true;
StringstringVariablestring name = "John";
ObjectobjectAny typeobject data = 42;

C# Variables and Constants

int x = 10;
const double PI = 3.1416;
var message = "Hello!";
  • var allows type inference at compile time.
  • const defines immutable values.

Operators in C#

CategoryOperatorsExample
Arithmetic+ - * / %x + y
Relational== != > < >= <=if(a > b)
Logical`&&
Assignment= += -= *= /=x += 5;
Conditional?:result = (a > b) ? a : b;
Null-Coalescing??value = name ?? "Guest";

Conditional Statements in C#

if (x > 0)
    Console.WriteLine("Positive");
else if (x < 0)
    Console.WriteLine("Negative");
else
    Console.WriteLine("Zero");

Switch Example:

switch (day) {
    case 1: Console.WriteLine("Monday"); break;
    default: Console.WriteLine("Invalid"); break;
}

Loops in C#

TypeSyntaxExample
forfor(init; condition; increment)for(int i=0;i<5;i++)
whilewhile(condition)while(i<10)
do-whiledo { } while(condition);Executes once
foreachforeach(var item in collection)Loops through arrays or lists

Example:

foreach (int n in new int[]{1,2,3})
    Console.WriteLine(n);

C# Functions (Methods)

int Add(int a, int b) {
    return a + b;
}
  • Static Methods: Belong to the class, not instance.
  • Overloading: Same name, different parameters.
  • Default Parameters: void Greet(string name="User").

C# Object-Oriented Programming (OOP)

ConceptDefinitionExample
ClassBlueprint for objectsclass Car { }
ObjectInstance of classCar myCar = new Car();
EncapsulationData hiding via access modifiersprivate int age;
InheritanceReusing base classclass Child : Parent
PolymorphismMethod overridingvirtual and override
AbstractionHiding complexityabstract class Shape {}

Example:

class Animal {
    public virtual void Speak() {
        Console.WriteLine("Animal sound");
    }
}

class Dog : Animal {
    public override void Speak() {
        Console.WriteLine("Bark");
    }
}

C# Collections

TypeNamespaceExample
ArraySystemint[] nums = {1,2,3};
ListSystem.Collections.GenericList<int> list = new List<int>();
DictionarySystem.Collections.GenericDictionary<int,string> dict = new();
QueueFIFOQueue<string> q = new();
StackLIFOStack<int> s = new();
c# cheatsheet, c# programming tutorial, c# syntax guide, c# interview questions, c# oops concepts, c# examples for beginners, c# operators, c# loops examples, c# collections, c# reference pdf

LINQ (Language Integrated Query)

LINQ simplifies querying data in collections.

int[] numbers = { 1, 2, 3, 4, 5 };
var even = from n in numbers where n % 2 == 0 select n;

foreach(var n in even)
    Console.WriteLine(n);

File Handling in C#

using System.IO;

File.WriteAllText("file.txt", "Hello C#");
string content = File.ReadAllText("file.txt");
Console.WriteLine(content);

Exception Handling in C#

try {
    int x = 0;
    int y = 10 / x;
}
catch (DivideByZeroException e) {
    Console.WriteLine(e.Message);
}
finally {
    Console.WriteLine("Cleanup code");
}

Asynchronous Programming in C#

async Task FetchData() {
    await Task.Delay(1000);
    Console.WriteLine("Data loaded");
}

C# Keywords Summary Table

KeywordPurpose
publicAccessible from anywhere
privateAccessible only within class
protectedAccessible in derived class
staticBelongs to class, not instance
constConstant value
readonlyAssigned only once
virtualOverridable method
overrideReplaces base method
abstractMust be implemented in child class
interfaceDefines contract
usingImports namespaces or disposes resources

FAQ β€” C# Programming

Q1: Is C# only used for Windows applications?
No, modern .NET Core allows C# apps to run on Windows, Linux, and macOS.

Q2: What is the difference between C++ and C#?
C++ is a compiled system-level language, while C# runs on the .NET runtime and is designed for managed, high-level development.

Q3: Can I use C# for game development?
Yes, Unity Engine uses C# for all its game scripts.

Q4: Is C# easy to learn for beginners?
Yes! Its syntax is clean, modern, and similar to C, Java, and JavaScript.

Q5: Where can I practice C# online?
Try the PHPOnline C# Compiler for running C# code instantly.

C++ Programming Cheat Sheet β€” Complete Syntax, OOP Concepts, and Examples for Beginners

C++ Programming Language Cheat Sheet (Complete Syntax, OOP Concepts, and Examples)

C++ Programming Language Cheat Sheet β€” Complete Reference for Developers

C++ is a high-performance, general-purpose programming language developed by Bjarne Stroustrup as an extension of C. It supports object-oriented programming (OOP), templates, and Standard Template Library (STL) β€” making it one of the most versatile languages for software, game, and system development.

This C++ Cheatsheet provides an easy-to-follow, structured overview of all the key syntax, features, and examples you need to become proficient in C++ programming.


C++ Basics for Beginners

ConceptDetailsExample
File Extension.cppmain.cpp
CompilerGCC, Turbo C++, Clangg++ main.cpp -o main
ExecutionRun compiled file./main
Header FilePreprocessor directives#include <iostream>
NamespaceAvoids naming conflictsusing namespace std;

Example:

#include <iostream>
using namespace std;

int main() {
    cout << "Hello, C++ World!";
    return 0;
}

Data Types and Variables in C++

TypeKeywordSize (bytes)Example
Integerint4int age = 25;
Floating-pointfloat, double4 / 8double pi = 3.1416;
Characterchar1char grade = 'A';
Booleanbool1bool isValid = true;
StringstringVariablestring name = "John";

C++ Operators

TypeOperatorsExample
Arithmetic+ - * / %x + y
Relational== != > < >= <=if (a > b)
Logical`&&
Assignment= += -= *= /=a += 10
Bitwise`&^ ~ << >>`
Ternary? :result = (a > b) ? a : b;
c++ programming cheat sheet, c++ syntax examples, c++ reference guide, c++ programming basics, c++ classes and objects, c++ oops concepts, c++ functions examples, c++ templates guide, c++ stl cheat sheet, c++ beginner tutorial

Input and Output in C++

C++ replaces the old scanf and printf with stream-based I/O.

Example:

#include <iostream>
using namespace std;

int main() {
    int age;
    cout << "Enter your age: ";
    cin >> age;
    cout << "You are " << age << " years old.";
    return 0;
}

Conditional Statements

TypeSyntaxExample
ifif (condition)if(x>0){}
if-elseif (condition) elseif(a>b) cout<<a; else cout<<b;
else-if ladderMultiple conditionsif(x>0)... else if(x<0)... else...
switchswitch(expression)switch(choice) { case 1: break; }

Loops in C++

TypeSyntaxExample
forfor(init; condition; inc)for(int i=0;i<5;i++)
whilewhile(condition)while(i<10)
do-whiledo{ }while(condition);Executes once before checking

Example:

for(int i = 1; i <= 5; i++) {
    cout << i << " ";
}

Functions in C++

TypeSyntaxExample
No returnvoid greet()void greet() { cout<<"Hi"; }
With returnint sum(int a, int b)return a+b;
Inline Functioninline int square(int x)Small reusable code
Default Argumentint add(int a, int b=5)Optional parameters

Example:

int add(int a, int b) {
    return a + b;
}

Object-Oriented Programming (OOP) Concepts in C++

ConceptDescriptionExample
ClassBlueprint of objectsclass Car { };
ObjectInstance of a classCar c1;
EncapsulationData hidingprivate: keyword
InheritanceReusing base classclass Child : public Parent
PolymorphismSame name, different behaviorvirtual void show()
AbstractionHiding implementation detailsUsing abstract classes
Constructor/DestructorInitialize or cleanupCar() {}, ~Car()

Example:

class Student {
    string name;
public:
    Student(string n) { name = n; }
    void display() { cout << "Name: " << name; }
};

int main() {
    Student s("Alice");
    s.display();
}

Arrays and Strings in C++

Array Example:

int marks[5] = {85, 90, 75, 88, 92};
for(int i=0; i<5; i++)
    cout << marks[i] << " ";

String Example:

string name = "C++ Programming";
cout << "Length: " << name.length();

Pointers in C++

ConceptDescriptionExample
Pointer Declarationint *ptr;Stores address
Address-of&variableGives memory address
Dereference*ptrAccess value

Example:

int num = 10;
int *ptr = &num;
cout << *ptr; // Output: 10

File Handling in C++

ModeMeaning
ios::inRead mode
ios::outWrite mode
ios::appAppend mode

Example:

#include <fstream>
ofstream file("data.txt");
file << "Hello C++";
file.close();

STL (Standard Template Library)

ComponentExamplePurpose
Vectorvector<int> v;Dynamic array
Mapmap<int,string> m;Key-value pair
Setset<int> s;Unique elements
Stackstack<int> s;LIFO
Queuequeue<int> q;FIFO

Templates in C++

Example:

template <class T>
T add(T a, T b) {
    return a + b;
}

Usage:
Templates enable generic programming, allowing code reusability for multiple data types.


Exception Handling in C++

Example:

try {
    int x = 0;
    if(x == 0)
        throw "Division by zero!";
}
catch(const char* msg) {
    cout << msg;
}


FAQ β€” C++ Programming Language

Q1: What makes C++ different from C?
C++ adds Object-Oriented Programming, templates, and STL to the base C language.

Q2: Is C++ good for beginners?
Yes, it’s one of the best languages to understand low-level and high-level programming concepts.

Q3: What are real-world uses of C++?
Game engines, desktop applications, operating systems, and browsers use C++.

Q4: Which compiler should I use?
Use GCC, Clang, or Visual Studio for development.

Q5: Can I run C++ online?
Yes, use the PHPOnline C++ Compiler to run C++ programs instantly.

C Programming Cheat Sheet β€” Complete Syntax, Data Types, Functions, and Examples

C Programming Language Cheat Sheet β€” Complete Guide for Beginners and Professionals

The C programming language is one of the most powerful, efficient, and widely used programming languages in the world. It forms the foundation for modern languages like C++, Java, and Python.

This C Cheat Sheet provides a quick reference for all important syntax, commands, and structures in C language programming β€” from variables to pointers, with practical examples.


C Language Basics

ConceptDescriptionExample
File Extension.cmain.c
CompilerUsed to compile code (e.g., GCC, Turbo C)gcc main.c -o main
ExecutionRun the compiled program./main
CommentAdds code explanations// single line or /* multi-line */

Example:

#include <stdio.h>
int main() {
    printf("Hello, World!");
    return 0;
}

Data Types in C

TypeKeywordSize (bytes)Range (approx.)
Integerint2 or 4-32,768 to 32,767
Characterchar1-128 to 127
Floatfloat43.4E-38 to 3.4E+38
Doubledouble81.7E-308 to 1.7E+308
Voidvoid0N/A

Example:

int age = 25;
float height = 5.9;
char grade = 'A';

C Variables and Constants

TypeSyntax ExampleExplanation
Variableint num = 10;Stores integer value
Constantconst float PI = 3.14;Value cannot be changed
Global VariableDeclared outside all functionsAccessible throughout program

Operators in C

TypeOperatorsExample
Arithmetic+ - * / %a + b
Relational== != > < >= <=if (a > b)
Logical`&&
Assignment= += -= *= /=x += 10
Increment/Decrement++ --i++
Bitwise`&^ ~ << >>`
Ternary? :result = (a > b) ? a : b;

Control Statements in C

StatementSyntaxDescription
ifif (condition) { }Executes if condition is true
if-elseif (condition) elseExecutes one of two blocks
switchswitch(expression)Executes based on multiple cases
breakbreak;Exits from a loop or switch
continuecontinue;Skips current iteration

Example:

if (age >= 18)
    printf("Eligible to vote");
else
    printf("Not eligible");

c programming cheat sheet, c language reference, c syntax examples, c programming basics, c data types table, c functions examples, c pointers tutorial, c arrays cheat sheet, c file handling examples, c programming pdf
c programming cheat sheet, c language reference, c syntax examples, c programming basics, c data types table, c functions examples, c pointers tutorial, c arrays cheat sheet, c file handling examples, c programming pdf

Loops in C

Loop TypeSyntaxUsage
for loopfor(init; condition; inc)Repeats known number of times
while loopwhile(condition)Repeats while condition is true
do-while loopdo { } while(condition);Executes at least once

Example:

for(int i=1; i<=5; i++)
    printf("%d ", i);

Functions in C

TypeSyntax ExampleDescription
Built-inprintf(), scanf()Provided by C library
User-definedvoid greet() { }Created by programmer
Function with returnint sum(int a, int b)Returns value

Example:

int add(int a, int b) {
    return a + b;
}

Arrays in C

TypeSyntax ExampleUsage
One-dimensionalint arr[5];Store multiple values
Two-dimensionalint matrix[3][3];For tables or grids

Example:

int nums[3] = {10, 20, 30};
printf("%d", nums[1]);  // Output: 20

Pointers in C

Pointers store memory addresses of variables.

Syntax:

int num = 10;
int *ptr = &num;
printf("%d", *ptr); // Output: 10
SymbolMeaning
&Address-of operator
*Value-at-address operator

Strings in C

Strings are arrays of characters ending with a null character .

Example:

char name[20] = "C Language";
printf("Welcome to %s", name);
FunctionUsage
strlen(str)Find string length
strcpy(dest, src)Copy string
strcmp(s1, s2)Compare strings
strcat(s1, s2)Concatenate strings
c programming cheat sheet, c language reference, c syntax examples, c programming basics, c data types table, c functions examples, c pointers tutorial, c arrays cheat sheet, c file handling examples, c programming pdf

File Handling in C

ModeMeaning
"r"Read mode
"w"Write mode
"a"Append mode
"r+"Read + Write
"w+"Write + Read

Example:

FILE *fp = fopen("data.txt", "w");
fprintf(fp, "Hello C!");
fclose(fp);


FAQ β€” C Programming Language

Q1: Why is C still important in 2025?
C is the foundation of most modern languages and operating systems, including Linux and embedded systems.

Q2: How do I run a C program online?
Use online compilers like phponline.in C Editor or GCC locally.

Q3: What is the difference between C and C++?
C++ extends C by adding object-oriented programming (classes, inheritance, polymorphism).

Q4: What are the best IDEs for C programming?
Code::Blocks, Visual Studio Code, and Eclipse CDT are great options.

Q5: How do I learn C quickly?
Practice small projects like calculators, pattern printing, and file I/O programs.

UI UX Design Cheat Sheet

UI/UX Design Principles Cheat Sheet β€” Learn Professional Design Fundamentals

Design is more than aesthetics β€” it’s about creating intuitive, functional, and visually pleasing experiences for users. Whether you’re a developer, designer, or digital creator, this UI/UX Design Principles Cheat Sheet helps you understand what makes a great interface.

This guide includes color theory, typography, spacing, alignment, accessibility, and user behavior psychology to help you craft impactful digital products.


Understanding the Difference Between UI and UX

ui ux design cheat sheet, ui design principles, ux design basics, color theory in ui design, typography guide for designers, responsive layout design, accessibility in ui ux, usability design patterns, user interface design examples, design psychology
ui ux design cheat sheet, ui design principles, ux design basics, color theory in ui design, typography guide for designers, responsive layout design, accessibility in ui ux, usability design patterns, user interface design examples, design psychology
AspectUI (User Interface)UX (User Experience)
DefinitionThe look and layout of a product.The overall feel and usability of the product.
FocusVisual design, colors, typography, and layout.User journey, satisfaction, and task efficiency.
ExampleButtons, icons, menus, and animations.How quickly a user completes a task.
GoalMake the interface attractive.Make the experience effortless and logical.

Pro Tip:
A beautiful design fails if users struggle to navigate. Balance aesthetics with usability.


Color Theory in UI Design

Color influences mood, perception, and action. Understanding color psychology helps build user trust and engagement.

ColorMeaning / Usage in UI
BlueTrust, professionalism, used in finance and tech.
RedEnergy, urgency, attention (e.g., notifications).
GreenSuccess, growth, eco-friendly brands.
YellowOptimism, creativity, caution.
Black / WhiteMinimalism, balance, sophistication.

Best Practices:

  • Use contrast ratios for accessibility (WCAG recommends 4.5:1).
  • Stick to a consistent palette (3–5 main colors).
  • Use brand colors for identity but maintain functional contrast.

Typography in UX Design

Typography enhances readability, hierarchy, and user comfort.

PrincipleDescription
ReadabilityUse legible fonts for digital screens (e.g., Roboto, Inter, Open Sans).
HierarchyHeadings (H1–H6) guide scanning behavior.
ContrastDifferent font weights for visual structure.
SpacingMaintain line height of 1.4–1.6x font size.
ConsistencyLimit to 2–3 font families.

Example:
Primary Headings β€” Montserrat Bold 24px
Body Text β€” Open Sans Regular 16px


Layout and Grid Systems

Grids ensure alignment, balance, and consistency in responsive design.

Type of GridUsage
Column GridCommon in web layouts (12-column system).
Modular GridUsed for dashboards and data interfaces.
Baseline GridAligns text and components vertically.
Asymmetric GridCreates dynamic, modern compositions.

Best Practices:

  • Use margins and gutters for breathing space.
  • Keep consistent spacing between related elements.
  • Align content using pixel-perfect precision.

Accessibility in UI/UX Design

Accessibility ensures inclusive design for all users, including those with disabilities.

Accessibility PrincipleImplementation Tip
Text ContrastMinimum 4.5:1 ratio for text/background.
Alt Text for ImagesDescribe visuals for screen readers.
Keyboard NavigationEnsure full interaction without a mouse.
Readable FontsAvoid cursive or overly decorative fonts.
Error FeedbackUse clear error states and helpful tooltips.

Example:
Use aria-label for form fields and provide validation messages like

β€œPlease enter a valid email address.”


Usability Heuristics by Jakob Nielsen

These timeless principles define great UX:

  1. Visibility of System Status – Provide clear feedback for every action.
  2. Match Between System and Real World – Use familiar terms and workflows.
  3. User Control and Freedom – Allow undo or cancel options.
  4. Consistency and Standards – Keep navigation and colors consistent.
  5. Error Prevention – Validate data before submission.
  6. Recognition Rather than Recall – Minimize memory load with visible options.
  7. Flexibility and Efficiency of Use – Shortcuts for power users.
  8. Aesthetic and Minimalist Design – Avoid unnecessary clutter.
  9. Help Users Recognize, Diagnose, Recover from Errors.
  10. Help and Documentation – Provide clear guidance when needed.

Design Psychology β€” How Users Think

Understanding human behavior is vital in UX.

PrincipleMeaningExample
Hick’s LawFewer choices = faster decisions.Limit menu items.
Fitts’s LawBigger buttons are easier to click.Use large CTAs.
Gestalt PrinciplesHumans perceive grouped elements as related.Card-based designs.
Serial Position EffectFirst and last items get the most attention.Key features on top and bottom.

UI/UX Design Tools You Should Know

ToolPurpose
FigmaCollaborative interface design.
Adobe XDPrototyping and animation.
SketchMac-based vector design tool.
CanvaQuick visual mockups.
InVisionInteractive prototyping and feedback.
BalsamiqLow-fidelity wireframing.
ui ux design cheat sheet, ui design principles, ux design basics, color theory in ui design, typography guide for designers, responsive layout design, accessibility in ui ux, usability design patterns, user interface design examples, design psychology

You may Like


FAQ β€” UI/UX Design Principles

Q1: What is the most important UI/UX principle?
Clarity and consistency β€” users should understand your interface instantly.

Q2: How can I learn UI/UX design faster?
Use Figma or Adobe XD daily, redesign popular apps, and follow real-world UX case studies.

Q3: What’s the ideal font size for mobile apps?
14–16px for body text and 20–24px for headings.

Q4: Why is accessibility important?
It makes your product usable by everyone, increasing reach and inclusivity.

Q5: What tools are best for prototyping?
Figma, InVision, and Adobe XD provide real-time interactive prototyping.

Figma Cheat Sheet (UI/UX Design Reference Guide for Designers)

Figma Cheat Sheet β€” Tools, Shortcuts & UI/UX Design Essentials

Figma has revolutionized the UI/UX design industry by offering a web-based, collaborative design tool that allows teams to design, prototype, and share in real-time. Whether you’re creating mobile app wireframes, responsive web layouts, or complete design systems, this Figma Cheat Sheet gives you everything you need to work efficiently and creatively.


Figma Interface Overview

The Figma workspace is designed for productivity and collaboration. Key areas include:

  • Toolbar: Contains selection, shapes, text, frames, and prototyping tools.
  • Layers Panel: Displays all frames, groups, and components in your project.
  • Properties Panel: Allows you to edit colors, constraints, auto layout, and effects.
  • Canvas: Your main design area for creating layouts and prototypes.
  • Assets Panel: Contains reusable components, icons, and styles.

Figma Tools and Functions

Tool / FeatureDescription
Move Tool (V)Move elements freely around the canvas.
Frame Tool (F)Create frames for layouts, artboards, or screens.
Shape Tools (O, R)Create circles (O) and rectangles (R).
Pen Tool (P)Draw custom vector shapes and paths.
Text Tool (T)Add and style text elements.
Hand Tool (Space)Pan around the canvas.
Slice Tool (S)Export specific regions as images.
Eyedropper (I)Pick colors from the canvas.
Comment Tool (C)Add feedback or notes for team collaboration.
Prototype ToolConnect frames to simulate interactions and navigation.

Figma Keyboard Shortcuts

ActionWindows ShortcutMac Shortcut
DuplicateCtrl + DCmd + D
CopyCtrl + CCmd + C
PasteCtrl + VCmd + V
Group SelectionCtrl + GCmd + G
UngroupCtrl + Shift + GCmd + Shift + G
Bring ForwardCtrl + ]Cmd + ]
Send BackwardCtrl + [Cmd + [
Zoom InCtrl + +Cmd + +
Zoom OutCtrl + –Cmd + –
Add FrameFF
Show Layout GridsCtrl + GCmd + G
Show/Hide UICtrl + *Cmd + *
Present PrototypeCtrl + EnterCmd + Enter

Auto Layout in Figma

Auto Layout is one of Figma’s most powerful features β€” it allows designs to adapt dynamically as you resize or modify content.

Advantages:

  • Responsive and adaptive designs.
  • Automatic spacing between elements.
  • Quick adjustments for padding, alignment, and orientation.

Example Use Case:
Designing a button that automatically resizes based on text content.

Pro Tip: Use Auto Layout for cards, navigation bars, and forms to maintain consistent spacing.

figma cheat sheet, figma design tools, figma keyboard shortcuts, figma auto layout, figma components guide, figma prototyping tutorial, figma ui ux tips, figma plugins for designers, figma design system
figma cheat sheet, figma design tools, figma keyboard shortcuts, figma auto layout, figma components guide, figma prototyping tutorial, figma ui ux tips, figma plugins for designers, figma design system

Figma Components and Variants

Components are reusable design elements like buttons or input fields. Variants allow multiple states (e.g., hover, active) in one component.

FeatureUsage
ComponentCreate a reusable element (Ctrl + Alt + K / Cmd + Option + K).
VariantCombine multiple component states.
InstanceA copy of a component that inherits all properties.
Master ComponentThe source design for all instances.

Figma Prototyping and Animation

Bring your static designs to life with Figma Prototyping Tools.

FeatureFunction
Prototype LinksConnect frames to create interactions.
Smart AnimateAdd smooth transitions between states.
OverlayDisplay popups or dropdowns.
Interactive ComponentsAdd button hover and click effects.
FlowsManage user journeys in multiple screens.

Example:
Connect your β€œLogin” screen to β€œDashboard” using On Click β†’ Navigate To β†’ Smart Animate for a seamless experience.


Figma Collaboration and Comments

Figma’s real-time collaboration allows designers, developers, and clients to work together on the same project.

  • Comment Mode: Add feedback without altering designs.
  • Share Links: Control view/edit permissions.
  • Version History: Track and restore previous edits.
  • Dev Mode: Developers can inspect CSS, spacing, and export assets easily.

Popular Figma Plugins for Designers

Plugin NamePurpose
AutoflowQuickly connect objects with arrows and flows.
Content ReelAdd text, avatars, and icons instantly.
BlushGenerate free illustrations inside Figma.
UnsplashInsert royalty-free stock images.
IconifyAccess 100,000+ icons directly in Figma.
FigmotionAdd motion animations to your prototypes.
ContrastCheck accessibility contrast ratios.
Design LintDetect inconsistencies in your design system.
figma cheat sheet, figma design tools, figma keyboard shortcuts, figma auto layout, figma components guide, figma prototyping tutorial, figma ui ux tips, figma plugins for designers, figma design system

Figma Export and Sharing Options

File TypeUsage
PNG / JPGExport images for web or mobile.
SVGScalable vector for icons and UI elements.
PDFExport presentations or case studies.
Figma LinkShare real-time design access.
Code InspectExport CSS, iOS, or Android code snippets.

Related Topic


FAQ β€” Figma Cheat Sheet

Q1: Is Figma free to use?
Yes, Figma has a free plan perfect for individuals and small teams. Figma Pro includes advanced collaboration and versioning.

Q2: Can Figma be used offline?
Yes, with the Figma Desktop App, you can work offline and sync when online.

Q3: What is Auto Layout used for in Figma?
Auto Layout helps you design responsive components that automatically adjust spacing and size.

Q4: How do I share a Figma file with my team?
Use the Share button, choose access level (view/edit), and send the project link.

Q5: Can developers export code directly from Figma?
Yes, using Dev Mode, developers can inspect and copy CSS, iOS, and Android code snippets.

Canva Cheat Sheet β€” Complete Tools, Shortcuts & Branding Design Guide

Canva has become one of the most popular online design platforms, empowering millions of creators to produce professional-quality graphics, social media posts, and presentations β€” without complex software.
This Canva Cheat Sheet helps you master every tool, shortcut, and design principle you need to create stunning visuals effortlessly.


Canva Interface Overview

Canva’s user-friendly interface makes design accessible to everyone. The key areas include:

  • Toolbar: Access to templates, elements, text, photos, and uploads.
  • Canvas: Your main working area where designs are created.
  • Side Panel: Adjust colors, fonts, transparency, and layers.
  • Brand Hub: Manage brand logos, fonts, and color palettes.
  • Top Menu: Export, resize, or share your designs.

Canva Tools & Features Cheat Sheet

FeaturePurpose / Function
TemplatesPre-built designs for posts, logos, resumes, and ads.
ElementsShapes, icons, illustrations, and graphics.
UploadsAdd your own photos, videos, and logos.
Text ToolAdd and style headings, subheadings, and body text.
BackgroundsApply textures, gradients, and patterns.
EffectsAdd filters, shadows, and glow effects.
Positioning ToolAlign, center, or group elements.
Transparency SliderAdjust element opacity.
LayersArrange elements front-to-back easily.
Brand KitStore fonts, colors, and logos for consistency.
Resize Tool (Pro)Instantly resize designs for multiple platforms.
Magic Write / AI ToolGenerate design text and layout suggestions.

Canva Keyboard Shortcuts (Windows & Mac)

ActionWindows ShortcutMac Shortcut
CopyCtrl + CCmd + C
PasteCtrl + VCmd + V
Duplicate ElementCtrl + DCmd + D
UndoCtrl + ZCmd + Z
RedoCtrl + Shift + ZCmd + Shift + Z
Group ElementsCtrl + GCmd + G
Ungroup ElementsCtrl + Shift + GCmd + Shift + G
Lock ElementCtrl + LCmd + L
Bring ForwardCtrl + ]Cmd + ]
Send BackwardCtrl + [Cmd + [
Align CenterShift + CShift + C
Download DesignCtrl + SCmd + S
Add New PageCtrl + EnterCmd + Enter

canva cheat sheet, canva design tools, canva keyboard shortcuts, canva templates guide, canva branding kit, canva photo editing, canva logo design, canva tips and tricks, canva for beginners
canva cheat sheet, canva design tools, canva keyboard shortcuts, canva templates guide, canva branding kit, canva photo editing, canva logo design, canva tips and tricks, canva for beginners

How to Create a Branding Kit in Canva

Branding consistency is essential for businesses and influencers. Canva’s Brand Kit feature allows you to store and reuse your brand’s visual assets.

Steps to Set Up Your Branding Kit:

  1. Go to the Brand Hub in Canva.
  2. Add your logo, brand fonts, and color palette.
  3. Create custom templates for social media and documents.
  4. Apply the brand kit to all future designs for cohesive visuals.

Pro Tip: Upgrade to Canva Pro to save multiple brand kits for different clients or projects.


Canva Social Media Design Cheat Sheet

PlatformRecommended Size (px)Use Case
Instagram Post1080 Γ— 1080Square post, quotes, promotions
Instagram Story1080 Γ— 1920Vertical story, product highlights
Facebook Cover820 Γ— 312Page header or banner
YouTube Thumbnail1280 Γ— 720Video preview image
LinkedIn Post1200 Γ— 627Professional content or updates
Pinterest Pin1000 Γ— 1500Vertical infographic or tip sheet
Twitter Banner1500 Γ— 500Header image for brand visibility

Top Canva Design Tips for Beginners

  • Use consistent colors and fonts to maintain brand identity.
  • Keep text clear and readable using contrast.
  • Always align objects for a clean, professional look.
  • Use Canva Grids and Frames for balanced compositions.
  • Apply the Magic Resize Tool to repurpose designs across platforms.

Canva File Types & Export Options

File TypeUse Case
PNGTransparent background images
JPEGCompressed for web and social media
PDF (Standard)Web sharing or emailing
PDF (Print)High-quality print projects
MP4Export animated or video projects
GIFShort animations or motion graphics

Related Topic


FAQ β€” Canva Cheat Sheet

Q1: Is Canva free to use?
Yes, Canva offers a free plan with thousands of templates and tools. The Pro plan adds features like Magic Resize, Background Remover, and Brand Kit.

Q2: Can I use Canva for commercial designs?
Yes. Canva allows commercial usage of free and Pro elements (depending on their license).

Q3: What is the best image format for web graphics?
Use PNG for transparent images and JPEG for compressed photos.

Q4: How do I remove background in Canva?
Click Edit Photo β†’ Background Remover (available for Pro users).

Q5: Can I collaborate with others in Canva?
Yes, Canva supports real-time collaboration for teams and shared projects.

Photoshop Cheat Sheet β€” Tools, Shortcuts & Editing Techniques

Photoshop Cheat Sheet β€” Complete Tools, Keyboard Shortcuts & Layer Blending Modes

Adobe Photoshop is the most powerful image editing software used by designers, photographers, and digital artists worldwide.
This Photoshop Cheat Sheet will help you learn all the essential tools, shortcuts, and layer controls to speed up your workflow and enhance creativity.


Photoshop Interface Overview

Photoshop’s interface consists of the menu bar, tools panel, options bar, layers panel, and workspace area.
Understanding these key areas helps streamline editing and design tasks.

  • Menu Bar: Contains commands (File, Edit, Image, Layer, Select, Filter, View, Window, Help).
  • Tools Panel: Contains all major editing and selection tools.
  • Layers Panel: Displays image layers, blending modes, and adjustment layers.
  • Workspace Area: The canvas where editing occurs.

Photoshop Tools List (With Function & Shortcut)

ToolFunctionShortcut Key
Move ToolMoves selected objects or layersV
Marquee ToolSelects rectangular or elliptical areasM
Lasso ToolFreehand selection of objectsL
Quick Selection ToolSelects areas based on color and textureW
Crop ToolCrops image to specific areaC
Eyedropper ToolPicks up colors from the imageI
Brush ToolPaints with customizable brushesB
Clone Stamp ToolCopies pixels from one area to anotherS
Healing Brush ToolFixes imperfectionsJ
Eraser ToolErases pixels or parts of a layerE
Gradient ToolFills with gradient blendG
Blur/Sharpen ToolSoftens or enhances edgesR
Pen ToolCreates paths and shapesP
Type ToolAdds text to the canvasT
Path Selection ToolEdits paths and shapesA
Rectangle/Shape ToolDraws geometric shapesU
Hand ToolMoves around the canvasH
Zoom ToolZooms in/out of the imageZ
photoshop cheat sheet, photoshop tools list, adobe photoshop shortcuts, photoshop blending modes, photoshop layers guide, photoshop color correction, photoshop editing tips, photoshop beginner tutorial, photoshop image retouching

Photoshop Keyboard Shortcuts for Speed Editing

ActionShortcut (Windows)Shortcut (Mac)
New FileCtrl + NCmd + N
Open FileCtrl + OCmd + O
SaveCtrl + SCmd + S
Duplicate LayerCtrl + JCmd + J
Merge LayersCtrl + ECmd + E
UndoCtrl + ZCmd + Z
Step BackwardCtrl + Alt + ZCmd + Option + Z
Free TransformCtrl + TCmd + T
Show/Hide GuidesCtrl + ;Cmd + ;
Fit to ScreenCtrl + 0Cmd + 0
Zoom InCtrl + +Cmd + +
Zoom OutCtrl + –Cmd + –
DeselectCtrl + DCmd + D
Invert SelectionShift + Ctrl + IShift + Cmd + I

Photoshop Layers Cheat Sheet

Layers are the foundation of Photoshop editing, allowing you to work non-destructively and control each element separately.

ActionDescription
New LayerAdds a blank layer (Ctrl + Shift + N)
Duplicate LayerCopies an existing layer (Ctrl + J)
Delete LayerRemoves selected layer (Del)
Merge LayersCombines multiple layers (Ctrl + E)
Group LayersCreates folder for better organization (Ctrl + G)
Adjustment LayersApply color or tonal changes (non-destructive)
Layer MaskHides/reveals parts of a layer without deleting
Smart ObjectsPreserves image quality for transformations

Photoshop Blending Modes

Blending modes determine how layers interact with each other visually.

CategoryModeEffect
NormalNormal, DissolveStandard overlay or pixel dissolve
DarkenDarken, Multiply, Color BurnMakes image darker
LightenLighten, Screen, Color DodgeBrightens image
ContrastOverlay, Soft Light, Hard LightAdds contrast
InversionDifference, ExclusionCreates color contrast and inversion effects
ColorHue, Saturation, Color, LuminosityAdjusts color tones and blends hues

Color Correction and Adjustment Tools

AdjustmentShortcut / ToolUsage
Brightness/ContrastImage β†’ Adjustments β†’ Brightness/ContrastAdjusts overall lightness
LevelsCtrl + LAdjusts tonal range
CurvesCtrl + MPrecise brightness control
Hue/SaturationCtrl + UChanges color intensity
Color BalanceCtrl + BCorrects color tones
Selective ColorImage β†’ Adjustments β†’ Selective ColorAdjusts specific colors
Gradient MapAdjustment LayerCreative coloring effects

Popular Photoshop Filters

FilterPurpose
Gaussian BlurSoftens edges
Unsharp MaskSharpens image details
LiquifyDistorts and reshapes objects
Lens CorrectionFixes lens distortion
Noise ReductionRemoves digital noise
Motion BlurAdds motion effects
Oil PaintCreates painting-like texture

Photoshop File Formats

FormatExtensionUsage
Photoshop Document.PSDEditable format with layers
JPEG.JPGCompressed for web use
PNG.PNGSupports transparency
TIFF.TIFHigh-quality printing
GIF.GIFAnimations or low-res graphics
PDF.PDFPrint and sharing format

Related Topic


FAQ β€” Photoshop Cheat Sheet

Q1: What is the best way to learn Photoshop quickly?
Start with learning basic tools like Move, Crop, Brush, and Layers, then move on to blending and retouching.

Q2: What are the most useful Photoshop shortcuts?
Ctrl + T for Transform, Ctrl + J to Duplicate Layer, and Ctrl + Z for Undo are the most common.

Q3: What is the difference between a raster and vector image?
Raster images are pixel-based (e.g., photos), while vectors are scalable shapes created using paths.

Q4: How to make non-destructive edits in Photoshop?
Use Adjustment Layers and Layer Masks to preserve the original image data.

Q5: What file type should I use for web images?
Use JPEG for photos and PNG for transparent or high-quality graphics.

HTML5 Cheat Sheet β€” Complete Tag Reference & Examples

HTML5 is the core markup language of the modern web, used to structure content such as text, images, forms, and multimedia on web pages. This HTML5 Cheat Sheet covers every essential element, from basic structure to advanced APIs, to help beginners and professionals alike build fully functional websites.


What is HTML5?

HTML5 (HyperText Markup Language, version 5) is the latest standard that powers modern websites. It supports multimedia, semantic elements, APIs, and form enhancements, making web pages more interactive and accessible.


HTML5 Document Structure

Example:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HTML5 Cheat Sheet</title>
</head>
<body>
  <h1>Hello HTML5!</h1>
  <p>This is a simple webpage structure example.</p>
</body>
</html>

HTML Basic Tags

TagDescriptionExample
<html>Root of an HTML page<html lang="en">
<head>Metadata container<head>...</head>
<title>Title of the page<title>My Page</title>
<body>Visible page content<body>...</body>
<h1>–<h6>Headings<h1>Main Heading</h1>
<p>Paragraph<p>This is text.</p>
<br>Line break<br>
<hr>Horizontal rule<hr>

HTML Text Formatting

TagDescriptionExample
<b>Bold text<b>Bold</b>
<i>Italic text<i>Italic</i>
<u>Underlined text<u>Underline</u>
<strong>Important text<strong>Important</strong>
<em>Emphasized text<em>Note</em>
<mark>Highlighted text<mark>Highlight</mark>
<small>Smaller text<small>Fine print</small>
<sub>SubscriptH<sub>2</sub>O
<sup>Superscriptx<sup>2</sup>

HTML Links and Images

Example:

<a href="https://phponline.in" target="_blank">Visit PHP Online</a>
<img src="logo.png" alt="Website Logo" width="200">
TagAttributeDescription
<a>hrefDefines hyperlink
<img>src, alt, width, heightEmbeds image
<map>usemapImage mapping
<area>coords, shape, hrefDefines clickable area

HTML Lists

TypeTagExample
Ordered List<ol><ol><li>Item</li></ol>
Unordered List<ul><ul><li>Item</li></ul>
Definition List<dl><dl><dt>Term</dt><dd>Definition</dd></dl>

HTML Tables

TagDescription
<table>Creates a table
<tr>Table row
<th>Table header cell
<td>Table data cell
<caption>Table title
<thead>, <tbody>, <tfoot>Table sections

Example:

<table border="1">
  <caption>Student Marks</caption>
  <tr><th>Name</th><th>Score</th></tr>
  <tr><td>Alice</td><td>95</td></tr>
</table>

HTML Forms and Input Types

Tag / AttributeExampleDescription
<form><form action="submit.php">Form container
<input><input type="text" name="user">User input field
<textarea><textarea rows="4"></textarea>Multi-line input
<select><select><option>Yes</option></select>Dropdown menu
<button><button type="submit">Send</button>Clickable button

Common Input Types:

text, password, email, number, date, checkbox, radio, file, submit


HTML5 Semantic Elements

HTML5 introduced semantic tags for better structure and SEO optimization.

TagDescription
<header>Page header or navigation
<nav>Navigation links
<main>Main content area
<section>Thematic section of a page
<article>Independent content block
<aside>Sidebar or related content
<footer>Footer section
<figure> / <figcaption>Image and caption grouping

HTML5 Multimedia Tags

TagExampleDescription
<audio><audio controls><source src="song.mp3"></audio>Embeds audio
<video><video controls><source src="video.mp4"></video>Embeds video
<canvas><canvas id="draw"></canvas>Draw graphics via JavaScript
<svg><svg><circle cx="50" cy="50" r="40" /></svg>Scalable vector graphics
html5 cheat sheet, html tags list, html5 elements reference, html form elements, html semantic tags, html5 attributes, html multimedia example, html table and list tags, html5 quick reference, html for beginners

HTML Meta & SEO Tags

TagExamplePurpose
<meta charset="UTF-8">Character encoding
<meta name="description">SEO page description
<meta name="keywords">Search keywords
<meta name="viewport">Responsive design
<link rel="stylesheet">Link external CSS
<script src="app.js">Link JavaScript file

HTML5 APIs and Advanced Features

FeatureDescriptionExample
Geolocation APIDetects user locationnavigator.geolocation.getCurrentPosition()
Local StorageStores data in browserlocalStorage.setItem("user", "John")
Drag and Drop APIDrag and drop elementsondrop, ondragover
Canvas APIDraw shapes and imagescanvas.getContext("2d")

Related cheatsheet


FAQ β€” HTML5 Cheat Sheet

Q1: What is the purpose of HTML5?
HTML5 structures web pages and integrates multimedia, APIs, and mobile-friendly features seamlessly.

Q2: What is the difference between HTML and HTML5?
HTML5 adds support for video, audio, canvas, local storage, and semantic elements like <header> and <article>.

Q3: Are HTML5 tags case sensitive?
No, HTML5 is not case-sensitive β€” but lowercase is recommended for consistency.

Q4: What are semantic elements?
Semantic elements clearly describe their meaning β€” for example, <section>, <article>, <footer> improve SEO and accessibility.

Q5: How to validate HTML5 code?
Use the W3C Validator at https://validator.w3.org.