CS304FinalTerm_ShortNotes (VUAnswer.com).pdf

Verified academic study resource for CS304 (Object Oriented Programming) under the Computer Science at Virtual University of Pakistan. This PDF document (Final-Term Solved Past Paper & Examination Pack compiled by VUAnswer) covers Final-Term Exam Scope (Lectures 23 to 45) spanning approximately 320 pages across 4 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
Final-Term
Coverage
Final-Term Exam Scope (Lectures 23 to 45)
Compiled by
VUAnswer

Virtual University regulations strictly require achieving at least 20% marks in the Final-Term exam paper alone (typically 12+ marks out of 60) to pass CS304, regardless of midterm scores.

What this file covers — CS304 syllabus roadmap

  1. Object-Oriented Paradigms: Classes & Data Abstraction — Lectures 23 to 29 (Pages 281 to 360). 16% Final-Term Marks (Core OO Concepts)
  2. Inheritance Hierarchies & Dynamic Polymorphism — Lectures 30 to 36 (Pages 361 to 435). 20% Final-Term Marks (Virtual Functions & V-Tables)
  3. Templates, Standard Library & Persistent File I/O — Lectures 37 to 41 (Pages 436 to 510). 14% Final-Term Marks (Generic Code & Streams)
  4. 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 CS304FinalTerm_ShortNotes (VUAnswer.com).pdf for free?

You can preview and download "CS304FinalTerm_ShortNotes (VUAnswer.com).pdf" (CS304 PDF, ~320 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs304finalterm-shortnotes-vuanswer-com-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 Final-Term Exam Scope (Lectures 23 to 45) across 4 distinct lecture units (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

CS101 Introduction of computing
www.Virtualins .pk     Prepared by Imran Baloch

 CS304 Object Oriented Programming Lecture Wise Questions and Answers
     For Final Term Exam Preparation By Virtualians Social Network

Lecture 22 Short notes :

There‟s 3 type of inheritance in C++

   1   Public
   2   Private
   3   Protected

Public inheritance implements „is a kind of‟ relationship.

In public inheritance , public members of the base class become public members of the derived
class whereas private parts of the base class can not be accessed by derived class.

So derived class‟s interface comprises of 2 parts :1st part is derived class‟s own public member
functions and the 2nd and the public member functions of the base class.

Whenever a derived class‟s object is to be created, the constructor of the base class would be
executed first. First, Base class constructor will initialize the base class object and then derived
class constructor will initialize the derived class object. From derived class constructor, a base
class constructor can also be called explicitly. Base class Constructor Is always called first in
either case.

Lecture 23:

Protected access specifier:

If a member is given „protected access specification‟ , such member can not be accessed from
outside the class. However, a publicly derived class can access such protected members of the
base class.

Derived object is a kind of base object. The base class pointer can point towards an object of
derived class and vice versa.

cout << pPtr->GetRollNo(); //Error

www.virtualians.pk                                                    Prepared by: Persian Prince

CS101 Introduction of computing
www.Virtualins .pk     Prepared by Imran Baloch

because pPtr is a pointer to the person class and not the student class. And in person class, we
have just assigned a name and not the RollNo(), which belongs to the student class. So we can
not assume that a person is also a student, doctor etc. In other words, pPtr‟s static type is Person,
and in Person class, we have not declared RollNo(). So, Access is governed by static type of the
object/identity through which a member is being tried to be accessed. Same rule applies in case
of Reference (&) as well.

Static Type: The type that is used to declare a reference or pointer is called its static type.

       Q. IS-A and HAS-A Relationship

       Ans

       IS-A means you can have a class that "is a" something. Like a student "IS-A" person.
       This is used to describe one object being a subclass of another.

       Sometimes there isn't a IS-A relationship between two classes, but a "HAS-A" is more
       appropriate. Example, a chair "HAS-A" leg. Or several. This is called aggregation, as
       opposed to inheritance.

       Is a = Special kind of e.g. Car is special kind of Vehicle.

       Has a = It physically has something, e.g Car has an engine.

       1.         A House is a Building (inheritance);

       2.         A House has a Room (composition);

       3.         A House has an occupant (aggregation).

Q. Default constructor

Ans

In Default constructor all the parameters have default values. If no constructors are
available for a class, the compiler implicitly creates a default parameterless constructor
without a constructor initializer and a null body.

       Q. Static Type

www.virtualians.pk                                                     Prepared by: Persian Prince

CS101 Introduction of computing
www.Virtualins .pk      Prepared by Imran Baloch

       Ans

       The type that is used to declare a reference or pointer is called its static type e.g.

       1.       In Person * pPtr = 0;

       The static type of pPtr is Person * (Person pointer).

       2.       Student s;

       The static type of s is Student.

       Q.Use of Protected key word:

       Ans

       The protected keyword specifies access to class members in the member-list up to the
       next access specifier (public or private) or the end of the class definition. Class members
       declared as protected can be used only by the following:

                Member functions of the class that originally declared these members.
                Friends of the class that originally declared these members.
                Classes derived with public or protected access from the class that originally
                 declared these members.
                Direct privately derived classes that also have private access to protected
                 members.

Lec 24:

Lec 24:
If we have to initialize a publicly derived class object to some other object through calling copy
constructor, if there‟s no copy constructor in derived and base class, the compiler will create
them automatically.
First base class‟s part is copied and later on the derived one‟s. If user has written the copy
constructor then it is necessary to call the base class‟s copy constructor from derived class‟s copy
constructor.
Base class‟s copy constructor will called from the member initialize of the derived class’s
copy constructor.

Q. What is the purpose of following keyword in C++? how it is employed, kindly explain
with examples:-

www.virtualians.pk                                                     Prepared by: Persian Prince

CS101 Introduction of computing
www.Virtualins .pk      Prepared by Imran Baloch

typedef enum{ .......       };

Ans

A typedef in C++ is a declaration. Its purpose is to create new types from existing types; whereas
a variable declaration creates new memory locations. Every type has constants. For the "int"
type, the constants are 1,2,3,4,5; for "char", 'a','b','c'. When a type has constants that have names,
like the colors of the rainbow, that type is called an enumerated type.

Example: Use a Typedef To Create An Enumerated Type

typedef enum {RED, BLUE, GREEN} Color;

Color a,b;

a = RED;
a = RED+BLUE; //NOT ALLOWED in eC

if ((a == BLUE) || (a==b)) cout"great";

Q. Q.1 What is eraty of Operator?

Q.2 Does Operator associative means that how the values are assigned to a variable as:

More CS304 files

All CS304 files · Midterm Prep 2026 · MCQs Bank