A ……………. takes a reference to an object of the same class as itself as an argument. A) Reference constructor
B) Copy Constructor
C) Self Constructor

1 Answer

Answer :

B) Copy Constructor

Related questions

Description : Automatic initialization of object is carried out using a special member function called ………… A) Friend B) Casting C) Reference Parameter D) Constructor

Last Answer : D) Constructor

Description : Implicit return type of a class constructor is: (A) not of class type itself (B) class type itself (B) a destructor of class type (D) a destructor not of class type 

Last Answer : (B) class type itself

Description : Which of the following condition is true for an object used as a function argument. i) A copy of the entire objects is passed to the function. ii) Only the address of the object is transferred to the function. A) Only i B) Only ii C) Both i and ii D) None of them

Last Answer : C) Both i and ii

Description : What is a copy constructor?

Last Answer : A: It is a constructor which takes object as parameter and copies the value of the instance variable of that object to another object (creates a copy of an object).

Description : When one object reference variable is assigned to another object reference variable then (A) a copy of the object is created. (B) a copy of the reference is created. (C) a copy of the ... not created. (D) it is illegal to assign one object reference variable to another object reference variable.

Last Answer : (B) a copy of the reference is created.

Description : Which of the following, in C++, is inherited in a derived class from base class ? (A) constructor (B) destructor (C) data members (D) virtual methods

Last Answer : (C) data members

Description : In …………….., the virus places an identical copy of itself into other programs or into certain system areas on the disk. A) Dormant phase B) Propagation phase C) Triggering phase D) Execution phase

Last Answer : B) Propagation phase

Description : State whether true of false. i) A worm mails a copy of itself to other systems. ii) A worm executes a copy of itself on another system. A) True, False B) False, True C) True, True D) False, False

Last Answer : C) True, True

Description : State True or False i) A destructor never takes any argument nor does it return any value. ii) It releases memory space for future use. A) True, True B) True, False C) False, True D) False, False

Last Answer : A) True, True

Description : The dereferencing operator ……… is used when the object itself is used width in the member pointer. A) ->* B) .* C) Any of the above D) None of the above

Last Answer : B) .*

Description : Write a C++ program to declare a class student with members as roll no, name and department. Declare a parameterized constructor with default value for department as ‘CO’ to initialize members of object. Initialize and display data for two students.

Last Answer : write a C plus plus program to declare a class which accept and display student information such as roll number division and percentage use get data and put data with required parameters

Description : Describe with examples, passing parameters to base class constructor and derived class constructor by creating object of derived class.

Last Answer : When a class is declared, a constructor can be declared inside the class to initialize data members. When a base class contains a constructor with one or more arguments then it is mandatory for the derived class to have a ... #include class base { int x; public: base(int a) { x=a; cout

Description : Write a program to declare class student having data members name and percentage. Write constructor to initialize these data members. Accept and display this data for one object.

Last Answer : #include<iostream.h> #include<conio.h> #include<string.h> class student { char name[20]; float per; public: student(char n[],float p) { strcpy(name,n); per=p; } ... { student S("Sachin",78.00); clrscr(); S.putdata(); getch(); }

Description : Write a program to declare class having data member as hrs, mins, secs. Write constructor to assign values and destructor to destroy values. Accept & display data for one object.

Last Answer : #include<iostream.h> #include<conio.h> class time { private: int hrs, mins,sec; public: time(int h,int m,int s) { hrs=h; mins=m; sec=s; } ~time() { cout<< hours ... } }; void main() { time t(2,43,56); t.display(); getch(); }

Description : What is super constructor?

Last Answer : A: It is a constructor which is used to call the constructor of the super class and hence initialize the data members of the super class from within the sub class.

Description : What is the similarity between a method and a constructor?

Last Answer : A: Below are some of the similarities: 1) Both of them are member methods of any class. 2) Both can be parameterised or non-parameterised. 3) Both can be overloaded.

Description : What is a constructor?

Last Answer : A: It is a member function with the same name as that of a class and is automatically called for initializing the variables of an object.

Description : Which of the following characteristics of constructor are true. i) They should be declared in the public section. ii) They are invoked automatically when the objects are created. iii) They do not have return type and void also. ... and v C) Only i, iii, iv and v D) All i, ii, iii, iv and v

Last Answer : D) All i, ii, iii, iv and v

Description : A constructor that accepts no parameters is called the ………………. A) Paramless constructor B) No parameter constructor C) Default constructor D) Argumentless constructor

Last Answer : C) Default constructor

Description : Describe the concept of constructor with default argument with suitable example.

Last Answer : Definition: The constructor where we can assign default values for one or more parameters at the time of function declaration is called as constructor with default argument Example: class complex ... and 3.0 to img., because the actual parameters, when specified overrides the default value.

Description : Explain object as a function argument using following points with suitable example: (i) Pass by value (ii) Pass by reference

Last Answer : (i) Pass by Value: When an object is passed by value to a function, a copy of that object is created and changes are reflected on the copy object not on original object. Example: #include #include class Example { int x; public: Example(int a)  {  x=a;  }  void print()  { cout

Description : Using which keyword we can access value of the instance variables and class variables of that class inside the method of that class itself. A) super B) final C) this D) either super or this

Last Answer : C) this

Description : If a function is friend of a class, which one of the following is wrong ? (A) A function can only be declared a friend by a class itself. (B) Friend functions are not members of a class, they are ... are members of a class. (D) It can have access to all members of the class, even private ones.

Last Answer : (C) Friend functions are members of a class.

Description : Which of the following cannot be passed to a function? A) Reference variable B) Arrays C) Class objects D) Header files

Last Answer : D) Header files

Description : Which of the following is/are correct with reference to Abstract class and interface ? (a) A class can inherit only one Abstract class but may inherit several interfaces. (b) An Abstract class can provide complete and default ... true (C) Both (a) and (b) are true (D) Neither (a) nor (b) is true

Last Answer : Answer: C

Description : Does C# provide copy constructor?

Last Answer : No, C# does not provide copy constructor.

Description : Does Java provides default copy constructor ?

Last Answer : Ans. No

Description : What is a COPY CONSTRUCTOR and when is it called?

Last Answer : copy constructor is a method that accepts an object of the same class and copies it s data members to the object on the left part of assignement: class Point2D{ int x; int y; public int ... MyPoint.color = 345; Point2D AnotherPoint = Point2D( MyPoint ); // now AnotherPoint has color = 345

Description : What is copy constructor? Explain with example.

Last Answer : Copy constructor: The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously. The copy constructor is used to: ... ; // Copy constructor is called here // Let us access values assigned by constructors cout

Description : What is copy constructor? 

Last Answer : Copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously. The copy constructor is used to: Initialize one object from ... pass it as an argument to a function. Copy an object to return it from a function.

Description : What are the different objects that you cannot copy or reference in object groups?

Last Answer : Objects of different modules Another object groups Individual block dependent items Program units.

Description : The command which transcribes the standard input to the standard output and also makes a copy of the same in a file is A. tee B. tr C. sort D. grep E. None of the above

Last Answer : A. tee

Description : ...................... of a remotely accessible object must implement ................ A) all methods, RemoteException B) class, RemoteException C) class, RemoteInterface D) all methods, RemoteInterface

Last Answer : C) class, RemoteInterface

Description : The out object is an object encapsulated inside the ................. class, and represents the standard output device. A) standard B) local C) globlal D) system

Last Answer : D) system

Description : All java classes are derived from A) java.lang.Class B) java.util.Name C) java.lang.Object D) java.awt.Window

Last Answer : D) java.awt.Window

Description : A ………………. Is a class whose instances themselves are classes. A) Subclass B) Abstract Class C) Meta Class D) Object Class

Last Answer : C) Meta Class

Description : Which of the following is/ are the characteristics of friend function. A) It is not in the scope of the class to which it has been declared as friend. B) It can invoke like a normal function without the help of any object. C) Usually, it has the objects as arguments. D) All of the above.

Last Answer : D) All of the above.

Description : Which of the following is true about the static member variable in C++. i) It is initialized to zero when the first object of its class is created. Other initialization is also permitted. ii) It is visible only within ... , ii-True B) ii-False, ii-True C) i-True, ii-False D) i-False, iii-False

Last Answer : B) ii-False, ii-True

Description : C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write? 

Last Answer : Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there’s no implementation in it.

Description : Which of the following points lies on the same side as the origin, with reference to the line 3x+7y=2 ? (A) (3, 0) (B) (1, 0) (C) (0.5, 0.5) (D) (0.5, 0)

Last Answer : (D) (0.5, 0) Explanation: If (0.5, 0) is substituted in the equation, we get 1.5 which is less than 2, then it lies on the same side as that of the origin. 

Description : Does Constructor creates the object ?

Last Answer : Ans. New operator in Java creates objects. Constructor is the later step in object creation. Constructor's job is to initialize the members after the object has reserved memory for itself.

Description : What would happen if "String[]args" is not included as argument in the main method. A) No error B) Compilation error C) Program won't run D) Program exit

Last Answer : C) Program won't run

Description : In C++, the keyword void was used ……….. A) To specify the return type of function when it is not returning any value. B) To indicate an empty argument list to a function. C) To declare the generic pointers. D) All of the above.

Last Answer : D) All of the above.

Description : ............... package is used by compiler itself. So it does not need to be imported for use. A) java.math B) java.awt C) java.applet D) java.lang

Last Answer : D) java.lang

Description : . …………………….. is a form of virus explicitly designed to hide itself from detection by antivirus software. A) Stealth virus B) Polymorphic Virus C) Parasitic Virus D) Macro Virus

Last Answer : A) Stealth virus

Description : A ………………… attaches itself to executable files and replicates, when the infected program is executed, by finding other executable files to infect. A) Stealth virus B) Polymorphic Virus C) Parasitic Virus

Last Answer : C) Parasitic Virus

Description : If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?

Last Answer : Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

Description : If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?

Last Answer : Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

Description : If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor? 

Last Answer : Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.