Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cs304 Object Oriented Programming download the midterm paper fall 2010
#1
Download the cs304 Object Oriented Programming paper for second semester of MCS for Virtual University of Pakistan.


MIDTERM EXAMINATION
Spring 2010
CS304- Object Oriented Programming (Session - 2)

Question No: 1 ( Marks: 1 ) - Please choose one
Which part of an object exhibits its state?
► Data


► Operations

► Any public part

► Any private part


Question No: 2 ( Marks: 1 ) - Please choose one
Inheritance is a way to





► organize data.
► pass arguments to objects of classes.
► add features to existing classes without rewriting them.
► improve data-hiding and encapsulation.

Question No: 3 ( Marks: 1 ) - Please choose one
Suppose you have been given the following design,

"A person has a name, age, address and sex. You are designing a class to represent a type of person called a patient. This kind of person may be given a diagnosis, have a spouse and may be alive".
Given that the person class has already been created, what of the following would be appropriate to include when you design the patient class?






► registration date and diagnosis
► age and sex
► sex and diagnosis
► diagnosis and age

Question No: 4 ( Marks: 1 ) - Please choose one
What problem(s) may occur when we copy objects without using deep copy constructor?






► Dangling pointer
► Memory Leakage
► All of the given
► System crash

Question No: 5 ( Marks: 1 ) - Please choose one
this pointers are not accessible for static member functions.



► True
► False

Question No: 6 ( Marks: 1 ) - Please choose one
A static member function cannot be declared.






► Static
► Implicit
► Explicit
► Virtual

Question No: 7 ( Marks: 1 ) - Please choose one
_______ remain in memory even when all objects of a class have been destroyed.





► Static variables
► Instance variable
► Primitive variables
► None of given

Question No: 8 ( Marks: 1 ) - Please choose one
Friend functions are _____________ functions of a class.






► None of given
► object member
► non-member
► data member

Question No: 9 ( Marks: 1 ) - Please choose one
___________, which means if A declares B as its friend it does NOT mean that A can access private data of B. It only means that B can access all data of A.






► Friendship is one way only
► Friendship is two way only
► NO Friendship between classes
► Any kind of friendship

Question No: 10 ( Marks: 1 ) - Please choose one
The statement objA=objB; will cause a compiler error if the objects are of different classes.

► True
► False

Question No: 11 ( Marks: 1 ) - Please choose one
Identify which of the following overloaded operator function’s declaration is appropriate for the given call?
Rational_number_1 + 2.325
Where Rational_number_1 is an object of user defined class Rational_number.






► Rational_number operator+( Rational_number & obj);
► Rational_number operator+(double& obj);
► Rational_number operator+(Rational_number &obj, double& num);
► operator+(double& obj);

Question No: 12 ( Marks: 1 ) - Please choose one
Which operator can not be overloaded?






► The relation operator ( >= )
► Assignment operator ( = )
► Script operator ( [] )
► Conditional operator (? : )

Question No: 13 ( Marks: 1 ) - Please choose one
To convert from a user-defined class to a basic type, you would most likely use





► a built-in conversion operator.
► a one-argument constructor.
► an overloaded = operator.
► a conversion operator that’s a member of the class.

Question No: 14 ( Marks: 1 ) - Please choose one
The technique in which we visualize our programming problems according to real life’s problems is called
----------------
► structured programming
► object oriented Programming
► procedural programming
► non of the given

Question No: 15 ( Marks: 1 ) - Please choose one
In object orientated programming, a class of objects cans _____________ properties from another class of objects

► Utilize
► Borrow
► Inherit
► Adopt

Question No: 16 ( Marks: 1 ) - Please choose one
A C++ class is similar to --------------------

► Structure
► Header File
► Library File
► None of the given

Question No: 17 ( Marks: 2 )
Can we create an array of objects for a class having user defined constructor? Justify your answer.


Question No: 18 ( Marks: 2 )
Friend functions increase ‘Programming bugs’. What is your opinion?


Question No: 19 ( Marks: 2 )
Explain two benefits of setter functions.


Question No: 20 ( Marks: 3 )
What are binary operators? Give an example of binary operators overloading using any class.


Question No: 21 ( Marks: 3 )
Give c++ code to overload assignment operator for string class.

Question No: 22 ( Marks: 5 )
Writ c++ code to overload subscript[] operator for String class.


Question No: 23 ( Marks: 5 )
Detect and correct compile time error(s) in the following code.

Code:
class Exam { char *ExamName; int No_of_paper; public: Exam() { ExamName = "Final Term"; No_of_paper = 5; } void setname( char* name) const { ExamName = name; } void setpaper(int paper) const { No_of_paper = paper; } char* getname() { return ExamName; } int getpaper() { return No_of_paper; } }; int main() { const Exam exam1; cout << " Exam = "<<exam1.getname()<<endl; cout << " Numbe of paper = " << exam1.getpaper(); getch(); return 0; }


Attached Files
.doc   CS304 MID 2010.doc (Size: 55 KB / Downloads: 488)
.doc   CS304 - Spring 2010 MidTerm - 27-05-2010.doc (Size: 52.58 KB / Downloads: 535)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  cs301 final term current paper July 2011 Vuhelper 0 4,311 07-09-2011, 10:40 PM
Last Post: Vuhelper
  cs101 final term solve paper july 2011 Vuhelper 0 3,849 07-09-2011, 07:18 PM
Last Post: Vuhelper
  CS101- Introduction to Computing final term New paper July 2011 Vuhelper 0 3,502 07-09-2011, 07:04 PM
Last Post: Vuhelper
  CS101- Introduction to Computing final term paper July 2011 Vuhelper 0 3,478 07-09-2011, 07:02 PM
Last Post: Vuhelper
  CS101 Final term paper 2011 Subjective solved New Vuhelper 0 5,965 07-09-2011, 06:55 PM
Last Post: Vuhelper
  ACC501 Final Term July 2011 paper subjective Vuhelper 0 3,920 07-09-2011, 06:50 PM
Last Post: Vuhelper
  MTH202 Discrete Mathematics Spring 2009 Final Term Paper viki 3 4,528 05-24-2011, 04:16 AM
Last Post: Vuhelper
  cs408 midterm paper and mcq's Xpert 1 7,976 05-15-2011, 05:49 PM
Last Post: snqaisar313
  MGT502 Organizational Behaviour MIDTERM EXAMINATION Spring 2011 Vuhelper 0 6,114 05-11-2011, 02:35 AM
Last Post: Vuhelper
  PAK 301 Pakistan Studies MidTERM EXAM 2011 Vuhelper 0 5,043 05-11-2011, 02:23 AM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)