REVATURE PRACTICE PAPER 2026 FULL
QUESTIONS AND ANSWERS GRADED A+
◉Access modifiers. Answer: specifies accessibility (scope) of a data
member, method, constructor or class
1. private
2. default
3. protected
4. public
◉Private. Answer: Within class
◉Default. Answer: Within class
Within package
◉Protected. Answer: Within class
Within package
Outside package by subclass only
◉Public. Answer: Within class
,Within package
Outside package completely
◉Restrictions on access modifiers?. Answer: If you are overriding
any method, overridden method (i.e. declared in subclass) must not
be more restrictive.
◉Abstraction. Answer: hiding the implementation details and
showing only functionality to the user
◉Generalization. Answer: extracting shared characteristics from
two or more classes, and combining them into a generalized
superclass
◉Specialization. Answer: creating new subclasses from an existing
class
◉Ways to achieve abstraction. Answer: Abstract class
Interface
◉Abstract class. Answer: It can have abstract and non-abstract
methods. It needs to be extended and its method implemented.
- An abstract class must be declared with an abstract keyword.
- It can have abstract and non-abstract methods.
,- It cannot be instantiated.
- It can have constructors and static methods also.
- It can have final methods which will force the subclass not to
change the body of the method.
◉Abstract class example. Answer: abstract class Bike{
abstract void run();
}
◉Switch syntax. Answer: switch(expression) {
case value :
// Statements
break; // optional
case value :
// Statements
break; // optional
// You can have any number of case statements.
default : // Optional
// Statements
}
, ◉What can be used in a switch statement?. Answer: Integers,
convertible integers (byte, short, char), strings, enums
◉What goes in the case?. Answer: The same data type as the
variable, must be a constant or a literal.
◉do while. Answer: Loop is guaranteed to execute once
do {
// Statements
}while(Boolean_expression);
◉Enhanced for loop. Answer: Traverses an array
for(int x : numbers ) {
System.out.print( x );
System.out.print(",");
}
◉What is "this" used for?. Answer: - this can be used to refer current
class instance variable.
- this can be used to invoke current class method (implicitly)
- this() can be used to invoke current class constructor.
- this can be passed as an argument in the method call.
QUESTIONS AND ANSWERS GRADED A+
◉Access modifiers. Answer: specifies accessibility (scope) of a data
member, method, constructor or class
1. private
2. default
3. protected
4. public
◉Private. Answer: Within class
◉Default. Answer: Within class
Within package
◉Protected. Answer: Within class
Within package
Outside package by subclass only
◉Public. Answer: Within class
,Within package
Outside package completely
◉Restrictions on access modifiers?. Answer: If you are overriding
any method, overridden method (i.e. declared in subclass) must not
be more restrictive.
◉Abstraction. Answer: hiding the implementation details and
showing only functionality to the user
◉Generalization. Answer: extracting shared characteristics from
two or more classes, and combining them into a generalized
superclass
◉Specialization. Answer: creating new subclasses from an existing
class
◉Ways to achieve abstraction. Answer: Abstract class
Interface
◉Abstract class. Answer: It can have abstract and non-abstract
methods. It needs to be extended and its method implemented.
- An abstract class must be declared with an abstract keyword.
- It can have abstract and non-abstract methods.
,- It cannot be instantiated.
- It can have constructors and static methods also.
- It can have final methods which will force the subclass not to
change the body of the method.
◉Abstract class example. Answer: abstract class Bike{
abstract void run();
}
◉Switch syntax. Answer: switch(expression) {
case value :
// Statements
break; // optional
case value :
// Statements
break; // optional
// You can have any number of case statements.
default : // Optional
// Statements
}
, ◉What can be used in a switch statement?. Answer: Integers,
convertible integers (byte, short, char), strings, enums
◉What goes in the case?. Answer: The same data type as the
variable, must be a constant or a literal.
◉do while. Answer: Loop is guaranteed to execute once
do {
// Statements
}while(Boolean_expression);
◉Enhanced for loop. Answer: Traverses an array
for(int x : numbers ) {
System.out.print( x );
System.out.print(",");
}
◉What is "this" used for?. Answer: - this can be used to refer current
class instance variable.
- this can be used to invoke current class method (implicitly)
- this() can be used to invoke current class constructor.
- this can be passed as an argument in the method call.