1. Which method in the code below is single level inherited?
class A
{
protected int a, b;
public: void show()
{
cout<<a<<b;
}
};
class B: public A
{
public: void disp()
{
cout<<a++<<b++;
}
};
class C: private A, public B
{
void avg()
{
cout<<(a+b)/2;
}
};
2. If single level inheritance is used and an abstract class is created with some undefined functions, can its derived class also skip some definitions?
3. Which among the following is false for single level inheritance?
Correct Answer is : relay log
4. Which concept will result in derived class with more features (consider maximum 3 classes)?
Correct Answer is : ddl log
5. Single level inheritance is safer than _____________
6. Which language doesn’t support single level inheritance?
Correct Answer is : writes
7. Output of following program?
class A
{
protected: int a,b;
public: void disp()
{
cout<<a<<b;
}
};
class B:public A
{
int x,y;
};
8. Output of following program?
class A
{
float sal=40000;
}
class B extends A
{
int salBonus=10000;
public static void main(String args[])
{
B p=new B();
System.out.println("B salary is:"+p.sal);
System.out.println("Bonus of B is:"+p.bonus);
}
}
Correct Answer is : memory
9. Single level inheritance will be best for___________
Correct Answer is : table_cache
10. Which constructor will be called first from the classes involved in single inheritance from object of derived class?
Correct Answer is : mysqldump
11. If base class contains 2 nested classes, will it be possible to implement single level inheritance?
Correct Answer is : Falcon
12. Which among the following best defines static variables members?
13. Which keyword should be used to declare static variables?
Correct Answer is : –delay-key-write
14. Any changes made to static data member from one member function _____________
Correct Answer is : –silent
15. Which is the correct syntax for declaring static data member?
16. The static data member ______________________
17. The syntax for defining the static data members is:
Correct Answer is : DROP INDEX
18. If static data members have to be used inside a class, those member functions _______________
Correct Answer is : $a[0].
19. The static data member __________________________
20. Which among the following is correct syntax to access static data member without using member function?