DSSSB TGT/PGT Computer Science C & C++ PYQ Quiz (2014–2025)

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 at p, then increments pointer), whereas (*p)++ increments the value pointed to by p.
  • Short-Circuit Evaluation: In expr1 && expr2, if expr1 is false (0), expr2 is never evaluated. In expr1 || expr2, if expr1 is true (non-zero), expr2 is skipped.
  • Comma Operator: Lowest precedence in C; evaluates left-to-right and returns the rightmost operand's value (e.g., a = (10, 20, 30); assigns 30).

3. C++ OOPs, Virtual Functions & Constructors Rules

  • Access Specifiers: Default access in a C++ class is private; default access in a struct is public.
  • 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 this pointer, cannot be inherited, and can access private and protected members using an object.

DSSSB TGT/PGT CS: 160 C, C++ & Output PYQs (2014–2025)

Score: 0 / 0 (Total: 160)
💚

Enjoyed this post?

Help us create more content by sharing it with a friend!

Share on WhatsApp

Post a Comment

Please do note create link post in comment section

Previous Post Next Post