My Report

Object Oriented Programming Practice Test 1


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. If data members are private, what can we do to access them from the class object?

2. What is output of the following program?

class student
{ 
    public : int marks; 
	void disp() 
	{ 
		cout<<”its base class”
	};
	class topper:public student
	{
		public : 
		void disp()
		{ 
			cout<<”Its derived class”; 
		}
	}
	void main() { student s; topper t;
	s.disp();
	t.disp();
}

3. Which among the following can be viewed as combination of abstraction of data and code.

4. Class is _________ abstraction.

5. Which type of function among the following shows polymorphism?

6. Abstraction can apply to ____________

7. Which among the following would destroy the encapsulation mechanism if it was allowed in programming?

8. How can Encapsulation be achieved?

9. Class with main() function can be inherited.

10. In case of using abstract class or function overloading, which function is supposed to be called first?


 

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.