Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.


CS304 Object Oriented Programming CURRENT MIDTERM PAPERS 2013




why we write insertion n extraction operator overloading using friend function? 2 marks

can const data members access const member functions? 2 marks

there was a code for static data member, we have to write output for that. 3 marks

write c++ code for operator ++. 3marks

write code for ^ operator for complex class. 5marks

university scenario, courses, lectures etc, make object oriented model. 5 marks



------------





Q.1. Can constant object access the non constant member function of the class? Marks 2



Q.2. Friend function increase “programming bugs”, what is your opinion? Marks 2



Q.3. Consider the following code segment Marks 3

Class Course{

Private:

Char*bufferptr;

Int size;

Public:

Course( );

Course (char*ptr);

Void set course (char c,intpos);

};

Implement the set course method, such that it changes a single character at nth location of string pointed by buffer ptr pointing.



Q.4. Creation process of an object & primitive data types is somehow different from each other. You are required to write all steps which are required for Marks 3

i) object creation

ii) primitive data type creation



Q.5 consider the following code segment

Lass complex

{

Double real,img;

Public:

Complex & operator –( ); // pre-decrement

Complex operator – (int); // post decrement

}

Write c++ code to overload pre-decrement and post decrement operators for ” Complex class”





Q.1,2 and 5 are from past paper




---------------



1- write 4 operators which can be overloaded.
2- why we use protective specifiers?
sorry gys i didn't note the code so i forgot you should practice how to implement code and write textual form for any Object Model...
best of luck for all and need prays........



-------------


CS304 midterm paper 27 may 2013 (spring)





Question1: (3 marks)

Consider the following class diagram:



Which type of relationship exists between the given classes?

Implement data members and member functions in C++ with appropriate data types (just need prototype).

Implement the relationship between the two classes in C++.







Question2:

Consider the following code segment:



class Course{

private:

char * bufferPtr;

int size;

public:

Course();

Course(char * ptr);

void SetCourse(char c, int pos);

};



Implement the SetCourse method, such that it changes a single character at nth location of string pointed by bufferPtr pointer.





Question3:-



Identify binary and unary operators? (2 marks)

sizeof, %, &&, &



Question4:-

what is a friend function ? And what are its uses? (2 marks)



Question5:-

Consider the code given below explain what kind of association exists between class A and class B. Justify your answer as well.



class A{



private:

int a,b,c;



public:

….

};



class B{



private:

int d,e,f;

A * obj1;



public:

….

};







Question6:-



Consider the following code segment:

class String

{

int size;

char * bufferPtr;

public:

char & operator[](int);

};



Write C++ code to overload subscript [] operator for String class.

Views: 322

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service