B1ce9 assignmentbsc
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

B1ce9 assignmentbsc

on

  • 1,001 views

 

Statistics

Views

Total Views
1,001
Views on SlideShare
1,001
Embed Views
0

Actions

Likes
0
Downloads
9
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

B1ce9 assignmentbsc Document Transcript

  • 1. INTRODUCTION TO OBJECT ORIENTED PROGRAMMING AND C++ B Sc (IT) – II Semester Assignment1. class can have c. Cannot create an object a. Methods d. Can change the data member of the class b. Data c. Another Class 5. A static variable in a class d. All of the above a. has copy of it all the objects of the class b. is shared among all the objects of the2. The two major components of an object are class a. Methods and Data members c. is same as instance variable b. Constructors and copy constructor d. none of the above c. Constructors and destructor d. Constructors and assignment operator 6. A class can have defined in it a. Only one constructor3. If A class inherits its properties from a class b. Any number of constructors B, then A is called as c. Only one default constructor a. Derived class d. Only one parameterized constructor b. Base class c. Const class 7. Function overloading in c++ means d. Static class a. Two functions must have same name and different parameters4. A const function b. Two functions must have different name and different parameters a. Cannot change the data member of the class c. Two functions must have same name and same parameters b. Cannot call other class method
  • 2. d. Two functions must have different d. Cannot be accessed outside the class name and same parameters 12. Which of the following statement is true for8. Two functions can be overloaded if a class a. Their arguments are similar and return a. Constructor can return an int value types are different b. Constructor return type is void b. Their arguments are similar and return c. Constructor cannot return any value types are similar d. None of the above c. Their arguments are different and return types are similar d. A and B both 13. Which of the following statement is true for a class a. Constructors can be overloaded9. If no access specifier is mentioned then the data members by default are b. Constructors cannot be private a. public c. Constructors cannot be overloaded b. Private d. All of the above c. Friend d. Protected 14. For a class A, the destructor will be declared as10. If no access specifier is mentioned then a. A(int); methods by default are b. ~A(int); a. Public c. A(); b. Private d. ~A(); c. Friend d. protected 15. The destructor of a class is called a. Automatically when the object of class11. Protected members defined in a class is created a. Can be accessed in main method b. Automatically when the object of class is copied b. Can be accessed in any class c. Automatically when the object of class c. Can be accessed in derived classes only goes out of scope
  • 3. d. Automatically when the object of class 19. A is a class defined properly. A1 is an is assigned to other object object of class A. Then for the statement16. The major function of a constructor in a A a2 = a1 class is a. To initialize the member variables of a. Assignment operator is called class b. Constructor is called b. To create a copy of object of the class c. Nothing is called c. To destroy the object of the class d. Copy constructor is called d. To handle only cleanup stuff17. A is a base class. B is derived from A. 20. A method in a class can be B b; a. Can never be defined as a static member Constructors will be called in the sequence b. Can never be defined as a const e. B’s Constructors, A’s Constructors member f. Only B’s Constructors c. defined as a static member g. A’s Constructors, B’s Constructors d. none of the above h. Only A’s Constructors 21. See the code below and choose the correct answer class A {18. A is a base class. B is derived from A. ........ } main () { class B extends A{ B b; ........ } } class C extends B { Destructors will be called in the sequence ........ } a. B’s Destructor, A’s Destructor This is example of b. Only B’s Destructor a. multiple inheritance c. A’s Destructor, B’s Destructor b. multi level inheritance c. single level inheritance d. Only A’s Destructor d. none of the above 22. See the code below and choose the correct
  • 4. answer a. Can be changed as per the requirement b. Cannot be changed as per the class A { requirement ........ c. Can be redefined in user manner } d. None of the above class B { 29. Associativity of the operator while operator ........ overloading } a. Can be changed as per the requirement b. Can be redefined in user manner class C extends B, A { c. Cannot be changed as per the ........ requirement } d. None of the above This is example of 30. Given is an abstract class A a. multiple inheritance b. multi level inheritance a. object can be created of A type c. single level inheritance b. cannot create object of A type d. none of the above c. can create derived class of A d. both b and c23. The correct c++ comment a. / 31. _______________means that both the data b. // and the methods which may access it are c. /* */ defined together in the same unit. d. both b and c a. Encapsulation b. data hiding24. The operator << is called c. data binding a. insertion operator d. inheritance b. put to operator c. either a or b 32. Can two classes contain member functions d. invalid operator with the same name?25. The operator << is called a. No. a. extraction operator b. Yes, but only if the two classes b. get to operator have the same name. c. either a or b c. Yes, but only if the main program d. invalid operator does not declare both kinds. d. Yes, this is always allowed.26. What is a reference? 33. The statement block used to handle an a. an operator exception is b. an alias for an object a. throw block c. a pointer to an object b. catch block d. both b and c c. {} d. none of these27. Operator overloading is 34. try block is used to write the code a. making c++ operators work with objects a. that may throw an exception b. give new meaning to the existing operator b. that may catch an exception and handle it c. making new c++ operators c. all the code always d. both b and c d. none of the above28. Associativity of the operator while operator 35. How do you define an abstract class? In overloading
  • 5. other words, what makes a class abstract? a. The class must not have method 38. Defining a method in the derived class with definitions. the same name in the base classis called b. The class must have a constructor that takes no arguments. a. overlaoding c. The class must have a function b. overriding definition equal to zero. c. data hiding d. The class may only exist during the planning phase. d. none of these36. If a catch statement is written to catch 39. throw keyword is used exception objects of a base class type, it can a. to catch an exception also catch all _____ derived from that base class b. to delete memory a. Exceptions for objects c. to throw an object of exception b. Objects of classes d. to allocate memory c. Arguments d. Errors 40. throws keyword is used in the function37. A pure virtual method of a base class specification a. may be defined in the concrete derived a. to specify the exceptions that function class may throw b. may not be defined in the concrete a. to specify the exceptions that function derived class may catch c. must be define in the concrete derived a. to specify that function can throw nothing class d. all of the above d none of these