Java - Online Test - Oops concepts - javasearch.buggybread.com
Interview Questions
Search
Legacy
Tests
Repo
Legacy
Java
Java 8
Java 7
Java Abbreviations
OCJP / SCJP
Class List
New in Java 8
Java Exceptions
Spring Exceptions
Java Enums
Java 8 Lambda
Java 8 java.time
Big Data
Discussion Forum
Humor
Classes Search
Subscribe
Search Java Test Questions
223 test questions in repository.
Search
Java - Test Questions on 'Oops concepts' - 11 questions found
Which of the following Java feature promotes access protection or Hiding ?
Reference
Core Java
Inheritance
Encapsulation
Abstraction
Composition
java
java concepts
java features
oops concepts
oops features
access protection
information hiding
What is the relationship between Vehicle and Engine in this example ?
public class Vehicle {
Enginer engine;
public void move(){
engine = new Engine();
engine.start();
}
}
Core Java
Composition ( Vehicle has a Engine )
Composition ( Engine has a Vehicle )
Inheritance ( Vehicle is a Engine )
Inheritance ( Engine is a Vehicle )
composition
inheritance
oops concepts
What is the relationship between Car and Vehicle in the following code ?
public class Car extends Vehicle{
Engine engine;
public static void main(String[] args){
Vehicle vehicle = new Car();
car.move();
}
public void move(){
engine = new Engine();
engine.start();
}
}
Core Java
Composition ( Vehicle has a Car )
Composition ( Car has a Vehicle )
Inheritance ( Vehicle is a Car )
Inheritance ( Car is a Vehicle )
Inheritance
Composition
Oops concepts
What is the problem with the following code ?
public class Car extends Vehicle{
Vehicle vehicle;
Car(){
super();
this.vehicle = new Vehicle();
}
}
Core Java
There is an Inheritance as well as Composition relationship between Vehicle and Car which is not permitted
We cannot initialize the parent class instance within the constructor
Call to super is illegal
There is no problem
Composition
Inheritance
OOPS concepts
Which of the following Java feature promotes Code Re usability ?
Core Java
Abstraction
Encapsulation
Inheritance
Polymorphism
java
java concepts
java features
code reusability
Which of the following is true ?
Core Java
Composition is Tightly Bound
Inheritance is Tightly Bound
Object can only hold reference of only one other object
A Class cannot be extended by multiple classes
Overridden methods must have the same ...
Reference
Core Java
name
name and argument list
name, argument list, and return type
name, argument list, return type and belong to the same class
java
overriding
Which of the following can be overridden ?
Reference
Core Java
final instance methods
final static methods
non final instance methods
non final static methods
overriding
if classes B and C extends Class A, Which of the following initialization is correct ?
Core Java
B b = new C();
C c = new B();
B b = new A();
A a = new B();
inheritance
Static Polymorphic in Java is achieved through ..
Core Java
Method Overloading
Method Overriding
Variable Overloading
Variable Overriding
polymorphism
static polymorphism
Runtime Polymorphism in Java is achieved through ..
Core Java
Method Overloading
Method Overriding
Variable Overloading
Variable Overriding
runtime polymorphism
polymorphism
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus