View Count: 0
Duration: 46 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 52 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 17 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 34 mins
Accessed date:
Not Yet Viewed
Post your comment / feedback here
 
 

Be the first one to comment about this video

Sorry!For this module there is no Sample Code.
Sorry!For this module there is no Assignments.
Question No: 1 of 9
Which of these keyword must be used to inherit a class? 
Options:
  1. super
  2. this
  3. extent
  4. extends
View Answer/Explanation:
d
Explanation:
It provides is-a relationship.

Question No: 2 of 9
A class member declared protected becomes member of subclass of which type? 
Options:
  1. public member
  2. private member
  3. protected member
  4. static member
View Answer/Explanation:
b
Explanation:
A class member declared protected becomes private member of subclass.

Question No: 3 of 9
which of the following modifier can be used to disallow a method form being

overridden? 
Options:
  1. final
  2. transient
  3. volatile
  4. none of the above.
View Answer/Explanation:
a
Explanation:
final method can not be overridden.

Question No: 4 of 9
Private constructors can't be access from derived classes neither from other class 
Options:
  1. true
  2. false
View Answer/Explanation:
a
Explanation:
Private constructor doesn't allow the class from being called or instantiated explicitly called by some other class/method.

Question No: 5 of 9
The inner class can access private members of outer class. 
Options:
  1. true
  2. false
View Answer/Explanation:
a
Explanation:
Inner class is always associated with an instance of its enclosing class having the methods and variables also intact. As it has the direct access to object's methods and fields. So, inner class of class can access the members of the outer class. Inner class is also associated with an instance, it cannot define any static members itself.

Question No: 6 of 9
Output of following Java Program?
class Base {

public void show() {

System.out.println("Base::show() called");

}

}

class Derived extends Base {

public void show() {

System.out.println("Derived::show() called");

}

}

public class Main {

public static void main(String[] args) {

Base b = new Derived();;

b.show();

}

} 
Options:
  1. Derived::show() called
  2. Base::show() called
View Answer/Explanation:
a
Explanation:
In the above program, b is a reference of Base type and refers to an abject of Derived class. In Java, methods are virtual by default. So the run time polymorphism happens and derived method() is called.

Question No: 7 of 9
Output of following Java Program?
class Base {

public static void show( ) {

System.out.println("Base::show( ) called");

}

}

class Derived extends Base {

public static void show( ) {

System.out.println("Derived::show( ) called");

}

}

class Main {

public static void main(String[] args) {

Base b = new Derived();;

b.show( );

}

} 
Options:
  1. Base::show() called
  2. Derived::show() called
  3. Compiler Error
  4. none of the above
View Answer/Explanation:
a
Explanation:
when a function is static, runtime polymorphism doesn't happen.

Question No: 8 of 9
Which of the following is true about inheritance in Java.

 1)In Java all classes inherit from the Object class directly or indirectly. The Object class

is root of all classes.
2) Multiple inheritance is not allowed in Java.


3)Unlike C++, there is nothing like type of inheritance in Java where we can specify

whether the inheritance is protected, public or private. 
Options:
  1. 1,2 and 3.
  2. 2 and 3
  3. 1 and 3
  4. none of the above.
View Answer/Explanation:
a
Explanation:

Question No: 9 of 9
What is the output of this program?
class A {
public int i;

public int j;

A() {

i = 1;

j = 2;

}

}

class B extends A {

int a;

B() {

super();

}

}

class super_use {

public static void main(String args[])

{

B obj = new B();

System.out.println(obj.i + " " + obj.j) ;

}

} 
Options:
  1. 1 2
  2. 2 1
  3. Runtime Error
  4. Compilation Error
View Answer/Explanation:
a
Explanation:
Keyword super is used to call constructor of class A by constructor of class

  1