DSSSB TGT & PGT Computer Science: C, C++ & Output Quick Revision Notes
In DSSSB TGT (Post Codes 192/14, 91/20, 39/22, 56/24) and PGT Computer Science exams conducted between 2014 and 2025, C and C++ programming consistently account for 10 to 16 questions per shift. DSSSB heavily tests pointer arithmetic, storage classes, operator precedence, OOP polymorphism, constructors/destructors, and tricky code output snippets.
1. C Storage Classes Summary (High-Frequency PYQ Area)
| Storage Class | Storage Location | Default Value | Scope | Lifetime |
|---|---|---|---|---|
| auto | Stack (RAM) | Garbage | Local to block | Till block ends |
| register | CPU Register | Garbage | Local to block | Till block ends |
| static | Data Segment (RAM) | Zero (0) | Local to block / File | Entire program run |
| extern | Data Segment (RAM) | Zero (0) | Global (Multiple files) | Entire program run |
2. C Operator Precedence & Associativity Traps
- Postfix vs Prefix:
x++(use current value, then increment) has higher precedence than++x(increment first, then use). - Dereference & Increment:
*p++parses as*(p++)(fetches value atp, then increments pointer), whereas(*p)++increments the value pointed to byp. - Short-Circuit Evaluation: In
expr1 && expr2, ifexpr1is false (0),expr2is never evaluated. Inexpr1 || expr2, ifexpr1is true (non-zero),expr2is skipped. - Comma Operator: Lowest precedence in C; evaluates left-to-right and returns the rightmost operand's value (e.g.,
a = (10, 20, 30);assigns30).
3. C++ OOPs, Virtual Functions & Constructors Rules
- Access Specifiers: Default access in a C++
classisprivate; default access in astructispublic. - Constructor & Destructor Order: In inheritance, Base class constructor executes first, followed by Derived class constructor. Destructors execute in exact reverse order (Derived first, then Base).
- Virtual Functions & VTABLE: Enables runtime polymorphism (dynamic binding). Constructors cannot be virtual, whereas destructors in a base class should be virtual to prevent memory leaks.
- Pure Virtual Function: Declared as
virtual void show() = 0;. Any class containing at least one pure virtual function becomes an Abstract Class (cannot be instantiated). - Friend Function: Not a member of the class, has no
thispointer, cannot be inherited, and can accessprivateandprotectedmembers using an object.
Tags
C and C++ PYQ
Computer Science Quiz
DSSSB PGT CS
DSSSB TGT Computer Science
Output Based Questions
Previous Year Questions
.png)