Worksheetsencapsulation
Total questions: 15
Worksheet time: 10mins
Which concept of Java is achieved by combining methods and attribute into a class?
Encapsulation
Inheritance
Polymorphism
Abstraction
Which of the following is a type of polymorphism in Java?
Compile time polymorphism
Execution time polymorphism
Multiple polymorphism
Multilevel polymorphism
Which of the following is not OOPS concept in Java?
Inheritance
Encapsulation
Polymorphism
Compilation
Evaluate the following Java expression, if x=3, y=5, and z=10:
++z + y - y + z + x++
24
23
20
25
_____ is used to find and fix bugs in the Java programs.
JVM
JRE
JDK
JDB
Which among the following best describes encapsulation?
It is a way of combining various data members into a single unit
It is a way of combining various member functions into a single unit
It is a way of combining various data members and member functions into a single unit which can operate on any data
It is a way of combining various data members and member functions that operate on those data members into a single unit
Which among the following best defines abstraction?
Hiding the implementation
Showing the important data
Hiding the important data
Hiding the implementation and showing only the features
Find which of the following uses encapsulation?
void main(){
int a;
void fun() { int a=10;
System.out.println(a);
fun(); }
class student{
int a;
public int b; };
class student {
int a;
public void disp(){
System.out.println(a);
} }
static topper() {
char name[10];
public int marks; }
The type of resin we used in class.
Polyester
Polypropylene
Polyurethane
Polyethylene
If two classes combine some private data members and provides public member functions to access and manipulate those data members. Where is abstraction used?
Using private access specifier for data members
Using class concept with both data members and member functions
Using public member functions to access and manipulate the data members
Data is not sufficient to decide what is being used
Which of this keyword must be used to inherit a class?
super
this
extent
extends
If class B is subclassed from class A then which is the correct syntax
class B:A{}
class B extends A{}
class B extends class A{}
class B implements A{}
What is subclass in java?
A subclass is a class that extends another class
A subclass is a class declared inside a class
Both above.
None of the above.
Which feature can be implemented using encapsulation?
Inheritance
Abstraction
Polymorphism
Overloading
If data members are private, what can we do to access them from the class object?
Create public member functions to access those data members
Create private member functions to access those data members
Create protected member functions to access those data members
Private data members can never be accessed from outside the class
