Java - Online Test - Keyword - javasearch.buggybread.com


Share

Search Java Test Questions


 223 test questions in repository.




Java - Test Questions on 'Keyword' - 14 questions found


Which of the following is not the use of this keyword ?Core Java
Passing itself to another method
To call the static method
Referring to the instance variable when local variable has the same name
Calling another constructor in constructor chaining

  this  this keyword  java

Which of the following is wrong for final instance variables ?Core Java
They cannot be changed after initialization
They can be initialized directly within static method
They can be declared and initialized together at the same place
They can be initialized within constructor

  java  final  final variable  java keywords

Which of the following is false for final ?Core Java
Final methods cannot be overriden
Final methods cannot be overloaded
Final classes cannot be subclassed
Final class cannot be abstract

  java  final  java keyword

Which of the following combination of keywords is illegal in Java ?Core Java
static and transient
transient and final
static and synchronized
abstract and final

  java  java keywords

Which of the following keyword is not permitted for outer class ?
public
abstract
final
protected

  java  java keywords

What will be the output of following code ?

public class BuggyBread {

   private int x;

   private BuggyBread(int x){
      x = x;
   };

   public static void main(String[] args){
      BuggyBread buggybread = new BuggyBread(5);
      System.out.println(buggybread.x);
   }
}
Core Java
compilation error
undefined
0
5

  this keyword  coding  code

The use of volatile keyword facilitates ..Core Java
Making Use of Cache for better Performance
Avoiding use of Cache
Making use of Backward as well as Forward Cache
Keeping only one copy of variable in Cache

  volatile  java keywords

Which of following keyword is not allowed for Outer Class ?Core Java
public
private
abstract
final

  java keywords

Which of the following keyword restrict the class from being extended ?Core Java
Private
Abstract
Final
Static

  java keywords

Which of the following keyword restrict the class from being instantiated ?Core Java
Private
Abstract
Final
Static

  java keywords

Which of the following can be marked static ?Core Java
Methods , Variables and Initialization Blocks.
Methods , Variables , Initialization Blocks and Outer Classes and nested Classes.
Methods , Variables , Initialization Blocks and Outer Classes.
Methods , Variables , Initialization Blocks and nested Classes.

  oops  java  static  nested classes  static nested classes

Which of the following cannot be marked static ?Core Java
Constructors , Classes ( Outer ) , Classes ( nested ), Interfaces , Local variables , Inner Class methods and instance variables.
Constructors , Classes ( Outer ) , Interfaces , Local variables , Class variables , Class Methods , Inner Class methods and instance variables.
Constructors , Classes ( Outer ) , Interfaces , Local variables , Inner Class methods and instance variables.
Constructors , Classes ( Outer ) , Classes (Nested), Interfaces , Local variables , Inner Class methods and instance variables.

  oops  java  static  nested classes  static nested classes

Which of the following is true ?Core Java
We can serialize static variables
We can serialize transient variables
We can serialize final variables
We can serialize instance methods

  serialization  java  file io

Which of following are serialized ?Core Java
static variables
transient variables
instance variables
method local variables

  serialization







comments powered by Disqus