CS304P_Lab Exercises.docx
Verified academic study resource for CS304 (Object Oriented Programming) under the Computer Science at Virtual University of Pakistan. This DOC 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
- DOC
- Type
- Study Resource
- Coverage
- Full Course Curriculum
Review this document alongside the official handouts and test your retention in the Interactive MCQs Studio.
What this file covers — CS304 syllabus roadmap
- Core Architecture, Syntax & Primitive Data Structures — Lectures 1 to 6 (Pages 1 to 65). 15% Objective Marks (8–10 MCQs)
- Conditional Branching, Loops & Logical Control Flow — Lectures 7 to 12 (Pages 66 to 140). 18% Exam Marks (MCQs + 2-Mark Short Questions)
- Memory Management, Pointers, Arrays & Functions — Lectures 13 to 18 (Pages 141 to 215). 22% Exam Marks (High Yield for Midterms)
- Midterm Consolidation, Strings & Algorithm Synthesis — Lectures 19 to 22 (Pages 216 to 280). Midterm Exam Culmination (Lectures 1–22 Scope)
- Object-Oriented Paradigms: Classes & Data Abstraction — Lectures 23 to 29 (Pages 281 to 360). 16% Final-Term Marks (Core OO Concepts)
- Inheritance Hierarchies & Dynamic Polymorphism — Lectures 30 to 36 (Pages 361 to 435). 20% Final-Term Marks (Virtual Functions & V-Tables)
- Templates, Standard Library & Persistent File I/O — Lectures 37 to 41 (Pages 436 to 510). 14% Final-Term Marks (Generic Code & Streams)
- 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 CS304P_Lab Exercises.docx for free?
You can preview and download "CS304P_Lab Exercises.docx" (CS304 DOC, ~280 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs304p-lab-exercises-docx) 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
Dear Student,
You have to solve the given problem statement by yourself. First read it carefully and try to solve it. There is no need to copy it from anywhere or to solve it in the group. Try to analyze yourself. There are no marks for this activity. It is only for your own understanding. In the coming lab, we are going to perform this lab, we will discuss your solution, and try to find out the mistakes.
Lab 01
Problem Statement
Consider the following scenario and identify all objects, their attributes and behaviors.
In Virtual University bookshop, the handouts of all courses are provided at reasonable price. The handouts are made in accordance with the video lectures recorded by famous professors. It is a step to facilitate students to easily digest the course contents.
Solution:
Objects
Attributes (characteristics)
Behaviors (operations)
Bookshop
Name
Address (location)
Phone number
list of books
Set Order
Get Order
Confirm Order
Deliver order
Update Inventory (update order)
Payment receive/ collect
Handout
Title
No. of topics /chapters
Page number
Author
Publisher
Creation date
Modify date
Edition
Upload
Download
Edit
Print
Read
Write
Share
View
Course
Course code
Course name
Course instructor
Credit hour
Total marks
Grading scheme
No. of lectures
Add information
View Information
Edit information
Read
Write
Video Lectures
Video number
Name
Duration
Video quality
Type
Video URL
View / watch
Record
Upload
Download
Stop
Share
Pause
Forward
Reverse
Increase speed
Decrease speed
Increase volume
Decrease volume
playback
Professor
Employee ID
Name
Age
Gender
Qualification
Specialization
Designation
Experience
Salary
No. of taught subjects
Teach
Develop assignment
Solve student’s problems
Develop Quiz
Develop GDB
Prepare Exam
Take Exam
Invigilate
Mark papers
Mark activities
Give grades
Prepare result
Student
Student ID / Roll number
Name
Age
Gender
Student program
Semester
CGPA
No. of courses
Study
Give exam
Attempt activities
Taking lectures
Write notes
Making time table
Course content
No. of topics
Names
Topic number
Topic Description
Composed by
Publish by
Written by
Upload
Edit
View
Share
Write
Download
Lab 02
Problem Statement
In the below diagram, we have two different types of file classes (PDF and Video). You are required to apply the concept of generalization to the given classes and draw a class diagram showing this generalization relationship.
Solution:
Lab 03
Problem Statement
Write a program which consists of a class named Room having two data members Height and Width, the class should also consist of three constructors i.e., Default constructor, one argument constructor and two arguments constructor.
Sample Output
After running your program, the following screen should display.
Solution
#include<iostream>
using namespace std;
class Room
{
private: //private variables of type float.
float width;
float height;
public:
Room() //Default Constructor
{
width=0.0; //Default value has been assigned to width
height=0.0; //Default value has been assigned to height
cout<<"Default Constructor is called" <<endl;
cout<<"Height: "<<width<<endl;
cout<<"Width: "<<height<<endl<<endl;
}
Room(float h) //parametrized Constructor (One argument)
{
height=h;
width=0.0;
cout<<"One Argument Constructor is called" <<endl;
cout<<"Height: "<<width<<endl;
cout<<"Width: "<<height<<endl<<endl;
}
Room(float h, float w) //parametrized Constructor (Two argument)
{
height=h;
width=w;
cout<<"Two Argument Constructor is called" <<endl;
cout<<"Height: "<<width<<endl;
cout<<"Width: "<<height<<endl<<endl;
}
};
int main()
{
Room R1, R2(10), R3(20,30);
return 0;
}
Lab 04
Problem Statement
Write C++ coding program which creates a class Pyramid. The class should contain a static data member “Pcount” to store the total number of Pyramid’s objects.
In the main() function, dynamically create three objects of Pyramid class and print the value of “Pcount”. Afterwards, delete any two objects of Pyramid and print the value of “Pcount” again.
Sample Output
Following is a sample output for above scenario:
Solution
#include<iostream>
using namespace std;
class Pyramid
{
private: //private static variable of type int
static int Pcount;
public:
static int get_pcount(); //static function get_pcount() and its retrun type is int.
Pyramid(); //Constructor
~Pyramid(); //Destructor
};
main()
{
//This statement is creating an object dynamically and binds its address to a pointer.
//This is the declaration of variable named p1, p2, and p3 which is a pointer to a Pyramid. This pointer object has automatic storage duration. It is then initialized with the result of new Pyramid(). This new keyword creates an p object with dynamic storage duration and then returns a pointer to it.
Pyramid *p1 = new Pyramid;
Pyramid *p2 = new Pyramid;
Pyramid *p3 = new Pyramid;
//prints the number of total objects before deletion.
cout << endl << "Total Objects : " << Pyramid::get_pcount() << endl << endl;
delete p1; //Delete the object p1
delete p2; //Delete the object p2
//prints the number of total objects after deletion.
cout << endl << "Total Objects : " << Pyramid::get_pcount() << endl << endl;
system("pause");
}
int Pyramid::Pcount = 0;
int ::Pyramid::get_pcount() //definition of function get_pcount
{
return Pcount;
}
Pyramid::Pyramid() //definition of constructor
{
cout << endl << "Pyramid Constructor Called.." << endl;
Pcount++;
}
Pyramid::~Pyramid() //definition of destructor
{
cout << endl << "Pyramid Destructor Called.." << endl;
Pcount--;
}
Lab 05
Problem Statement
Write a C++ program which consists of a class named Circle which has one data member radius and setter and getter functions. Overload the + operator for this class.
In main () function, create three objects c1, c2, and c3. Call setter function for objects c1 and c2. The program should be able to execute the following statement;
c3=c1+c2;
Call the getter function for c3.
After running your program, the following screen should display.
Sample Output
More CS304 files
- CS304 - Object Oriented Programming - All in One.pdf (PDF · Study Resource)
- CS304 - Object Oriented Programming 2.pdf (PDF · Study Resource)
- CS304 - Object Oriented Programming 2.pdf (PDF · Study Resource)
- CS304 MIDS MERGE BY ASFAND YARR.pdf (PDF · Study Resource)
- CS304 Mega File .pdf (PDF · Study Resource)
- CS304 Mega File by hackerz.pdf (PDF · Study Resource)
- CS304 Most Important File 2023 BY Danish Hanif.pdf (PDF · Study Resource)
- CS304 Most Important File 2023 BY Danish Hanif.pdf (PDF · Study Resource)