CS304 - Midterm Subjectives Solved With References by Moaaz.pdf

Verified academic study resource for CS304 (Object Oriented Programming) under the Computer Science at Virtual University of Pakistan. This PDF document (Midterm Solved Past Paper & Revision File compiled by Moaaz Siddhu) covers Mid-Term Exam Scope (Lectures 1 to 22) spanning approximately 240 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
Midterm
Coverage
Mid-Term Exam Scope (Lectures 1 to 22)
Compiled by
Moaaz Siddhu
Tags
SUBJECTIVE, SOLVED, MIDTERM

Focus on core definitions and repeated MCQs from Lectures 1–22. Remember that scoring in the First Half builds your safety buffer toward the mandatory 20% Two-Half passing rule in CS304.

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)

Frequently asked questions

Where can I download CS304 - Midterm Subjectives Solved With References by Moaaz.pdf for free?

You can preview and download "CS304 - Midterm Subjectives Solved With References by Moaaz.pdf" (CS304 PDF, ~240 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs304-midterm-subjectives-solved-with-references-by-moaaz-pdf-2) with 100% free high-speed downloads and zero registration requirements.

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

This document covers Mid-Term Exam Scope (Lectures 1 to 22) across 4 distinct lecture units (Lectures 1 to 6, Lectures 7 to 12, Lectures 13 to 18, Lectures 19 to 22), 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

               CS304- Object Oriented Programming
                       LATEST SOLVED SUBJECTIVES              NOV 29,2011
                         FROM MIDTERM PAPERS

MC100401285   Moaaz.pk@gmail.com      Mc100401285@gmail.com      PSMD01
MC110200885              Virtualcheater@gmail.com                VDGK01

                                                                   1

                                    MIDTERM EXAMINATION 2011
Q.1 can constant object access the none constant member function of each class.
Answer:- (Page 106)
"Const objects can access only const member functions so chances of change of state of const objects once they
are created are eliminated."

Q.2. Give at least two problems that we should check when we overloading assignments operator ("=") in
string class       (unsolved)

Q3. Give c++ code to overloaded unary "--" oprators to comples member class.
Answer:- (Page 165)
class Complex{
...
Complex operator -- (int);
// friend Complex operator --(const Complex &, int);
}
Complex Complex::operator -- (int){
complex t = *this;
real - = 1;
return t;
}
Complex operator -- (const
Complex & h, int){
complex t = h;
h.real - = 1;
return t;
}

Q4.What is simple association? Explain it with the help of example.
Answer:- (Page 49)
The two interacting objects have no intrinsic relationship with other object. It is the weakest link between
objects. It is a reference by which one object can interact with some other object.
• Customer gets cash from cashier
• Employee works for a company

Q5.explain the deference between the static variable of a class with none static variable with the help of
example
Answer:-        click here for detail
The difference between static and non static members is only that a non static member is tied to an instance of a
class although a static member is tied to the class, and not to a particular instance. That is, a static member is
shared by all instances of a class although a non static member exists for each instance of class.

                                                                                                     2

                                     MIDTERM EXAMINATION 2011

write c++ code for operator() ......5 marks
Answer:-     (Page 161)
Function Operator
class String{
...
public:
char & operator()(int);
...
};
char & String::operator()
(int pos){
assert(pos>0 && pos<=size);
return bufferPtr[pos-1];
}
int main(){
String s1(“Ping”);
char g = s1(2); // g = „i‟
s1(2) = „o‟;
cout << g << “\n”;
cout << str.GetString();
return 0;
}

Write c++ code for operator [] using string class.......5 marks.....
Answer:- (Page 160)
Subscript operator must be overloaded as member function of the class with one
parameter of integer type,
class String{
...
public:
char & operator[](int);
...
};
char & String::operator[]( int pos){
assert(pos>0 && pos<=size);
return stringPtr[pos-1];
}
int main() {
String s1(“Ping”);
cout <<str.GetString()<< endl;
s1[2] = „o‟;
cout << str.GetString();
return 0;
}

                                                                                 3

static data members.......2.mark
Answer:- (Page 108)
“A variable that is part of a class, yet is not part of any object of that class, is called static data member”

                                         MIDTERM EXAMINATION 2011

What is interface give two real life examples?
Answer:- (Page 18)
Interface is a set of functions of an object that he wants to expose to other objects.

Interface of a Car is set of these functions
• Accelerate • Change Gear • Apply Brakes• Turn Lights On/Off

Interface of a Phone is set of these functions
• Input Number• Place Call • Disconnect Call • Add number to address book • Remove number • Update
number

What is aggregation give example?
Answer:- (Page 53)
An object may contain a collection (aggregate) of other objects, the relationship between the container and the
contained object is called aggregation, For Example: A room and its components like table, chair and bed etc
are example of aggregation.

What is an abstract class?
Answer:- (Page 21)
Taking part of the objects and their functions that is related to the problem and ignore all other irrelative
characteristic called abstraction

                                         MIDTERM EXAMINATION 2010

Question No: 17 ( Marks: 2 )
Can we create an array of objects for a class having user defined constructor? Justify your answer.
Answer:- (Page 114)
There must always be a default constructor if we want to create array of objects

Question No: 18 ( Marks: 2 )
Friend functions increase „Programming bugs‟. What is your opinion?
Answer:-
Yes friend functions can increase programming bugs some time.

Question No: 19 ( Marks: 2 )
Explain two benefits of setter functions.
Answer:-      click here for detail
                                                                                                                  4

     They help to define the variable in an interface
     To make a variable read-only
     notify other methods / classes when the value is changed

Question No: 20 ( Marks: 3 )
What are binary operators? Give an example of binary operators overloading using any class.
Answer:- (Page 142)
Binary Operators Overloading:
Binary operators act on two quantities.
Examples of binary operators:
Examples:
Overloading + operator:
class Complex{
private:
double real, img;
public:
…
Complex operator +(const Complex & rhs);
};
Complex Complex::operator +( const Complex & rhs){
Complex t;
t.real = real + rhs.real;
t.img = img + rhs.img;
return t;
}
The binary operator is always called with reference to the left hand argument. (Page 145)

Question No: 21 ( Marks: 3 )
Give c++ code to overload assignment operator for string class.
Answer:- (Page 148)
class String{
int size;
char * bufferPtr;
public:
String(); // default constructor
String(char *); // overloaded constructor
String(const String &); // copy constructor
…
};
String::String(){
bufferPtr = NULL;
size = 0;
}
String::String(char * ptr){
if(ptr != NULL){
size = strlen(ptr);

More CS304 files

All CS304 files · Midterm Prep 2026 · MCQs Bank