UGC NET / JRF — Computer Science & Applications
High-Yield Study Notes & PYQ-Pattern Workbook (Unit 2)
Contents
Section A: Programming Languages
Section B: Computer Graphics
Beginner → Concept → NET-level → JRF-level. Compact by design — exam value over page count.
SECTION A — PROGRAMMING LANGUAGES
Chapter 1 — Language C
1.1 Data Types, Operators & Expressions
SimpleC has basic types int, char, float, double, plus modifiers (short, long, signed, unsigned). Operators combine values into expressions, following precedence/associativity rules just like maths.
NET pointTypical sizes (may be compiler/platform dependent, but commonly assumed in NET MCQs): char = 1 byte, int = 2 or 4 bytes, float = 4 bytes, double = 8 bytes.
JRF trap — operator precedence output questions
int a=5, b=2, c;
c = a++ + ++b;
printf("%d %d %d", a, b, c);
Post-increment a++ uses OLD value of a (5) THEN increments; pre-increment ++b increments b FIRST (to 3) then uses it. So c = 5+3 = 8, a becomes 6, b becomes 3. Output: 6 3 8. This exact style of "predict the output" is one of the most repeated NET/JRF question types for C.
1.2 Control Structures
- Selection: if, if-else, nested if, switch-case (switch works only on integral/char types, NOT float/string).
- Iteration: for, while, do-while (do-while executes body at least once, even if condition is false).
- Jump: break, continue, goto, return.
Trapswitch-case in C does NOT support float or string as the switch expression — a frequently tested restriction.
1.3 Arrays & Strings
IdeaAn array is a contiguous block of same-type elements; array name is a constant pointer to its first element. A C string is a char array terminated by '\0' (null character).
JRF-level numericalIf int arr[5] starts at address 1000 and int size = 4 bytes, address of arr[3] = 1000 + 3×4 = 1012. For 2D array a[3][4] (row-major, base 2000, element size 4): address of a[i][j] = base + (i×cols + j)×size. a[2][1] = 2000 + (2×4+1)×4 = 2000+36 = 2036.
NET pointC stores 2D arrays in row-major order (entire row stored contiguously before the next row begins) — unlike some languages (e.g., Fortran) which use column-major order.
1.4 Pointers
SimpleA pointer is a variable that stores the address of another variable. *p dereferences (gets value at address); &x gets the address of x.
JRF trap — pointer arithmeticIf p is int* and p currently holds address 2000, then p+1 points to 2004 (NOT 2001) — pointer arithmetic scales by the size of the pointed-to type. For a char*, p+1 would be 2001 (char is 1 byte). This scaling rule is a classic NET/JRF trap.
NET pointPointer to pointer (int **pp), function pointers, and array-of-pointers vs pointer-to-array (int (*p)[5] vs int *p[5]) are common JRF-level distinctions — the parentheses change meaning entirely.
1.5 Functions, Recursion & Storage Classes
| Storage class | Scope | Lifetime | Default value |
|---|---|---|---|
| auto | Block/local | Function call | Garbage |
| register | Block/local | Function call | Garbage |
| static | Block/file (depends) | Entire program | 0 |
| extern | Global/file | Entire program | 0 |
JRF trapA static local variable inside a function retains its value BETWEEN function calls (initialized only once), but its SCOPE is still limited to that function/block — students often wrongly assume static automatically means global scope. Scope and lifetime are two separate properties.
Worked example — recursion trace
int f(int n){ if(n==0) return 1; return n*f(n-1); }
f(4) = 4×f(3) = 4×3×f(2) = 4×3×2×f(1) = 4×3×2×1×f(0) = 4×3×2×1×1 = 24 (factorial). Recursion depth = 5 calls (f(4) down to f(0)).
1.6 Structures, Unions & Dynamic Memory
IdeaA structure groups different-typed members, each with its own memory (total size ≥ sum of member sizes, plus possible padding). A union also groups members but they SHARE the same memory (size = size of largest member).
JRF-level numerical — structure padding
struct S { char c; int i; };
char is 1 byte, int is 4 bytes. Due to alignment padding, sizeof(S) is often 8 (1 byte char + 3 bytes padding + 4 bytes int) on a typical 32/64-bit compiler, NOT 5. This "padding adds hidden bytes" trap is a favourite JRF numerical.
NET pointDynamic memory: malloc() allocates uninitialized memory and returns void*; calloc() allocates AND zero-initializes; realloc() resizes a previously allocated block; free() releases memory. Forgetting free() causes a memory leak.
MUST REMEMBER — Chapter 1 (C)
- Post-increment uses old value then increments; pre-increment increments first.
- switch works only on integral/char, not float/string.
- do-while always executes at least once.
- C arrays are row-major; array name = constant pointer to first element.
- Pointer arithmetic scales by the size of the pointed-to type.
- static local variable: lifetime = whole program, scope = still local.
- Structure size can exceed the sum of members due to padding/alignment.
- malloc = uninitialized; calloc = zero-initialized; realloc = resize; free = release.
DON'T CONFUSE
- int *p[5] (array of 5 int-pointers) vs int (*p)[5] (pointer to an array of 5 ints).
- Structure (separate memory per member) vs Union (shared memory, size = largest member).
- Static local variable's SCOPE (still local) vs its LIFETIME (whole program).
JRF CHALLENGE ZONE — Chapter 1 (C)
1. What is the output? int x=10; printf("%d",x++ + x++); (a) 20 (b) 21 (c) 22 (d) Undefined behaviour
Answer: (d) — modifying x twice between sequence points without an intervening sequence point is undefined behaviour in C (a classic JRF trap, not simply 21).
Answer: (d) — modifying x twice between sequence points without an intervening sequence point is undefined behaviour in C (a classic JRF trap, not simply 21).
2. sizeof(struct { char a; double b; }) most likely equals: (a) 9 (b) 12 (c) 16 (d) 8
Answer: (c) — char(1)+7 padding+double(8)=16, since double needs 8-byte alignment.
Answer: (c) — char(1)+7 padding+double(8)=16, since double needs 8-byte alignment.
3. For int *p[5], p is: (a) a pointer to an array of 5 ints (b) an array of 5 pointers to int (c) a function pointer (d) invalid syntax
Answer: (b)
Answer: (b)
Practice Questions — Chapter 1 (C) (8)
- What is the difference between ++x and x++ in an expression?
Ans: ++x (pre) increments first then uses the value; x++ (post) uses the current value then increments - Why can't switch-case in C use a float expression?
Ans: switch requires an integral/character type for exact case matching; floats can't be compared exactly - Which loop always executes its body at least once?
Ans: do-while - Array a[10] starts at address 500, element size 2 bytes. Find address of a[6].
Ans: 500+6×2 = 512 - What does pointer arithmetic p+1 actually add, for a pointer of type T*?
Ans: sizeof(T) bytes, not literally 1 byte - Differentiate malloc() and calloc().
Ans: malloc allocates uninitialized memory; calloc allocates and zero-initializes it - Why is sizeof(union) equal to its largest member, not the sum of all members?
Ans: All union members share the same memory location, so only the largest member's space is needed - What is the scope and lifetime of a static local variable?
Ans: Scope = local to the function/block; Lifetime = entire program execution (value persists across calls)
Chapter 2 — Language C++
2.1 OOP Foundations: Class, Object, Constructor/Destructor
SimpleA class is a blueprint; an object is an actual instance built from it. A constructor runs automatically when an object is created (to initialize it); a destructor runs automatically when it's destroyed (to clean up).
NET pointConstructors: default, parameterized, copy constructor. Destructors never take arguments and cannot be overloaded — a class has exactly one destructor.
JRF trap — constructor/destructor call orderFor an object with base and derived class parts: construction order is Base constructor → Derived constructor. Destruction order is the REVERSE: Derived destructor → Base destructor. Getting this reversed is one of the most common JRF mistakes.
2.2 Inheritance
| Type | Meaning |
|---|---|
| Single | One base, one derived class |
| Multiple | One derived class, multiple base classes |
| Multilevel | Chain: A → B → C |
| Hierarchical | One base, multiple derived classes |
| Hybrid | Combination of the above (can cause the "diamond problem") |
JRF insight — diamond problemIn hybrid/multiple inheritance, if class D inherits from B and C, and both B and C inherit from A, then D ends up with TWO copies of A's members unless A is inherited "virtually" (virtual base class), causing ambiguity. This is the classic "diamond problem", solved using virtual inheritance.
2.3 Polymorphism
IdeaPolymorphism = "many forms" — the same function name/operator behaves differently depending on context.
| Compile-time (Static) | Runtime (Dynamic) | |
|---|---|---|
| Achieved via | Function overloading, operator overloading | Virtual functions (function overriding) |
| Binding | Early binding | Late binding |
| Decided at | Compile time | Run time (via vtable) |
JRF trap — overloading vs overridingOverloading = same function name, DIFFERENT signature (parameters), same or different class, resolved at compile time. Overriding = same function name AND same signature, in a base and derived class, resolved at run time via virtual functions. Mixing these up is extremely common.
2.4 Virtual Functions & Abstract Classes
IdeaA virtual function allows a derived class to override base-class behaviour, resolved at runtime through a vtable (using a base class pointer/reference). A pure virtual function (= 0) has no body in the base class — a class with at least one pure virtual function becomes an abstract class and cannot be instantiated directly.
NET pointBase class pointer + virtual function = runtime polymorphism (correct derived version called). Base class pointer + NON-virtual function = only the base version is called ("function hiding"), regardless of actual object type — a common output-prediction trap.
2.5 Operator Overloading, Friend Functions, this Pointer
- Operator overloading: redefining operators (+, -, ==, etc.) for user-defined types (classes).
- Friend function: a non-member function granted access to a class's private/protected members; NOT inherited, and NOT a member of the class.
- this pointer: an implicit pointer available inside non-static member functions, pointing to the calling object itself.
TrapSome operators CANNOT be overloaded in C++: examples include ::(scope resolution), .(member access), .*(pointer-to-member), and ?: (ternary). NET sometimes asks "which of these CANNOT be overloaded."
2.6 Templates & Exception Handling
IdeaTemplates let you write generic, type-independent code (function templates, class templates) — the compiler generates type-specific code at compile time. Exception handling uses try/catch/throw to handle runtime errors gracefully without crashing.
NET pointcatch(...) is a "catch-all" handler that catches any exception type. Multiple catch blocks are checked in order; the FIRST matching catch handles the exception — ordering matters (a general catch before a specific one can "hide" the specific one, often a trick question).
MUST REMEMBER — Chapter 2 (C++)
- Construction order: Base → Derived. Destruction order: Derived → Base (reverse).
- Overloading = compile-time, same name different signature. Overriding = runtime, same signature, needs virtual.
- Pure virtual function (=0) makes a class abstract — cannot be instantiated.
- Virtual + base pointer = runtime polymorphism; non-virtual + base pointer = function hiding.
- Friend function: access granted, but not a member, not inherited.
- Diamond problem in multiple/hybrid inheritance is solved using virtual base classes.
- ::, ., .*, ?: cannot be overloaded.
DON'T CONFUSE
- Overloading (compile-time, different signature) vs Overriding (runtime, same signature, virtual).
- Friend function (external, granted access) vs Member function (belongs to the class).
- Abstract class (has ≥1 pure virtual function) vs a class that simply has no data.
JRF CHALLENGE ZONE — Chapter 2 (C++)
1. A base class pointer points to a derived object. The function called is NON-virtual and overridden in the derived class. Which version executes? (a) Derived's version (b) Base's version (c) Compile error (d) Undefined
Answer: (b) — without virtual, binding is static/early, based on pointer TYPE not actual object.
Answer: (b) — without virtual, binding is static/early, based on pointer TYPE not actual object.
2. Class D inherits from B and C; both B and C inherit from A (non-virtually). D d; d accesses a member of A. Result: (a) Works fine, one copy of A (b) Ambiguous — compile error due to two copies of A (c) Runtime crash (d) A is skipped
Answer: (b) — the classic diamond problem; fixed using virtual inheritance.
Answer: (b) — the classic diamond problem; fixed using virtual inheritance.
3. Which is TRUE about pure virtual functions? (a) They must have a function body in the base class (b) A class with one becomes abstract and cannot be instantiated (c) They disable inheritance (d) They are resolved at compile time
Answer: (b)
Answer: (b)
Practice Questions — Chapter 2 (C++) (8)
- What is the order of constructor calls when a derived object is created?
Ans: Base class constructor first, then derived class constructor - What is the order of destructor calls when a derived object is destroyed?
Ans: Derived class destructor first, then base class destructor (reverse of construction) - Differentiate function overloading and function overriding.
Ans: Overloading = same name, different signature, compile-time; Overriding = same name and signature in base/derived, resolved at runtime via virtual functions - What makes a class "abstract" in C++?
Ans: Having at least one pure virtual function (declared with = 0) - What is the "diamond problem" and how is it solved?
Ans: Ambiguity from two inherited copies of a common base class in multiple inheritance; solved using virtual inheritance - Is a friend function a member of the class? Does it get inherited?
Ans: No to both — it only has access privileges, it is neither a member nor inherited - What does the "this" pointer point to inside a member function?
Ans: The object on which the member function was called - Name two operators that cannot be overloaded in C++.
Ans: Any two of: :: (scope resolution), . (member access), .* (pointer-to-member), ?: (ternary)
Chapter 3 — HTML
3.1 HTML Basics & Document Structure
SimpleHTML (HyperText Markup Language) describes the structure of a web page using nested "tags" — most tags have an opening <tag> and closing </tag>.
<!DOCTYPE html>
<html>
<head><title>Page Title</title></head>
<body> ... visible content ... </body>
</html>
NET point<!DOCTYPE html> declares the document as HTML5. It is NOT an HTML tag itself — it's an instruction to the browser about which HTML version to use.
3.2 Common Tags, Attributes & Forms
| Tag | Purpose |
|---|---|
| <a href=""> | Hyperlink |
| <img src="" alt=""> | Image (self-closing / void element) |
| <table><tr><td> | Table, row, cell |
| <form action="" method=""> | Data-collection form |
| <input type=""> | Form field (text, checkbox, radio, submit, etc.) |
| <div> / <span> | Generic block / inline container |
JRF trapVoid/self-closing elements like <img>, <br>, <hr>, <input> do NOT have a closing tag (</img> is invalid) because they cannot contain content. Confusing void elements with normal container elements is a common trap.
NET pointForm method="get" appends data visibly to the URL (limited length, bookmarkable, less secure); method="post" sends data in the request body (no length limit practically, not bookmarkable, more suitable for sensitive data).
3.3 Semantic HTML5 Elements
IdeaHTML5 introduced elements that describe MEANING, not just layout, improving accessibility/SEO: <header>, <nav>, <article>, <section>, <aside>, <footer>, <main> — replacing generic <div> soup for these common page regions.
3.4 Meta Tags & Head Elements
- <meta charset="UTF-8"> — declares character encoding.
- <meta name="viewport" content="width=device-width"> — controls layout on mobile devices.
- <link rel="stylesheet" href=""> — links external CSS.
- <script src=""></script> — links/embeds JavaScript.
MUST REMEMBER — Chapter 3 (HTML)
- <!DOCTYPE html> is a version declaration, not an HTML tag.
- Void elements (img, br, hr, input, meta) never have a closing tag.
- GET appends data to URL (visible, limited); POST sends in body (hidden, larger, more secure).
- Semantic tags (header/nav/article/section/aside/footer) describe meaning, not just style.
- <div> is block-level (own line); <span> is inline (flows with text).
DON'T CONFUSE
- <div> (block, generic) vs <span> (inline, generic).
- GET vs POST form methods.
- HTML (structure/content) vs CSS (presentation) vs JavaScript (behaviour) — three separate layers of a webpage.
JRF CHALLENGE ZONE — Chapter 3 (HTML)
1. Which statement is FALSE? (a) <img> is a void element (b) <!DOCTYPE html> is itself an HTML element with a closing tag (c) <section> is a semantic HTML5 element (d) POST sends data in the request body
Answer: (b) — DOCTYPE is a declaration, not an element, and has no closing tag.
Answer: (b) — DOCTYPE is a declaration, not an element, and has no closing tag.
2. Which form method is more appropriate for submitting a password field, and why?
Answer: POST — data isn't appended visibly to the URL, unlike GET.
Answer: POST — data isn't appended visibly to the URL, unlike GET.
3. <div> vs <span> — which is block-level and which is inline?
Answer: <div> = block-level; <span> = inline
Answer: <div> = block-level; <span> = inline
Practice Questions — Chapter 3 (HTML) (6)
- What does <!DOCTYPE html> declare?
Ans: That the document is an HTML5 document - Name three void (self-closing, no closing tag) HTML elements.
Ans: Any three of: img, br, hr, input, meta - Differentiate GET and POST form methods.
Ans: GET appends data visibly to the URL with a length limit; POST sends data in the request body, not shown in the URL - Name three semantic HTML5 elements introduced to replace generic <div> usage.
Ans: Any three of: header, nav, article, section, aside, footer, main - What is the purpose of the viewport meta tag?
Ans: Controls how the page is scaled/laid out on mobile device screens - Is <div> block-level or inline? What about <span>?
Ans: <div> is block-level; <span> is inline
Chapter 4 — XML
4.1 XML Basics — Well-Formed vs Valid
SimpleXML (eXtensible Markup Language) stores/transports structured data using custom, user-defined tags — unlike HTML's fixed tag set.
| Well-formed XML | Valid XML | |
|---|---|---|
| Meaning | Follows basic XML syntax rules (proper nesting, single root, closed tags) | Well-formed AND conforms to a DTD/Schema |
| Requires DTD/Schema? | No | Yes |
JRF trapEvery VALID XML document must be well-formed, but a well-formed XML document is NOT necessarily valid (it might not follow any DTD/Schema, or might not have one at all). "Well-formed" is the weaker, more basic requirement.
4.2 XML Syntax Rules
- Exactly ONE root element.
- Every opening tag must have a matching closing tag (unlike HTML, no implied closing).
- Tags are case-sensitive (<Book> ≠ <book>).
- Elements must be properly nested (no overlapping tags).
- Attribute values must always be quoted.
TrapXML is stricter than HTML: a browser will happily render broken/unclosed HTML tags, but a single unclosed tag makes an XML document NOT well-formed, causing a parse error.
4.3 DTD vs XML Schema (XSD)
| DTD | XML Schema (XSD) | |
|---|---|---|
| Written in | Its own DTD syntax | XML syntax itself |
| Data types | No real data-type support | Rich data types (int, date, string, etc.) |
| Namespace support | No | Yes |
NET pointBoth DTD and XSD define the allowed structure/elements/attributes of an XML document — used to check VALIDITY, not well-formedness.
4.4 XML Parsing: DOM vs SAX
| DOM parsing | SAX parsing | |
|---|---|---|
| Approach | Loads entire document into memory as a tree | Event-based, reads sequentially, does not build a full tree |
| Memory use | Higher (whole tree in memory) | Lower (streaming) |
| Access pattern | Random access, can traverse/modify freely | Forward-only, read-once |
| Best for | Small/medium documents needing edits | Very large documents, read-only processing |
JRF insightDOM (tree-based, memory-heavy, random access) vs SAX (event-based, streaming, memory-light, forward-only) is one of the most reliable "compare two approaches" JRF questions for XML.
4.5 Namespaces, CDATA & XPath/XSLT (Overview)
- Namespace: avoids element-name collisions when combining XML vocabularies from different sources, using a URI (e.g., xmlns:h="...").
- CDATA section: <![CDATA[ ... ]]> tells the parser to treat the enclosed text as plain character data, NOT to be parsed as markup (useful for embedding code/special characters).
- XPath: a query language used to navigate/select nodes within an XML document.
- XSLT: a language used to transform an XML document into another format (e.g., XML → HTML).
MUST REMEMBER — Chapter 4 (XML)
- Valid XML ⊂ Well-formed XML (valid is always well-formed, not vice versa).
- XML must have exactly one root, matching close tags, case-sensitive tags, proper nesting, quoted attributes.
- DTD = own syntax, no data types; XSD = XML syntax, rich data types, supports namespaces.
- DOM = tree in memory, random access; SAX = event-driven streaming, forward-only, low memory.
- CDATA prevents enclosed text from being parsed as markup.
- XPath queries/selects nodes; XSLT transforms XML into another format.
DON'T CONFUSE
- Well-formed (syntax only) vs Valid (syntax + conforms to DTD/Schema).
- DOM (tree, memory-heavy) vs SAX (streaming, memory-light).
- DTD (own syntax) vs XSD (written in XML itself, supports data types).
JRF CHALLENGE ZONE — Chapter 4 (XML)
1. An XML document has no DTD/Schema attached but follows all basic syntax rules correctly. It is: (a) Valid but not well-formed (b) Well-formed but not valid (c) Both valid and well-formed (d) Neither
Answer: (b)
Answer: (b)
2. Which parser is more suitable for processing a 5GB XML log file with only sequential read access needed? (a) DOM (b) SAX (c) Either equally (d) Neither can handle it
Answer: (b) — SAX streams without loading the whole file into memory.
Answer: (b) — SAX streams without loading the whole file into memory.
3. Which is FALSE? (a) XML tags are case-sensitive (b) XML allows multiple root elements (c) XML attribute values must be quoted (d) Every opening tag needs a matching closing tag
Answer: (b) — XML requires exactly ONE root element.
Answer: (b) — XML requires exactly ONE root element.
Practice Questions — Chapter 4 (XML) (6)
- Differentiate "well-formed" and "valid" XML.
Ans: Well-formed = follows basic syntax rules; Valid = well-formed AND conforms to a DTD/Schema - List any three XML well-formedness rules.
Ans: Any three of: single root element, matching closing tags, case-sensitive tags, proper nesting, quoted attribute values - Differentiate DTD and XML Schema (XSD).
Ans: DTD uses its own syntax with no real data types; XSD is written in XML itself and supports rich data types and namespaces - Differentiate DOM and SAX parsing.
Ans: DOM loads the whole document as a tree (random access, memory-heavy); SAX is event-based streaming (forward-only, memory-light) - What is the purpose of a CDATA section in XML?
Ans: To mark enclosed text as plain data so the parser does not interpret it as markup - What do XPath and XSLT do, respectively?
Ans: XPath navigates/selects nodes in an XML document; XSLT transforms an XML document into another format
SECTION B — COMPUTER GRAPHICS
Chapter 1 — Introduction & Display Devices
1.1 Computer Graphics — Basics
SimpleComputer graphics is about creating, manipulating and displaying pictures using a computer — from simple lines to realistic 3D scenes.
| Raster graphics | Vector graphics | |
|---|---|---|
| Made of | Pixels (grid of dots) | Mathematical shapes (lines, curves) |
| Scaling | Loses quality (pixelates) | Scales without quality loss |
| Example | Photographs, .bmp, .jpg | Fonts, .svg, CAD drawings |
1.2 CRT (Cathode Ray Tube) & Display Concepts
- Persistence: how long the phosphor glow remains after the electron beam moves away — low persistence needs a high refresh rate to avoid flicker.
- Resolution: number of distinct pixels that can be displayed (e.g., 1920×1080). Higher resolution = sharper image.
- Aspect ratio: ratio of horizontal to vertical display size (e.g., 4:3, 16:9).
- Refresh rate: number of times per second the screen is redrawn (measured in Hz). Below ~24-30Hz, flicker becomes noticeable to the human eye.
JRF trap — interlaced vs non-interlaced (progressive)Interlaced scanning refreshes odd lines then even lines alternately (two passes per frame) — reduces bandwidth needed but can cause visible flicker/artifacts on motion. Progressive (non-interlaced) scanning refreshes ALL lines in one pass — smoother but needs more bandwidth. NET commonly asks which is which.
1.3 Display Technologies
| Tech | Key idea |
|---|---|
| CRT | Electron beam excites phosphor coating on screen |
| Plasma | Ionized gas cells emit light |
| LCD | Liquid crystals modulate light from a backlight |
| LED | LCD variant using LEDs for backlighting (or OLED = self-emissive, no backlight needed) |
1.4 Random Scan vs Raster Scan Displays
IdeaRandom scan (vector) displays draw only the required lines directly (like a pen following an outline) — good for wireframe/line drawings, refresh rate depends on picture complexity. Raster scan displays sweep the ENTIRE screen row by row, lighting up pixels as needed — used in nearly all modern displays, supports realistic shaded images.
MUST REMEMBER — Section B, Chapter 1
- Raster = pixel-based (loses quality when scaled); Vector = math-based (scales cleanly).
- Persistence = how long phosphor glows; low persistence needs higher refresh rate.
- Interlaced = two passes (odd/even lines) per frame; Progressive = one full pass.
- Raster scan = whole-screen row-by-row sweep (modern standard); Random/vector scan = draws only required lines.
DON'T CONFUSE
- Raster GRAPHICS (pixel image type) vs Raster SCAN displays (how the screen is drawn) — related but distinct terms.
- Interlaced vs Progressive scanning.
JRF CHALLENGE ZONE — Section B, Ch.1
1. Which display technology directly emits light per pixel without needing a backlight? (a) LCD (b) OLED (c) Plasma-only historically (d) Both (b) and historically (c)
Answer: (d) — OLED and plasma are both self-emissive; LCD needs a backlight.
Answer: (d) — OLED and plasma are both self-emissive; LCD needs a backlight.
2. A display refreshes odd-numbered lines, then even-numbered lines, alternately. This is: (a) Progressive scanning (b) Interlaced scanning (c) Random scanning (d) Raster-free scanning
Answer: (b)
Answer: (b)
Practice Questions — Section B, Ch.1 (6)
- Differentiate raster and vector graphics.
Ans: Raster = pixel-grid based, loses quality on scaling; Vector = mathematically defined shapes, scales without quality loss - What is persistence in a CRT display?
Ans: The duration the phosphor continues to glow after being excited by the electron beam - Differentiate interlaced and progressive (non-interlaced) scanning.
Ans: Interlaced refreshes odd then even lines in two passes; progressive refreshes all lines in a single pass - What does "resolution" of a display refer to?
Ans: The number of distinct pixels that can be displayed, usually given as width × height - Differentiate random scan (vector) and raster scan displays.
Ans: Random scan draws only the required lines directly; raster scan sweeps the entire screen row by row - Why does OLED not need a backlight, unlike LCD?
Ans: OLED pixels are self-emissive (each pixel produces its own light); LCD pixels only modulate light from a separate backlight
Chapter 2 — Scan Conversion
2.1 Line Drawing — DDA Algorithm
SimpleScan conversion means figuring out exactly which pixels to light up to represent a line, circle, or shape on a pixel grid. DDA (Digital Differential Analyzer) is the simplest line-drawing algorithm — it steps along the line using floating-point increments.
m = (y2−y1)/(x2−x1)
If |m| ≤ 1: step x by 1 each time, y += m
If |m| > 1: step y by 1 each time, x += 1/m
JRF-level numericalLine from (2,3) to (8,9): dx=6, dy=6, m=1. Since |m|≤1, step x=1 each time: points are (2,3),(3,4),(4,5),(5,6),(6,7),(7,8),(8,9) — 7 points total (using round-off each step). DDA uses floating-point arithmetic — a known weakness (rounding errors accumulate, slower than Bresenham).
2.2 Bresenham's Line Algorithm
IdeaBresenham's algorithm draws lines using ONLY integer arithmetic (no floating point, no rounding), making it faster and more efficient than DDA — the industry-standard line algorithm.
For a line with 0 < m < 1, starting decision parameter:
p0 = 2Δy − Δx
If pk < 0: next point (xk+1, yk), pk+1 = pk + 2Δy
If pk ≥ 0: next point (xk+1, yk+1), pk+1 = pk + 2Δy − 2Δx
JRF-level numericalLine from (0,0) to (8,4): Δx=8, Δy=4. p0 = 2(4)−8 = 0. Since p0≥0 → plot (1,1), p1 = 0+2(4)−2(8) = −8. Since p1<0 → plot (2,1), p2 = −8+2(4) = 0. Pattern continues, alternately incrementing y as the decision parameter dictates — this "when does y increment" logic is exactly what NET/JRF numericals test.
Common mistakeApplying the same decision-parameter formula without adjusting for the line's slope case (|m|<1 vs |m|>1 vs negative slope) — the algorithm's update rule changes depending on which octant the line falls in.
2.3 Midpoint Circle Algorithm
IdeaUses 8-way symmetry (one computed point gives 8 points on the circle by reflecting across axes/diagonals) and integer decision parameters, similar in spirit to Bresenham's line algorithm.
Initial decision parameter: p0 = 1 − r
If pk < 0: next point (xk+1, yk), pk+1 = pk + 2xk+1 + 1
If pk ≥ 0: next point (xk+1, yk−1), pk+1 = pk + 2xk+1 + 1 − 2yk+1
Worked exampleCircle with radius r=10, centered at origin: p0 = 1−10 = −9. Since p0<0, next point moves only in x (stays at same y), and the algorithm proceeds using 8-way symmetry to plot all 8 octant-reflections of each computed point, drastically reducing the number of points that need actual calculation.
2.4 Polygon Filling
| Method | Idea |
|---|---|
| Scanline fill | For each horizontal scanline, find intersection points with polygon edges, fill between pairs of intersections |
| Boundary fill | Start from a seed point, keep filling neighbouring pixels until hitting the boundary colour |
| Flood fill | Start from a seed point, replace all connected pixels of the OLD colour with a NEW colour (not boundary-dependent) |
JRF trap — boundary fill vs flood fillBoundary fill stops when it hits a specific BOUNDARY COLOUR. Flood fill instead replaces all connected pixels that match the STARTING (old) colour, and stops when the colour changes — useful when there's no clearly defined single boundary colour. Confusing "stops at boundary colour" vs "replaces old colour" is a very common trap.
2.5 Aliasing & Anti-Aliasing
SimpleBecause pixels are discrete squares, diagonal/curved lines appear jagged ("staircase effect") — this is aliasing. Anti-aliasing smooths this by shading edge pixels with intermediate colours/intensities based on how much of the pixel the line covers.
MUST REMEMBER — Section B, Chapter 2
- DDA uses floating-point increments (simple but slower, rounding errors); Bresenham uses only integer arithmetic (faster, industry standard).
- Bresenham decision parameter: p0 = 2Δy−Δx (for 0<m<1); update depends on sign of pk.
- Midpoint circle: p0 = 1−r; uses 8-way symmetry.
- Scanline fill = edge-intersection based; Boundary fill = stops at boundary colour; Flood fill = replaces old colour until it changes.
- Aliasing = jagged/staircase edges from pixel discreteness; anti-aliasing smooths via intermediate shading.
DON'T CONFUSE
- Boundary fill (stops at a specific boundary colour) vs Flood fill (replaces the connected old colour).
- DDA (floating point) vs Bresenham (integer only).
JRF CHALLENGE ZONE — Section B, Ch.2
1. For a line from (0,0) to (8,4) using Bresenham's algorithm, Δx=8, Δy=4, p0 = ? (a) 4 (b) 0 (c) −8 (d) 8
Answer: (b) — p0 = 2Δy−Δx = 8−8 = 0.
Answer: (b) — p0 = 2Δy−Δx = 8−8 = 0.
2. Which algorithm is preferred in practice for line drawing, and why? (a) DDA, simpler formula (b) Bresenham, integer-only arithmetic is faster and avoids rounding errors (c) Both are identical in performance (d) Neither is used today
Answer: (b)
Answer: (b)
3. A fill algorithm replaces all connected pixels of the STARTING colour with a new colour, regardless of any boundary line. This is: (a) Boundary fill (b) Scanline fill (c) Flood fill (d) Bresenham fill
Answer: (c)
Answer: (c)
Practice Questions — Section B, Ch.2 (8)
- What is the main weakness of the DDA line-drawing algorithm compared to Bresenham's?
Ans: DDA uses floating-point arithmetic, causing rounding errors and slower performance - Write the initial decision parameter formula for Bresenham's line algorithm (0<m<1).
Ans: p0 = 2Δy − Δx - What is the initial decision parameter for the midpoint circle algorithm?
Ans: p0 = 1 − r - Why does the midpoint circle algorithm only need to compute one octant?
Ans: Because of 8-way symmetry, one computed point gives 8 points by reflection - Differentiate boundary fill and flood fill.
Ans: Boundary fill stops at a defined boundary colour; flood fill replaces all connected pixels of the starting colour - How does scanline polygon filling work?
Ans: For each horizontal scanline, find intersections with polygon edges and fill pixels between paired intersection points - What causes aliasing (jagged edges) in raster graphics?
Ans: Pixels are discrete squares, so diagonal/curved lines can only be approximated, creating a staircase effect - How does anti-aliasing reduce the jagged appearance of lines?
Ans: By shading edge pixels with intermediate colours/intensities proportional to how much of the pixel the line covers
Chapter 3 — 2D Transformations
3.1 Basic Transformations
Translation: x' = x + tx, y' = y + ty
Scaling: x' = x . sx, y' = y . sy
Rotation (about origin, angle θ):
x' = x cosθ − y sinθ
y' = x sinθ + y cosθ
Worked example — rotationRotate point (1,0) by θ=90°: x' = 1×cos90 − 0×sin90 = 0; y' = 1×sin90 + 0×cos90 = 1. New point = (0,1) — matches intuition (rotating the point (1,0) a quarter turn counter-clockwise lands it on (0,1)).
3.2 Homogeneous Coordinates & Matrix Form
SimpleHomogeneous coordinates add a third coordinate (x, y, 1) so that translation — which is normally just addition — can ALSO be expressed as matrix multiplication, letting all transformations (translate, scale, rotate) be combined using one consistent matrix framework.
Translation matrix: Scaling matrix: Rotation matrix:
[1 0 tx] [sx 0 0] [cosθ −sinθ 0]
[0 1 ty] [0 sy 0] [sinθ cosθ 0]
[0 0 1 ] [0 0 1] [0 0 1]
3.3 Composite Transformations
IdeaMultiple transformations (e.g., translate then rotate then scale) are combined into ONE matrix by multiplying the individual matrices together, then applying the single combined matrix to every point — much more efficient than applying each transformation separately.
JRF trap — order matters!Matrix multiplication is NOT commutative: rotating then translating gives a DIFFERENT result than translating then rotating. For "rotate about an arbitrary point P (not the origin)", the correct composite sequence is: (1) Translate P to origin, (2) Rotate about origin, (3) Translate back to P's original position. Reversing this order is a very common JRF mistake.
3.4 Reflection & Shearing
| Transformation | Effect |
|---|---|
| Reflection about x-axis | (x,y) → (x,−y) |
| Reflection about y-axis | (x,y) → (−x,y) |
| Reflection about origin | (x,y) → (−x,−y) |
| Shearing (x-direction) | x' = x + shx·y, y' = y (slants the shape sideways) |
MUST REMEMBER — Section B, Chapter 3
- Translation adds; Scaling multiplies; Rotation uses sin/cos formulas.
- Homogeneous coordinates (x,y,1) let translation be expressed as matrix multiplication too.
- Composite transformations = multiply individual matrices; order matters (not commutative).
- Rotation about an arbitrary point: translate to origin → rotate → translate back.
- Shearing slants a shape; reflection flips it across an axis or the origin.
DON'T CONFUSE
- Rotation about the origin (direct formula) vs rotation about an arbitrary point (needs the translate-rotate-translate-back sequence).
- Scaling (multiplies coordinates) vs Translation (adds to coordinates).
JRF CHALLENGE ZONE — Section B, Ch.3
1. To rotate a shape about a point P that is NOT the origin, the correct sequence is: (a) Rotate, then translate to P (b) Translate P to origin, rotate, translate back (c) Scale, then rotate (d) Only rotation is needed
Answer: (b)
Answer: (b)
2. Why are homogeneous coordinates used in 2D graphics transformations?
Answer: So translation (normally addition) can also be represented as matrix multiplication, allowing all transformations to be combined into one matrix.
Answer: So translation (normally addition) can also be represented as matrix multiplication, allowing all transformations to be combined into one matrix.
3. Rotating then translating a point generally gives: (a) The same result as translating then rotating (b) A different result — matrix multiplication is not commutative (c) An error (d) Always the origin
Answer: (b)
Answer: (b)
Practice Questions — Section B, Ch.3 (7)
- Write the formula for rotating point (x,y) by angle θ about the origin.
Ans: x' = x·cosθ − y·sinθ; y' = x·sinθ + y·cosθ - Rotate point (0,1) by θ=90° about the origin. Find the new point.
Ans: x' = 0×cos90 − 1×sin90 = −1; y' = 0×sin90 + 1×cos90 = 0 → (−1, 0) - Why are homogeneous coordinates needed for translation specifically?
Ans: Because translation is addition, not multiplication, so a 2×2 matrix alone cannot represent it — the extra coordinate allows it to be expressed via matrix multiplication - What is the correct sequence to rotate a shape about an arbitrary point P?
Ans: Translate P to the origin, rotate about the origin, then translate back to P's original position - Is matrix multiplication for composite transformations commutative?
Ans: No — the order of transformations changes the result - What is the effect of reflecting a point about the origin?
Ans: (x,y) becomes (−x,−y) - What does shearing do to a 2D shape?
Ans: It slants/skews the shape in a given direction, proportional to the coordinate in the other direction
Chapter 4 — Shading & Hidden Surface Removal
4.1 Illumination & Shading Models
SimpleShading calculates how light reflects off a surface to make 3D objects look realistic (rather than flat, single-colour polygons).
| Model | Idea |
|---|---|
| Flat shading | One colour per polygon face (fast, but faceted/blocky look) |
| Gouraud shading | Colours computed at vertices, then interpolated across the polygon's interior (smooth colour transitions, but can miss sharp highlights) |
| Phong shading | Interpolates the surface NORMAL vectors (not just colours) across the polygon, then computes lighting per pixel — most realistic, most computationally expensive |
JRF trap — Gouraud vs PhongGouraud shading interpolates COLOUR values (computed once per vertex). Phong shading interpolates NORMAL VECTORS and computes lighting freshly at every pixel — this is why Phong can reproduce sharp specular highlights that Gouraud often misses or blurs. Mixing up "what gets interpolated" (colour vs normal) is the classic trap.
4.2 Hidden Surface Removal (HSR)
IdeaIn a 3D scene, some surfaces are blocked from view by others (closer to the camera) — HSR algorithms determine which surfaces/pixels are actually visible and should be drawn.
| Algorithm | Idea |
|---|---|
| Z-buffer (depth-buffer) | Stores the closest depth (z) value found so far for each pixel; a new pixel is drawn only if its z is closer than what's stored |
| Painter's algorithm | Sorts polygons back-to-front by depth, draws far ones first then nearer ones "paint over" them |
| Back-face culling | Skips drawing polygons whose normal faces AWAY from the viewer (assuming a closed/solid object), since they can never be visible |
JRF trap — Z-buffer vs Painter's algorithmPainter's algorithm fails when polygons overlap in a CYCLE (A blocks B, B blocks C, C blocks A) — no valid back-to-front sort order exists. The Z-buffer algorithm has no such problem since it compares depth PER PIXEL, independent of drawing order — this "which algorithm handles cyclic overlap correctly" is a favourite JRF distinction.
MUST REMEMBER — Section B, Chapter 4
- Flat = one colour/face; Gouraud = interpolates colour across vertices; Phong = interpolates normals, computes lighting per pixel (most realistic, most expensive).
- Z-buffer compares per-pixel depth; works regardless of draw order.
- Painter's algorithm sorts back-to-front; fails on cyclic overlaps.
- Back-face culling skips polygons facing away from the viewer.
DON'T CONFUSE
- Gouraud shading (interpolates colour) vs Phong shading (interpolates normal vectors).
- Z-buffer (per-pixel depth comparison) vs Painter's algorithm (sorts whole polygons back-to-front).
JRF CHALLENGE ZONE — Section B, Ch.4
1. Which shading model interpolates surface normal vectors (not just colour) across a polygon? (a) Flat shading (b) Gouraud shading (c) Phong shading (d) None
Answer: (c)
Answer: (c)
2. Three polygons A, B, C overlap such that A blocks B, B blocks C, and C blocks A (a cycle). Which HSR method handles this correctly? (a) Painter's algorithm (b) Z-buffer algorithm (c) Neither can handle it (d) Both equally
Answer: (b) — Painter's algorithm needs a valid sort order, which doesn't exist for cyclic overlaps.
Answer: (b) — Painter's algorithm needs a valid sort order, which doesn't exist for cyclic overlaps.
Practice Questions — Section B, Ch.4 (7)
- Differentiate flat shading and Gouraud shading.
Ans: Flat shading uses one colour per polygon face; Gouraud computes colours at vertices and interpolates across the surface - What makes Phong shading more realistic (and more expensive) than Gouraud shading?
Ans: Phong interpolates normal vectors and computes lighting per pixel, capturing sharp highlights Gouraud often misses - How does the Z-buffer algorithm decide which pixel to draw?
Ans: It keeps the closest depth (z) value found so far per pixel; a new pixel is drawn only if it is closer - Why can the Painter's algorithm fail for certain scenes?
Ans: When polygons overlap in a cycle (A blocks B, B blocks C, C blocks A), no valid back-to-front sort order exists - What is back-face culling, and what assumption does it rely on?
Ans: Skipping polygons whose normal faces away from the viewer; relies on the object being closed/solid so such faces are never visible - Which HSR algorithm's correctness does NOT depend on the order polygons are drawn in?
Ans: Z-buffer (depth-buffer) algorithm - What is interpolated in Gouraud shading versus what is interpolated in Phong shading?
Ans: Gouraud interpolates colour values; Phong interpolates normal vectors
Chapter 5 — Projection
5.1 Why Projection is Needed
SimpleA 3D scene must be "flattened" onto a 2D screen to be displayed — this flattening process is called projection.
5.2 Parallel vs Perspective Projection
| Parallel projection | Perspective projection | |
|---|---|---|
| Projection lines | Parallel to each other | Converge at a single point (centre of projection) |
| Realism | Less realistic (no size change with distance) | More realistic (mimics human eye/camera — objects shrink with distance) |
| Preserves | Relative proportions/parallel lines | Does NOT preserve parallel lines (they appear to converge) |
| Used for | Technical/engineering drawings (CAD) | Realistic rendering, games, movies |
5.3 Types of Parallel Projection
| Type | Idea |
|---|---|
| Orthographic | Projection lines perpendicular to the viewing plane (e.g., front/top/side views) |
| Oblique — Cavalier | Projection lines at an angle; depth lines drawn at FULL/true scale |
| Oblique — Cabinet | Projection lines at an angle; depth lines drawn at HALF scale (looks more realistic than cavalier) |
JRF trap — Cavalier vs CabinetBoth are oblique projections (not perpendicular to the view plane), but Cavalier preserves the TRUE (full) length along the depth axis, while Cabinet foreshortens depth to HALF length — making Cabinet projections look more realistic/natural. Mixing up which one halves the depth is a common trap.
5.4 Perspective Projection & Vanishing Points
IdeaIn perspective projection, sets of parallel lines that are NOT parallel to the view plane appear to converge at a "vanishing point" on the horizon — this is what creates the realistic sense of depth.
NET pointPerspective projections are classified by the number of vanishing points: one-point, two-point, or three-point perspective — depending on how many principal axes (x, y, z) are cut by the view plane.
MUST REMEMBER — Section B, Chapter 5
- Parallel projection: projection lines stay parallel; no size change with distance; used in CAD.
- Perspective projection: lines converge at a centre of projection; realistic, mimics real vision.
- Orthographic = perpendicular to view plane; Oblique (Cavalier/Cabinet) = at an angle.
- Cavalier = full-scale depth; Cabinet = half-scale depth (more realistic).
- Perspective projections classified by number of vanishing points (1-point, 2-point, 3-point).
DON'T CONFUSE
- Cavalier (full depth scale) vs Cabinet (half depth scale) oblique projection.
- Parallel projection (no vanishing point) vs Perspective projection (has vanishing point(s)).
JRF CHALLENGE ZONE — Section B, Ch.5
1. Which oblique projection draws depth lines at HALF their true length? (a) Cavalier (b) Cabinet (c) Orthographic (d) Isometric
Answer: (b)
Answer: (b)
2. Why does perspective projection look more realistic than parallel projection?
Answer: Because objects appear smaller as they get farther away (projection lines converge at a point), matching how human vision/cameras actually work.
Answer: Because objects appear smaller as they get farther away (projection lines converge at a point), matching how human vision/cameras actually work.
Practice Questions — Section B, Ch.5 (6)
- Differentiate parallel and perspective projection.
Ans: Parallel projection lines stay parallel (no size change with distance); perspective projection lines converge at a point (objects shrink with distance) - What is a "vanishing point" in perspective projection?
Ans: The point where parallel lines (not parallel to the view plane) appear to converge, creating the illusion of depth - Differentiate Cavalier and Cabinet oblique projections.
Ans: Cavalier keeps full/true depth scale; Cabinet halves the depth scale, appearing more realistic - What is orthographic projection?
Ans: A parallel projection where projection lines are perpendicular to the viewing plane - How are perspective projections classified?
Ans: By the number of vanishing points — one-point, two-point, or three-point perspective - Which type of projection is typically used for engineering/CAD drawings, and why?
Ans: Parallel projection — because it preserves true proportions/parallel lines needed for accurate measurement
Chapter 6 — Animation
6.1 Computer Animation Basics
SimpleAnimation creates the illusion of movement by rapidly displaying a sequence of slightly different still images (frames), exploiting persistence of vision.
6.2 Key-frame Animation & Interpolation
IdeaAn animator (or system) defines important "key frames" marking significant poses/positions; the in-between frames ("tweening"/interpolation) are generated automatically by interpolating between key frames.
JRF insightLinear interpolation between key frames can look mechanical/unnatural; smoother animation typically uses spline-based interpolation for more natural acceleration/deceleration ("easing") between key poses.
6.3 Morphing
IdeaMorphing is a special animation technique that smoothly transforms one image/shape into a completely different one over a sequence of frames (e.g., one face gradually turning into another) — combining both shape (warping) and colour (cross-dissolve) transitions.
6.4 Types of Computer Animation
| Type | Idea |
|---|---|
| Frame-by-frame (traditional) | Every single frame is drawn/specified individually |
| Key-frame based | Only key poses defined; in-between frames interpolated automatically |
| Procedural/physics-based | Motion generated by rules/physics simulation (e.g., gravity, collisions) rather than manually specified |
MUST REMEMBER — Section B, Chapter 6
- Animation exploits persistence of vision — rapid sequential still frames appear as motion.
- Key-frame animation: important poses defined manually; in-between frames generated by interpolation ("tweening").
- Morphing = smooth transformation from one shape/image into another, combining warping + cross-dissolve.
- Procedural/physics-based animation generates motion from rules/simulation, not manual frame specification.
JRF CHALLENGE ZONE — Section B, Ch.6
1. The automatic generation of in-between frames from defined key frames is called: (a) Rendering (b) Tweening/interpolation (c) Rasterizing (d) Culling
Answer: (b)
Answer: (b)
2. Morphing primarily combines which two effects? (a) Shading and lighting (b) Shape warping and colour cross-dissolve (c) Z-buffering and culling (d) Scaling and rotation only
Answer: (b)
Answer: (b)
Practice Questions — Section B, Ch.6 (5)
- What visual phenomenon does animation rely on to create the illusion of motion?
Ans: Persistence of vision - What is a "key frame" in key-frame animation?
Ans: A frame marking a significant/important pose or position, manually defined by the animator - What is "tweening"?
Ans: The automatic generation of in-between frames by interpolating between key frames - What is morphing, and what two kinds of transition does it combine?
Ans: A technique that smoothly transforms one image into another, combining shape warping and colour cross-dissolve - Differentiate key-frame animation from procedural/physics-based animation.
Ans: Key-frame animation interpolates between manually defined poses; procedural animation generates motion from rules/physics simulation
Chapter 7 — Colour Models
7.1 RGB Model
SimpleRGB (Red, Green, Blue) is an ADDITIVE colour model — combining light of different colours. Used for screens/displays (light-emitting devices).
NET pointAdditive mixing: Red+Green+Blue (all at full intensity) = White. No light (all zero) = Black.
7.2 CMY / CMYK Model
SimpleCMY (Cyan, Magenta, Yellow) is a SUBTRACTIVE colour model — used for printing, where pigments absorb (subtract) light rather than emit it. CMYK adds blacK for deeper, more economical black printing (since mixing C+M+Y ink rarely produces a true, rich black).
C = 1 − R, M = 1 − G, Y = 1 − B (simple RGB-to-CMY conversion, normalized 0 to 1)
JRF trap — additive vs subtractiveRGB (screens, additive, combining LIGHT) vs CMY/CMYK (printing, subtractive, combining PIGMENT/INK that absorbs light) — this "why does print use a different model than screens" reasoning is a common JRF conceptual question.
7.3 HSV Model
IdeaHSV (Hue, Saturation, Value) describes colour more intuitively for humans: Hue = the actual colour (position on a colour wheel), Saturation = how vivid/pure vs washed-out, Value = brightness/lightness.
7.4 YIQ Model
IdeaYIQ was used in NTSC television broadcasting: Y = luminance (brightness — this is what old black-and-white TVs used), I and Q = chrominance (colour information), added on top for colour TVs while staying backward-compatible with black-and-white sets.
MUST REMEMBER — Section B, Chapter 7
- RGB = additive (light, screens); CMY/CMYK = subtractive (ink/pigment, printing).
- RGB: R+G+B (full) = White; all zero = Black.
- CMYK adds black (K) since C+M+Y alone rarely gives a true rich black economically.
- HSV: Hue = colour, Saturation = purity/vividness, Value = brightness.
- YIQ: Y = luminance (brightness, B&W-compatible), I/Q = chrominance (colour info) — used in NTSC TV.
DON'T CONFUSE
- RGB (additive, light) vs CMY/CMYK (subtractive, pigment/ink).
- Saturation (purity of colour) vs Value/brightness (lightness/darkness) in HSV.
JRF CHALLENGE ZONE — Section B, Ch.7
1. Which colour model is subtractive and used for printing? (a) RGB (b) CMYK (c) HSV (d) YIQ
Answer: (b)
Answer: (b)
2. In RGB, combining full-intensity Red, Green and Blue produces: (a) Black (b) White (c) Grey (d) Cyan
Answer: (b)
Answer: (b)
Practice Questions — Section B, Ch.7 (6)
- Is RGB an additive or subtractive colour model? Where is it used?
Ans: Additive; used in screens/displays - Is CMY/CMYK an additive or subtractive colour model? Where is it used?
Ans: Subtractive; used in printing - Why is K (black) added to the CMY model for printing?
Ans: Because mixing cyan, magenta and yellow ink rarely produces a true, rich, economical black - What do the H, S and V stand for in the HSV colour model?
Ans: Hue (colour), Saturation (vividness/purity), Value (brightness) - What does the Y component represent in the YIQ model, and why is that useful?
Ans: Luminance/brightness; useful because it keeps compatibility with black-and-white television sets - What colour results in RGB when Red, Green and Blue are all at zero intensity?
Ans: Black
Chapter 8 — Graphic Curves
8.1 Why Curves Need Special Representation
SimpleSimple polygons (straight edges) can't smoothly represent curved shapes (car bodies, fonts, animation paths) — curve representations like Bezier and B-spline let designers control a smooth curve using just a few "control points."
8.2 Bezier Curves
IdeaA Bezier curve is defined by a set of control points; the curve passes through the FIRST and LAST control points, but generally NOT through the intermediate ones — the intermediate points only "pull"/influence the curve's shape.
NET pointA cubic Bezier curve uses exactly 4 control points (degree 3). In general, n+1 control points give a Bezier curve of degree n.
JRF trapMoving ANY single control point of a Bezier curve affects the ENTIRE curve's shape (global control) — Bezier curves do NOT have local control. This is a key limitation compared to B-splines.
8.3 B-Spline Curves
IdeaB-spline curves are built from multiple polynomial segments joined together smoothly, using a "knot vector." Unlike Bezier curves, B-splines offer LOCAL control — moving one control point affects only a limited nearby portion of the curve, leaving the rest unchanged.
| Bezier curve | B-spline curve | |
|---|---|---|
| Control | Global (one point affects whole curve) | Local (one point affects only nearby segment) |
| Passes through | First & last control points only | Depends on the spline type/knot configuration |
| Degree vs points | Degree = (number of control points) − 1 | Degree can be set independently of the number of control points |
JRF insight — this is a very high-yield comparison"Global vs local control" is the single most-tested Bezier-vs-B-spline distinction: with Bezier, editing one control point can drastically reshape a curve far from that point; with B-spline, the edit stays confined near that control point — a major practical advantage in CAD/design software.
8.4 Blending Functions (Concept)
IdeaBoth Bezier and B-spline curves compute a point on the curve as a WEIGHTED SUM of the control points, where the weights are given by "blending functions" (Bernstein polynomials for Bezier). Different blending functions give the curve its different mathematical properties (global vs local control).
MUST REMEMBER — Section B, Chapter 8
- Bezier curve passes through first & last control points only; degree = (n control points) − 1.
- Bezier has GLOBAL control — one point moved affects the whole curve.
- B-spline has LOCAL control — one point moved affects only a nearby segment.
- Cubic Bezier = 4 control points (degree 3).
- Both use "blending functions" to compute curve points as weighted sums of control points.
DON'T CONFUSE
- Bezier curve (global control) vs B-spline curve (local control) — the single most-tested distinction here.
JRF CHALLENGE ZONE — Section B, Ch.8
1. Moving one control point in a B-spline curve affects: (a) The entire curve (b) Only a limited nearby portion of the curve (c) Nothing (d) Only the endpoints
Answer: (b)
Answer: (b)
2. A Bezier curve is built from 5 control points. What is its degree? (a) 3 (b) 4 (c) 5 (d) 6
Answer: (b) — degree = (number of control points) − 1 = 4.
Answer: (b) — degree = (number of control points) − 1 = 4.
Practice Questions — Section B, Ch.8 (6)
- Does a Bezier curve pass through all its control points?
Ans: No — only through the first and last control points - What is the degree of a cubic Bezier curve, and how many control points does it use?
Ans: Degree 3, using 4 control points - Differentiate "global control" and "local control" in curve editing.
Ans: Global control means moving one point reshapes the whole curve; local control means it affects only a nearby segment - Does a Bezier curve have global or local control?
Ans: Global control - Does a B-spline curve have global or local control?
Ans: Local control - What role do "blending functions" play in Bezier/B-spline curves?
Ans: They provide the weights used to compute a curve point as a weighted sum of the control points
Chapter 9 — Multimedia
9.1 Multimedia — Components
SimpleMultimedia combines multiple forms of media — text, images, audio, video, animation — often made interactive.
9.2 Compression — Lossy vs Lossless
| Lossless compression | Lossy compression | |
|---|---|---|
| Data on decompression | Exactly reconstructed, no data lost | Approximated — some data permanently discarded |
| Compression ratio | Lower | Higher (much smaller files) |
| Used for | Text, program files, medical images (.zip, .png, .gif) | Photos, audio, video where minor quality loss is acceptable (.jpg, .mp3, .mp4) |
JRF trapPNG and GIF are LOSSLESS image formats; JPEG is LOSSY. Choosing PNG for a photograph (large lossless file) vs JPEG for simple line-art/text-heavy images (visible compression artifacts on sharp edges) is a common scenario-based NET/JRF question.
9.3 Common File Formats
| Type | Format examples |
|---|---|
| Image | JPEG (lossy), PNG (lossless), GIF (lossless, supports animation) |
| Audio | MP3 (lossy), WAV (lossless/uncompressed) |
| Video | MPEG, MP4, AVI (typically lossy compression) |
9.4 Multimedia Applications
- Education (e-learning, interactive tutorials).
- Entertainment (games, streaming video/audio).
- Business (presentations, video conferencing).
- Virtual reality/simulation training.
MUST REMEMBER — Section B, Chapter 9
- Lossless compression: exact reconstruction, lower compression ratio (ZIP, PNG, GIF).
- Lossy compression: approximated reconstruction, higher compression ratio, some data permanently lost (JPEG, MP3, MP4).
- PNG and GIF = lossless image formats; JPEG = lossy image format.
- WAV = lossless/uncompressed audio; MP3 = lossy compressed audio.
DON'T CONFUSE
- Lossless (exact, bigger files) vs Lossy (approximate, smaller files) compression.
- PNG/GIF (lossless) vs JPEG (lossy) image formats.
JRF CHALLENGE ZONE — Section B, Ch.9
1. Which image format is LOSSY, discarding some data permanently to shrink file size? (a) PNG (b) GIF (c) JPEG (d) BMP (uncompressed)
Answer: (c)
Answer: (c)
2. Which is generally TRUE? (a) Lossless compression always gives a smaller file than lossy (b) Lossy compression can achieve a higher compression ratio than lossless, at the cost of some data (c) Lossy and lossless always produce identical output files (d) JPEG is a lossless format
Answer: (b)
Answer: (b)
Practice Questions — Section B, Ch.9 (5)
- Differentiate lossy and lossless compression.
Ans: Lossless reconstructs data exactly (no loss); lossy discards some data permanently for a much smaller file - Name two lossless image formats and one lossy image format.
Ans: Lossless: PNG, GIF; Lossy: JPEG - Why is JPEG generally unsuitable for storing text-heavy or line-art images?
Ans: Its lossy compression creates visible artifacts around sharp edges/text, degrading quality - Is WAV audio format lossy or lossless?
Ans: Lossless/uncompressed - Name three application areas of multimedia.
Ans: Any three of: education, entertainment, business/presentations, virtual reality/training
One-Shot Revision — Unit 2
Section A: Programming Languages — key facts
- C: post-inc uses old value then increments; pre-inc increments first. switch = integral/char only. do-while runs ≥1 time.
- C: pointer arithmetic scales by pointed-to type's size; C arrays are row-major.
- C: static local var — lifetime=program, scope=still local. Structures can have padding (sizeof ≠ sum of members).
- C++: construction Base→Derived; destruction Derived→Base (reverse).
- C++: Overloading=compile-time/different signature; Overriding=runtime/same signature/needs virtual.
- C++: pure virtual (=0) → abstract class, cannot instantiate. Diamond problem → solved via virtual inheritance.
- HTML: DOCTYPE is a declaration, not a tag. Void elements (img, br, hr, input) have no closing tag. GET=URL-visible; POST=body.
- XML: Valid ⊂ Well-formed. DTD=own syntax, no datatypes; XSD=XML syntax, datatypes+namespaces. DOM=tree/memory-heavy; SAX=streaming/forward-only.
Section B: Computer Graphics — key facts
- Raster=pixels (loses quality scaling); Vector=math shapes (scales cleanly).
- Interlaced=odd/even lines, 2 passes; Progressive=all lines, 1 pass.
- DDA=floating point, slower; Bresenham=integer only, faster, industry standard.
- Bresenham p0 = 2Δy−Δx (0<m<1). Midpoint circle p0 = 1−r, uses 8-way symmetry.
- Boundary fill=stops at boundary colour; Flood fill=replaces old colour.
- Rotation about arbitrary point P: translate P→origin, rotate, translate back. Matrix mult NOT commutative.
- Gouraud=interpolates colour; Phong=interpolates normals (per-pixel lighting, more realistic).
- Z-buffer=per-pixel depth compare (order-independent); Painter's=back-to-front sort (fails on cycles).
- Parallel projection=no vanishing point, used in CAD; Perspective=has vanishing point(s), realistic.
- Cavalier=full depth scale; Cabinet=half depth scale (more realistic).
- Key-frame animation: poses defined, in-between frames auto-interpolated ("tweening"). Morphing=shape warp+colour cross-dissolve.
- RGB=additive (light/screens); CMY/CMYK=subtractive (ink/print). HSV=Hue/Saturation/Value. YIQ=luminance+chrominance (NTSC TV).
- Bezier=global control, passes through first/last point only, degree=(points−1). B-spline=local control.
- Lossless=exact, bigger (PNG/GIF/ZIP); Lossy=approximate, smaller (JPEG/MP3/MP4).
Potential future exam areasPotential high-value exam area based on syllabus importance and historical question patterns: C/C++ output-prediction snippets combining pointers+operators; Bresenham/midpoint numericals with a full worked trace; Gouraud-vs-Phong or Z-buffer-vs-Painter's "which handles X correctly" questions; Bezier-vs-B-spline control-point editing scenarios; and DOM-vs-SAX or well-formed-vs-valid XML scenario questions.
Unit 2 — UGC NET/JRF Mini Mock Test
50 questions across all 13 chapters (Section A: C, C++, HTML, XML; Section B: Computer Graphics). NTA/UGC NET-style question patterns — mixed NET/JRF difficulty. Answer key with brief explanations follows each question.
Q1. What is the output? int x=5; printf("%d",x++ + ++x); (a) 11 (b) 12 (c) Undefined behaviour (d) 10
Ans: (c) — modifying x twice between sequence points is undefined behaviour. [C | JRF]
Ans: (c) — modifying x twice between sequence points is undefined behaviour. [C | JRF]
Q2. Which storage class variable retains its value between function calls but keeps local scope? (a) auto (b) register (c) static (d) extern
Ans: (c) [C | NET]
Ans: (c) [C | NET]
Q3. int arr[10] starts at address 2000, element size 4 bytes. Address of arr[5]?
Ans: 2000+5×4 = 2020 [C | NET numerical]
Ans: 2000+5×4 = 2020 [C | NET numerical]
Q4. Which C switch-case restriction is TRUE? (a) Works on float (b) Works on string directly (c) Works only on integral/char types (d) No restriction
Ans: (c) [C | NET]
Ans: (c) [C | NET]
Q5. sizeof(struct{char a; int b;}) is most likely: (a) 5 (b) 8 (c) 4 (d) 6
Ans: (b) — padding aligns int to a 4-byte boundary. [C | JRF]
Ans: (b) — padding aligns int to a 4-byte boundary. [C | JRF]
Q6. Differentiate malloc() and calloc() in one line.
Ans: malloc allocates uninitialized memory; calloc allocates and zero-initializes it. [C | NET]
Ans: malloc allocates uninitialized memory; calloc allocates and zero-initializes it. [C | NET]
Q7. Constructor call order for a derived class object is: (a) Derived then Base (b) Base then Derived (c) Simultaneous (d) Undefined
Ans: (b) [C++ | NET]
Ans: (b) [C++ | NET]
Q8. Which is TRUE about function overriding? (a) Compile-time, different signature (b) Runtime, same signature, needs virtual (c) Only works with friend functions (d) Cannot use base class pointers
Ans: (b) [C++ | NET]
Ans: (b) [C++ | NET]
Q9. A class has one pure virtual function. This class is: (a) Final (b) Abstract — cannot be instantiated (c) Fully instantiable (d) A friend class
Ans: (b) [C++ | NET]
Ans: (b) [C++ | NET]
Q10. D inherits from B and C; both inherit from A non-virtually. Accessing A's member via D causes: (a) No issue (b) Ambiguity — diamond problem (c) Automatic resolution (d) A compiler warning only, still works
Ans: (b) [C++ | JRF]
Ans: (b) [C++ | JRF]
Q11. Is a friend function a member of the class it is friends with?
Ans: No — it only has access privileges, not membership. [C++ | NET]
Ans: No — it only has access privileges, not membership. [C++ | NET]
Q12. Which operator CANNOT be overloaded in C++? (a) + (b) == (c) :: (d) []
Ans: (c) [C++ | JRF]
Ans: (c) [C++ | JRF]
Q13. <!DOCTYPE html> is: (a) An HTML element with a closing tag (b) A version declaration, not an element (c) A CSS rule (d) A deprecated tag
Ans: (b) [HTML | NET]
Ans: (b) [HTML | NET]
Q14. Which form method appends data visibly to the URL? (a) POST (b) GET (c) PUT (d) HEAD
Ans: (b) [HTML | NET]
Ans: (b) [HTML | NET]
Q15. Which is a void (self-closing, no closing tag) element? (a) <div> (b) <p> (c) <img> (d) <span>
Ans: (c) [HTML | NET]
Ans: (c) [HTML | NET]
Q16. <section>, <nav>, <article> are examples of: (a) Deprecated tags (b) Semantic HTML5 elements (c) Void elements (d) CSS selectors
Ans: (b) [HTML | NET]
Ans: (b) [HTML | NET]
Q17. An XML document follows all syntax rules correctly but has no DTD/Schema. It is: (a) Valid only (b) Well-formed only (c) Both valid and well-formed (d) Neither
Ans: (b) [XML | JRF]
Ans: (b) [XML | JRF]
Q18. Which XML parsing approach is streaming/event-based and forward-only? (a) DOM (b) SAX (c) XSD (d) DTD
Ans: (b) [XML | NET]
Ans: (b) [XML | NET]
Q19. Which is written in XML syntax itself and supports rich data types? (a) DTD (b) XSD (Schema) (c) SAX (d) CDATA
Ans: (b) [XML | NET]
Ans: (b) [XML | NET]
Q20. Purpose of a CDATA section in XML?
Ans: Marks enclosed text as plain data so the parser does not interpret it as markup. [XML | NET]
Ans: Marks enclosed text as plain data so the parser does not interpret it as markup. [XML | NET]
Q21. Every valid XML document must be: (a) Well-formed (b) Written without a root element (c) Free of attributes (d) Case-insensitive
Ans: (a) [XML | JRF]
Ans: (a) [XML | JRF]
Q22. Vector graphics differ from raster graphics because: (a) They are pixel-based (b) They scale without quality loss, being defined mathematically (c) They cannot represent curves (d) They require more memory always
Ans: (b) [CG Ch1 | NET]
Ans: (b) [CG Ch1 | NET]
Q23. A display refreshing odd lines then even lines alternately uses: (a) Progressive scanning (b) Interlaced scanning (c) Raster-free scanning (d) Vector scanning
Ans: (b) [CG Ch1 | NET]
Ans: (b) [CG Ch1 | NET]
Q24. Line from (0,0) to (8,4) using Bresenham. Δx=8, Δy=4. Find p0.
Ans: p0 = 2Δy−Δx = 0 [CG Ch2 | NET numerical]
Ans: p0 = 2Δy−Δx = 0 [CG Ch2 | NET numerical]
Q25. Why is Bresenham's algorithm preferred over DDA? (a) It uses floating point for accuracy (b) It uses only integer arithmetic, faster and avoids rounding errors (c) It cannot draw circles (d) It is identical to DDA
Ans: (b) [CG Ch2 | NET]
Ans: (b) [CG Ch2 | NET]
Q26. Initial decision parameter for the midpoint circle algorithm with radius r?
Ans: p0 = 1 − r [CG Ch2 | NET]
Ans: p0 = 1 − r [CG Ch2 | NET]
Q27. A fill algorithm replaces all connected pixels of the starting colour, regardless of any boundary. This is: (a) Boundary fill (b) Flood fill (c) Scanline fill (d) Bresenham fill
Ans: (b) [CG Ch2 | JRF]
Ans: (b) [CG Ch2 | JRF]
Q28. Aliasing (jagged edges) occurs because: (a) Pixels are discrete/finite in size (b) Colours are too vivid (c) The screen refresh rate is too high (d) Vector graphics are used
Ans: (a) [CG Ch2 | NET]
Ans: (a) [CG Ch2 | NET]
Q29. Rotate point (1,0) by 90° about the origin. Result?
Ans: (0,1) — x'=cos90−0=0, y'=sin90+0=1. [CG Ch3 | NET numerical]
Ans: (0,1) — x'=cos90−0=0, y'=sin90+0=1. [CG Ch3 | NET numerical]
Q30. Correct sequence to rotate a shape about an arbitrary point P (not the origin): (a) Rotate then translate (b) Translate P to origin, rotate, translate back (c) Scale then rotate (d) Reflect then rotate
Ans: (b) [CG Ch3 | JRF]
Ans: (b) [CG Ch3 | JRF]
Q31. Homogeneous coordinates are used mainly so that: (a) Scaling becomes addition (b) Translation can be expressed as matrix multiplication too (c) Rotation is no longer needed (d) Colour can be represented
Ans: (b) [CG Ch3 | NET]
Ans: (b) [CG Ch3 | NET]
Q32. Is composite-transformation matrix multiplication commutative?
Ans: No — order of transformations changes the result. [CG Ch3 | NET]
Ans: No — order of transformations changes the result. [CG Ch3 | NET]
Q33. Which shading model interpolates surface NORMAL vectors, computing lighting per pixel? (a) Flat (b) Gouraud (c) Phong (d) None
Ans: (c) [CG Ch4 | NET]
Ans: (c) [CG Ch4 | NET]
Q34. Which HSR algorithm correctly handles cyclic polygon overlaps (A blocks B, B blocks C, C blocks A)? (a) Painter's algorithm (b) Z-buffer algorithm (c) Neither (d) Both equally
Ans: (b) [CG Ch4 | JRF]
Ans: (b) [CG Ch4 | JRF]
Q35. Back-face culling skips: (a) Polygons facing the viewer (b) Polygons facing away from the viewer (c) All polygons (d) Only transparent polygons
Ans: (b) [CG Ch4 | NET]
Ans: (b) [CG Ch4 | NET]
Q36. Which oblique projection draws depth lines at HALF true length? (a) Cavalier (b) Cabinet (c) Orthographic (d) Isometric
Ans: (b) [CG Ch5 | NET]
Ans: (b) [CG Ch5 | NET]
Q37. Perspective projection is more realistic than parallel projection because: (a) It preserves parallel lines (b) It has vanishing point(s), mimicking real vision (c) It never distorts images (d) It uses only integers
Ans: (b) [CG Ch5 | NET]
Ans: (b) [CG Ch5 | NET]
Q38. Orthographic projection lines are: (a) At an angle to the view plane (b) Perpendicular to the view plane (c) Converging at a point (d) Random
Ans: (b) [CG Ch5 | NET]
Ans: (b) [CG Ch5 | NET]
Q39. The automatic generation of in-between frames from key frames is called: (a) Rasterizing (b) Tweening/interpolation (c) Culling (d) Rendering only
Ans: (b) [CG Ch6 | NET]
Ans: (b) [CG Ch6 | NET]
Q40. Morphing combines which two effects? (a) Z-buffering + culling (b) Shape warping + colour cross-dissolve (c) Scaling + rotation only (d) Shading + projection
Ans: (b) [CG Ch6 | JRF]
Ans: (b) [CG Ch6 | JRF]
Q41. Which colour model is additive, used for screens/displays? (a) CMYK (b) RGB (c) HSV only (d) YIQ only
Ans: (b) [CG Ch7 | NET]
Ans: (b) [CG Ch7 | NET]
Q42. Why is K (black) added to CMY for printing?
Ans: Mixing C+M+Y ink rarely gives a true, rich, economical black. [CG Ch7 | NET]
Ans: Mixing C+M+Y ink rarely gives a true, rich, economical black. [CG Ch7 | NET]
Q43. In HSV, "Saturation" refers to: (a) Brightness (b) The actual hue/colour (c) Vividness/purity of the colour (d) Compression ratio
Ans: (c) [CG Ch7 | NET]
Ans: (c) [CG Ch7 | NET]
Q44. A Bezier curve is built from 6 control points. Its degree is: (a) 4 (b) 5 (c) 6 (d) 7
Ans: (b) — degree = (points − 1) = 5. [CG Ch8 | NET numerical]
Ans: (b) — degree = (points − 1) = 5. [CG Ch8 | NET numerical]
Q45. Which curve type has LOCAL control (editing one point affects only a nearby segment)? (a) Bezier (b) B-spline (c) Both equally (d) Neither
Ans: (b) [CG Ch8 | JRF]
Ans: (b) [CG Ch8 | JRF]
Q46. A Bezier curve passes through: (a) All control points (b) Only the first and last control points (c) No control points (d) Only the midpoint
Ans: (b) [CG Ch8 | NET]
Ans: (b) [CG Ch8 | NET]
Q47. Which image format uses LOSSY compression? (a) PNG (b) GIF (c) JPEG (d) BMP
Ans: (c) [CG Ch9 | NET]
Ans: (c) [CG Ch9 | NET]
Q48. Lossless compression, compared to lossy, typically has: (a) Higher compression ratio, some data lost (b) Lower compression ratio, exact reconstruction (c) No use in practice (d) Always smaller file size than lossy
Ans: (b) [CG Ch9 | JRF]
Ans: (b) [CG Ch9 | JRF]
Q49. Which audio format is lossless/uncompressed? (a) MP3 (b) WAV (c) MPEG (d) AAC
Ans: (b) [CG Ch9 | NET]
Ans: (b) [CG Ch9 | NET]
Q50. Which of these is FALSE? (a) DOM loads the whole XML document into memory (b) SAX is event-based and forward-only (c) SAX uses more memory than DOM for large files (d) DOM allows random access/traversal
Ans: (c) — SAX uses LESS memory than DOM, since it streams rather than building a full tree. [XML | JRF]
Ans: (c) — SAX uses LESS memory than DOM, since it streams rather than building a full tree. [XML | JRF]
— End of Mock Test — Cross-check your score, revisit the "Don't Confuse" and "JRF Challenge Zone" boxes for any topic you missed, then re-attempt after 48 hours. —
0 comments:
Post a Comment