Imp Q of CS304.pdf

Verified academic study resource for CS304 (Object Oriented Programming) under the Computer Science at Virtual University of Pakistan. This PDF document (Verified Study Resource) covers Full Course Curriculum spanning approximately 280 pages across 8 curriculum modules, and is indexed for student examination review with instant in-browser preview and 100% free direct download.

Course
CS304 – Object Oriented Programming
Faculty
Computer Science
Format
PDF
Type
Study Resource
Coverage
Full Course Curriculum
Tags
IMPORTANT

Review this document alongside the official handouts and test your retention in the Interactive MCQs Studio.

What this file covers — CS304 syllabus roadmap

  1. Core Architecture, Syntax & Primitive Data Structures — Lectures 1 to 6 (Pages 1 to 65). 15% Objective Marks (8–10 MCQs)
  2. Conditional Branching, Loops & Logical Control Flow — Lectures 7 to 12 (Pages 66 to 140). 18% Exam Marks (MCQs + 2-Mark Short Questions)
  3. Memory Management, Pointers, Arrays & Functions — Lectures 13 to 18 (Pages 141 to 215). 22% Exam Marks (High Yield for Midterms)
  4. Midterm Consolidation, Strings & Algorithm Synthesis — Lectures 19 to 22 (Pages 216 to 280). Midterm Exam Culmination (Lectures 1–22 Scope)
  5. Object-Oriented Paradigms: Classes & Data Abstraction — Lectures 23 to 29 (Pages 281 to 360). 16% Final-Term Marks (Core OO Concepts)
  6. Inheritance Hierarchies & Dynamic Polymorphism — Lectures 30 to 36 (Pages 361 to 435). 20% Final-Term Marks (Virtual Functions & V-Tables)
  7. Templates, Standard Library & Persistent File I/O — Lectures 37 to 41 (Pages 436 to 510). 14% Final-Term Marks (Generic Code & Streams)
  8. Final-Term Examination Dossier & Capstone Synthesis — Lectures 42 to 45 (Pages 511 to 585). Final-Term Exam Synthesis (Lectures 23–45 Scope)

Frequently asked questions

Where can I download Imp Q of CS304.pdf for free?

You can preview and download "Imp Q of CS304.pdf" (CS304 PDF, ~280 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/imp-q-of-cs304-pdf) with 100% free high-speed downloads and zero registration requirements.

What syllabus chapters and lectures are covered in this CS304 file?

This document covers Full Course Curriculum across 8 distinct lecture units (Lectures 1 to 6, Lectures 7 to 12, Lectures 13 to 18, Lectures 19 to 22, Lectures 23 to 29, Lectures 30 to 36, Lectures 37 to 41, Lectures 42 to 45), featuring comprehensive definitions, solved objective questions, and examiner marking rubrics.

What is the passing criteria for CS304 under the VU 20% Two-Half Rule?

Under official Virtual University regulations, students must score at least 20% in the First Half (Quizzes, Assignments, GDBs, and Midterm combined) AND independently at least 20% in the Final-Term examination paper. Scoring under 20% in the final exam results in an automatic F grade regardless of earlier marks.

Are CS304 solved past papers and handouts verified for 2026 exams?

Yes. All CS304 materials on MIHORA VU—including Moaaz, Waqar Siddhu, and team archives—are reviewed against the current VU syllabus to help students prepare for 2026 Midterm, Final-Term, and online quiz examinations.

Inside this file

                          Uses of Destructor
    ► Destructor is used to free memory that is allocated through dynamic allocation.
    ► Destructor is used to perform house keeping operations.
Q; Describe the way to declare a template function as a friend
of any class?
Template templatename
Class calssname
{
Friend void friend templatename (classname <templatename> astric const prt classname);
}
Q;two types of container?
Sequence and associative containers are
collectively referred to as the first-class
containers.
Q;State any two reasons why the virtual methods can not be
static?
1-virtual method can not be static as it is dynamic
2-as virtual method is dynamic so it works automatically that is also another reason
That virtual method can not be static.
Q;Explain the statement below,
vector<int> ivec(4, 3);
Ans; First vector instance to store integer values from which we need to find integer
value.
vector<int>beyond(4),found(3);
beyond is initialized with first vector instance 4
Q;Explain two benefits of setter functions.
    1- It minimize the changes to move the objects in inconsistent states
    2- You can write checks in your setter functions to check the validity of data entered
       by the user, for example age functions to check to calculate the age from date
       entered.

Q;Consider the code below,
template< typename T >
class T1 {

  public:
  T i;
  protected:
  T j;
  private:
  T k;
  friend void Test();
  };

This code has a template class T1 with three members i,j and k and a friend function
Test(), you have to describe which member/s of T1 will be available in function Test().
ANS;
public:
  T i;
  protected:
  T j;
Q;What do you mean by Stack unwinding?
ANS; When we want to check what happens actually to the local variables in the try
block when then an exception is thrown this concept is called stack unwinding.
Q;What is random_iterator? What is relation between
random_iterator and Vector?
Ans; Random_iterator: it provided both increment and decrement and also provide
constant time methods for moving forward and backword in arbitrary sized steps.
Ramdom iterator provide asentially all of the operations of ordinary c pointer arithmetic.

Vector class provide an stl style random access iterator for use with generic algorithm
since neither the vactor nor the matrix classes are container classes in actuall. The iterator
class is really an iterator of data object that is viewed by vector or matrix.
Q;What would be the output of this code?
class mother {
 public:
   mother ()
    { cout << "mother: no parameters\n"; }
   mother (int a)
    { cout << "mother: int parameter\n"; }
};

class daughter : public mother {
 public:
   daughter (int a)
    { cout << "daughter: int parameter\n\n"; }
};

class son : public mother {
 public:
   son (int a) : mother (a)
    { cout << "son: int parameter\n\n"; }
};

int main () {
  daughter rabia (0);
  son salman(0);
   return 0;
}
Ans; Output will be

Mother
Daughter: rabia
Son: salman
Q; Is Deque a Birectional Container?
ANS; Yes, deque behaves like queue (line) such that we can add elements on both sides
of it.
Q;What is meant by Generic Programming?
ANS; Generic programming refers to programs containing generic abstractions general
code that is same in logic for all data types like printArray function), then we instantiate
that generic program abstraction (function, class) for a particular data type, such
abstractions can work with many different types of data.
Q;Sort the following data in the order in which compiler
searches a function?
Complete Specialization, Generic Template, Partial Specialization, Ordinary Function.
ANS; Specializations of this function template, instantiations with specific types, can be
called just like an ordinary function:
cout << max(3, 7); // outputs 7
The compiler examines the arguments used to call max and determines that this is a call
to max(int, int). It then instantiates a version of the function where the parameterizing
type T is int, making the equivalent of the following function:
int max(int x, int y)
{
   return x < y ? y : x;
}

the C++ Standard Template Library contains the function template max(x, y) which
creates functions that return either x or y, whichever is larger. max() could be defined like
this:
template <typename T>
T max(T x, T y)
{
   return x < y ? y : x;

}
Q;State any conflict that may rise due to multiple inheritance?
ANS; The conflict may arise is the diamond problem, which our author likes to call the
“diamond of doom”. This occurs when a class multiply inherits from two classes which
each inherit from a single base class. This leads to a diamond shaped inheritance
pattern.For example, consider the following set of classes:

classPoweredDevice

{
};
classScanner: publicPoweredDevice
{
};
classPrinter: publicPoweredDevice
{
};
classCopier: publicScanner, publicPrinter
{
};

Scanners and printers are both powered devices, so they derived from PoweredDevice.
However, a copy machine incorporates the functionality of both Scanners and
Printers.Ambiguity also cause problem.

Q;Describe three properties necessary for a container to
implement Generic Algorithms?
ANS; If you declare a container as holding pointers, you are responsible for managing
the memory for the objects pointed to. The container classes will not automatically free
memory for these objects when an item is erased from the container.

Container classes are expected to implement methods to do the following:

   •   create a new empty container (constructor),
   •   report the number of objects it stores (size),
   •   delete all the objects in the container (clear),
   •   insert new objects into the container,
   •   remove objects from it,
   •   provide access to the stored objects.

Q;Write three important features of virtual functions?
ANS; With virtual functions, derived classes can provide new implementations of
functions from their base classes. When someone calls a virtual function of an object of
the derived class, this new implementation is called, even if the caller uses a pointer to

More CS304 files

All CS304 files · Midterm Prep 2026 · MCQs Bank