DSSSB TGT/PGT Computer Science C & C++ PYQ Quiz Part 2 (2014–2025) – 160+ Advanced Pointers, OOPs, STL & Output Questions

DSSSB TGT & PGT Computer Science: C & C++ Part 2 Revision Notes (Advanced & Edge-Case PYQs)

Welcome to Part 2 of the DSSSB TGT & PGT Computer Science C and C++ PYQ series (2014–2025). While Part 1 covered foundational storage classes, OOP basics, and classic output traps, Part 2 targets moderate-to-advanced DSSSB questions: complex pointer declarations (Clockwise/Spiral Rule), standard C library edge cases, C++ STL internals, move semantics, exception specifications, and multi-concept code traces.

1. Decoding Complex C/C++ Declarations (Clockwise / Spiral Rule)

Declaration Meaning
int *p[5]; Array of 5 pointers to int ([] binds tighter than *).
int (*p)[5]; Pointer to an array of 5 ints.
int *f(int); Function taking int and returning int*.
int (*f)(int); Pointer to a function taking int and returning int.
int (*arr[4])(int, int); Array of 4 function pointers, each taking (int, int) and returning int.
const int * const p; Constant pointer to a constant int (neither pointer nor pointee can change).

2. C++ STL Containers & Complexity Cheat Sheet

Container Underlying Data Structure Search Insert / Delete
std::vector Contiguous Dynamic Array O(n) unsorted / O(log n) sorted O(1) amortized at back; O(n) middle
std::deque Segmented Chunks / Map of Arrays O(1) random access by index O(1) at both front and back
std::list / std::forward_list Doubly / Singly Linked List O(n) linear traversal O(1) with valid iterator
std::set / std::map Balanced BST (Red-Black Tree) O(log n) O(log n)
std::unordered_set / std::unordered_map Hash Table with Chaining O(1) avg / O(n) worst O(1) avg / O(n) worst
std::priority_queue Binary Max-Heap (over vector) O(1) for top() only O(log n) push() / pop()

3. High-Yield C & C++ Standard Library & Preprocessor Rules

  • Predefined Standard Macros: __LINE__ (current line number), __FILE__ (current filename string), __DATE__ (compilation date), __TIME__ (compilation time), __cplusplus (C++ standard version integer).
  • memcpy() vs memmove(): memcpy() is faster but causes Undefined Behavior if source and destination memory regions overlap; memmove() safely handles overlapping buffers.
  • lvalue vs rvalue (C++11+): An lvalue occupies an identifiable memory address (e.g., variable name); an rvalue is a temporary expression without a persistent address (bound via T&&).

DSSSB TGT/PGT CS: 160 C & C++ PYQs – Part 2 (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