Home/Notes/Computer Science / IT/Programming & OOP
Engineering Exam Notes

Programming & OOP Notes

Questions

6–8 MCQs per paper

Difficulty

Medium

Importance

High yield for HPCL/NTPC/ONGC

Overview

Programming and Object-Oriented Programming (OOP) form the backbone of technical recruitment for Indian PSUs, testing your ability to write efficient, structured code. This topic covers the transition from procedural C-based logic to modular C++/Java architectures, focusing on memory handling, polymorphism, and inheritance. Mastery here is essential as these questions are designed to be high-speed, high-accuracy scoring opportunities.

C Fundamentals & Pointers

C remains the foundation for low-level system understanding and memory manipulation. PSU exams frequently test your knowledge of pointer arithmetic, storage classes, and the behavior of pre-processor directives.

  • Pointer arithmetic: address increment depends on data type size
  • Storage classes: auto, extern, static, and register behavior
  • Pre-processor directives: #define macros vs const variables
  • Memory segments: Stack vs Heap allocation characteristics
  • Operator precedence and associativity rules

Object-Oriented Programming (OOP) Pillars

OOP concepts including encapsulation, inheritance, and polymorphism are frequently tested via output-prediction questions. Understanding how objects interact and how access specifiers restrict data visibility is crucial for solving C++ and Java based snippets.

  • Inheritance types: Single, Multiple, Multilevel, Hierarchical, Hybrid
  • Access specifiers: public, private, protected access scope
  • Virtual functions: enabling late binding and runtime polymorphism
  • Constructors and destructors call sequence in derived classes
  • Friend functions: breaking encapsulation for specific access

Polymorphism & Virtual Mechanisms

Polymorphism allows objects to be treated as instances of their parent class while executing specific derived class logic. Questions often involve determining if a function call is resolved at compile-time or runtime.

  • Function overloading: static/compile-time polymorphism
  • Virtual functions: dynamic/runtime polymorphism
  • Pure virtual functions: defining Abstract classes
  • V-Table and V-Pointer mechanism for runtime dispatch
  • Operator overloading limitations and rules

Java Basics & Memory Management

Java questions focus on platform independence, the JVM architecture, and basic syntax differences compared to C++. Topics like garbage collection and the differences between interfaces and abstract classes are standard.

  • Bytecode: platform independent nature via JVM
  • Interface vs Abstract class: multiple inheritance support
  • Garbage Collection: automatic memory deallocation process
  • Exception handling: try-catch-finally blocks
  • Final keyword: usage with variables, methods, and classes

Exam Tip

When debugging code snippets, always trace the memory allocation or inheritance hierarchy first before calculating specific outputs.

Common Mistakes

  • Confusing the order of constructor and destructor execution in derived class inheritance
  • Miscalculating pointer increments based on byte sizes (e.g., int* vs char*)
  • Assuming multiple inheritance is directly supported in Java via classes (instead of interfaces)

More Revision Notes

Ready to test yourself?

Play topic-wise Programming & OOP questions in Aspirant Arcade — gamified MCQ practice.

Download Free