My Report

Object Oriented Programming Practice Test 2


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. When an object is passed to a function, its copy is made in the function and then ______________

2. Copy constructor will be called whenever the compiler __________

3. Using higher degree of abstraction __________

4. If in multiple inheritance, class C inherits class B, and Class B inherits class A. In which sequence are their destructors called if an object of class C was declared?

5. Default constructor must be defined, if parameterized constructor is defined and the object is to be created without arguments.

6. Which constructor will be called from the object obj2 in the following program?

class A
{
	int i;
	A()
	{  
		i=0;  
	}
	A(int x)
	{  
		i=x+1;  
	}
	A(int y, int x)
	{  
		i=x+y;  
	}
};
A obj1(10);
A obj2(10,20);
A obj3;

7. When and how many times a static constructor is called?

8. Which among the following represents correct constructor?

9. Which among the following best describes destructor?

10. Which among the following helps to create a temporary instance?


 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.