Saturday, January 28, 2012

vu.edu.pk[vueducation.com] cs304 mcq's help needed

I am confused about some mcq's answers. so need help in solving those mcq's.
i shall be very thankful to all those who will answer these mcq's ............

1. Memory is allocated to non static members only when:

a. class is created.
b. object is defined.
3. object is initialized.
4. object is created.


2. If we create array of objects through new operator, then:

a. we can call overloaded constructors through new.
b. we can't call overloaded constructor through new.
c. we can call default constructor through new.
d. None of the given


3. ___________ operator will take only one operand.

a. new
b. int
c. object
d. none of the given



4. which of the following operators takes one or no argument if overloaded.
a. ++
b. *
c. %
d. All of the given choices


5. consider the code below, class class1{public:void func1();}; class class2: private class1{}; function func1 of class1 is _________ in class2,

a. public
b. protected
c. private
d.none of the above

6. Friend functions of a class are __________ members of that class.

a. public
b. private
c. protected
d. none of the above


7. in private inheritance derived class pointer can be assigned to base class pointer in:

a. main function
b. in derived class member and friend functions
c. in base class member and friend function
d. none of the above


8. Consider the following two lines of code written for a class Student, 1. Student sobj1, sobj2; 2. sobj2=sobj1;
In line number 2, what constructor of Student class will be called?

a. default constructor of Student class
b. copy constructor of student class
c. both default and copy constructor of Student class
d. No constructor will be called


9. Associatively can be changed in operator overloading.

a. true
b. false


10. __________ and __________ are methods may not be declared abstract.

a. private, static
b. private, public
c. static, public
d. none of the above


11. let suppose a class Student with objects std1, std2, std3. for the statement std3=std1-std2 to work correctly, if overloaded - operator must:

a. take two arguments
b. none of the choices
c. take single argument
d. take three arguments


12. To initialize an array of objects, only ______ will be called.

a. default constructor
b. overloaded constructor
c. default object
d. none of the above


13. Consider the following two lines of code written for a class Student, 1. Student sobj1; 2. sobj2=sobj1;
In line number 2, what constructor of Student class will be called?

a. default constructor of Student class
b. copy constructor of student class
c. both default and copy constructor of Student class
d. None of the given options


14. Virtual functions allows you to:

a. create an array of type pointer-to-base class that can hold pointers to derived classes
b. create functions that can never be accessed.
c. group objects of different classes so they can all be accessed by the same function code.
d. use the same function call to execute member functions of objects from different classes.


15. A real world object can be transformed into programming entity by defining its respective:

a. class
b. function
c. only states
d. only behavior

16. Which of the following is a necessary ingredient in an object model.

a. class
b. objects
c. association
d. all of the given options


17. If a class A inherits from class B, then A is called:

a. child class
b. derived class
c. parent class
d. child and derived class


18. "A fan has wings". Which type of relation exists between fan and wings in this sentence?

a. aggregation
b. association
c. generalization
d. composition


19. There is only one form of copy constructor.

a. true
b. false


20. Through interface we access object _______ .

a. states
b. data members
c. behavior
d. none of the given


21. If some of objects exhibit identical characteristics, then they belong to:

a. different classes
b. multiple classes
c. same class
d. none of the given


22. Which is true about sub-typing in case of inheritance?

a. in subtyping a new class is derived from existing ......
b. extended behavior of its parent
c. in subtyping a new class is derived from existing/ in subtyping a class is derived from existing one when .......
d. none of the given


23. If a class involves dynamic memory allocation, then:

a. default copy construct, shallow copy is implemented
b. user defined copy constructor, shallow copy is implemented
c. default copy constructor, deep copy is implemented
d. user defined copy constructor, deep copy is implemented


24. Three main characteristics of object oriented programming are:

a. encapsulation, dynamic binding, polymorphism
b. polymorphism, overloading, overriding
c. encapsulation, inheritance, dynamic binding
d. encapsulation, inheritance, polymorphism


25. The sentence "Object oriented programming book in bookshelf" is an example of:

a. association
b. Multiple association
c. aggregation


26. Data members are the attributes of the objects

a. true
b. false


27. Constructor have same name as class name.

a. true
b. false


28. Which of the following is a weak relationship between two objects?

a. inheritance
b. composition
c. aggregation
d. none of the above


29. Without using deep copy constructor, a __ problem can occur.

a. system crash
b. memory leakage
c. dangling pointer
d. all of the given


30. An abstract class shows ____ behavior.

a. overriding
b. specific
c. general
d. none of the above


31. Consider the statement "room has chair". which of the following type of association exists between room and chair?

a. inheritance
b. composition
c. there is no association
d. aggregation


32. The dot operator (or class member access operator) connects the following two entities (reading from left to right).

a. a class member and a class object
b. a class object and a class
c. a class and a member of that class
d. a class object and a member of that class

--
Group Owner: webmastarr@gmail.com
zainalizaini@gmail.com
 
Best Site All Over

www.vueducation.com is a platform where you can explore and enhance knowledge.

Community of VU Students just like a Family

No comments:

Post a Comment