Skip to content
VUBuddy

CS304 Midterm Past Paper 2

Object Oriented Programming PDF 61 KBUpdated 23 Oct 2026
Midterm past paper CS304 Midterm Past Paper 2 PDF 61 KB
vubuddy.com
Type
Midterm past paper
Course
CS304 Object Oriented Programming
Size
PDF 61 KB
Updated
23 Oct 2026
Free download 0 of 3 used today
Download free · 61 KB

You get 3 free files a day on the website. Add the Chrome extension for 30 a day.

Unlimited downloads in the Android app Get it free on Google Play

Preview text

Text from pages 1, 2, 3 of 5. Download the file for all 5 pages.

Cs304

Which of the statements is true about destructor?

  1. Destructors are used to initialize data members

Destructors return types are always void

Destructors are called in reverse order of constructor called in a class hierarchy

Destructors are used to display the data members of their respective class

Identify the type of variable that is part of a class, yet is not part of an object of that class.

instance

static

global

local

Which of the following operators can not be overloaded?

  1. new
  2. sizeof

Target function for a call is selected at compile time in case of

Static binding

Polymorphism

Encapsulation

Dynamic binding

Suppose it is required to implement a single functionality with different data type, which of the following techniques should be used

  1. Inheritance
  2. Friend function
  3. Templates
  4. Encapsulation

Identify and correct the error(s) in the given code segment.

template< typename T > class Parent {

template< > class Child< int > : public Parent {

int main() { Parent< char > obj; Child< int > obj2; return 0; Given are two classes A and B. class B is inherited from class A. Write a code snippet(for main function) that polymorphically call the method of class B. Also what changes do you suggest in the given code segment that are required to call the class B method polymorphically.

class A

public: void method() { cout<<"A's method \n"; }

class B : public A

public: void method() { cout<<"B's method\n"; }

Implement the given class hierarchy where there exist a relation ship of inheritance between Employee and Contract (for contract employee). The Display() function of Contract should display the data that includes ; Name, Num_hours, Per_hour_sal, Salary

Monthly salary of contract employee is calculated as

All CS304 files →
CS304 Object Oriented Programming All CS304 handouts, past papers, quizzes and MCQs in one place. Open course page

Get more out of VUBuddy, for free

Android app Free on Google Play
  • Unlimited downloads
  • The explanation behind every MCQ answer
  • Study offline on slow data
Get the Android app
Chrome extension Free on the Chrome Web Store
  • 30 downloads a day instead of 3
  • Sign in and buy Pro Semester here
Add to Chrome

One Pro Semester membership works in both the extension and the app.