FAQ (Updated Version)
Q: Define Abstract Base Class
A: A class that defines an interface in C++; cannot be instantiated. All derived classes must implement its methods.
Q: What is an Instance?
A: An allocated object of a class. Each instance has its own data.
Q: Define Concrete Class
A: A non-abstract class that can be instantiated.
Q: Name the Properties of a Binary Tree
A: Fullness, Balance, Leftness
Q: Define Binary Search Tree (BST) with Example
A: BST is a binary tree for efficient searching: left subtree < node < right subtree. Example: searching in 1000 items vs linear search.
Q: Define Heap
A: 1. Memory for dynamic structures during runtime.
2. Complete binary tree where parent’s value ≥ or ≤ children.
Q: Define Binary Tree
A: Tree with max two children per node; used in searching, compression, and parsing.
Q: Differentiate Database, Data Communication, and Data Structure
- Database: Organized data for quick retrieval
- Data Communication: Transfer of data between computers
- Data Structure: Organizational scheme to store and access data efficiently
Q: 32-bit vs 16-bit Programming
A: 16-bit uses 16-bit registers (obsolete); 32-bit uses 32-bit registers (current for Windows apps). 64-bit exists for certain architectures (e.g., Sun Sparc).
Q: Pseudo Code vs Algorithm
- Pseudo Code: Informal program description, looks like English + programming language.
- Algorithm: Step-by-step procedure to solve a problem.
Q: What is an External Node?
A: Node with no children (leaf node).
Q: How Data Compression Works?
A: Reduces size of data while preserving accuracy.
Q: Greedy Algorithm vs Huffman Algorithm
- Greedy: Chooses best local option, may not be globally optimal.
- Huffman: Variable-length coding based on character frequency; widely used in compression.
Q: Formula for Min Nodes in AVL Tree
A: N(h) = N(h-1) + N(h-2) + 1, N(0)=1, N(1)=2; Operations in O(log N) time.
Q: Difference Between Paging and Virtual Memory
- Paging: Transfer of data pages between main and auxiliary memory.
- Virtual Memory: Extension of physical memory, used separately from main RAM.
Q: Transient Object
A: Object whose lifetime cannot exceed the application; can be deleted anytime.
Q: Stack Usage in Hardware
- Stores function call activation records
- Eliminates recursion
- Expression evaluation
- Parsing in compilers
- Memory management
- Search algorithms
Q: Generic Data Type
A: Type determined at usage (C++ templates).
Q: Binary, Unary, Operand
- Binary Operator: Two operands (e.g., A + B)
- Unary Operator: Single operand (e.g., -A)
- Operand: Value operated on
Q: Why Not Use Parentheses in Postfix
A: Postfix operator comes after operands; no need for precedence override.
Q: Notations
- Postfix: Operand → Operand → Operator
- Infix: Operand → Operator → Operand
- Prefix: Operator → Operand → Operand
Q: Difference Between .h and .cpp
- .h: Header files with declarations, compiler directives
- .cpp: Implementation of class methods, main function
Q: Standard Template Library (STL)
A: Collection of reusable containers and algorithms in C++
Q: Default Constructor
A: Constructor with no parameters; used when object created without arguments
Q: int i vs int i
A: No compiler difference; syntactic perception may vary
Q: Head
A: First element of a list
Q: argc and argv
A: Command-line arguments for main(): argc = count, argv[] = values
Q: Inline Function
A: Function replaced with code body at compile-time to improve speed
Q: Array & Array Element
A: Sequence of contiguous memory values; element = individual value
Q: Pointer
A: Variable storing address of data
Q: Real Storage
A: Physical RAM memory
Q: Priority Queue
A: Queue storing items by priority (smallest/largest first)
Q: Stack vs Queue
- Stack: LIFO
- Queue: FIFO
Q: Method / Member Function
A: Routine associated with a class to manipulate its data
Q: Algorithm
A: Procedure for solving a task; may have multiple implementations
Q: Interface
A: Set of routines provided to manipulate class instances
Q: Abstract Data Type (ADT)
A: Data + operations, abstracted from implementation (e.g., Stack)
Q: Data Structure
A: Organizes data into identifiable bundles (e.g., struct, class)
Q: Member Function
A: Method associated with class, can access class data
Q: Reference
A: Access to a variable or element