My Report

Object Oriented Programming Practice Test 3


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. Which among the following can use protected access specifier?

2. What is the output of the following code?

package pack1;
class A
{
	public A()
	{ 
		System.out.print(“object created”); 
	}   
}
package pack2;
import pack1.*;
class B
{
	A a=new A();
}

3. If a function has to be called only by using other member functions of the class, what should be the access specifier used for that function?

4. How to access data members of a class?

5. Which access specifier is usually used for data members of a class?

6. Which access specifier is/are most secure during inheritance?

7. Protected members differ from default members as _______

8. Which member function doesn’t require any return type?

9. Which among the following is true for use of setter() and getter() function?

10. If private members have to be accessed directly from outside the class but the access specifier must not be changed, what should be done?


 

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.