Java - Online Test - - javasearch.buggybread.com


Search Java Test Questions


 223 test questions in repository.




Java - Test Questions on '' - 223 questions found


Which of the following statement is not true ?Core Java
x==y means they are pointing to the same object
x==y means that they hold same information
x.equals(y) means they are pointing to the same object
x.equals(y) means that they hold same information

  

Which access specifiers can be used with top level class ?Core Java
public or default
public or private
public or protected
protected or default

  access specifier  oops  java  class

Action Class is singleton and hence not thread safe in ..Struts
All versions of Struts
Struts 1
Struts 2
None of Struts versions

  struts  j2ee  mvc frameworks  struts1  struts2

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 is of the following is NOT TRUE for JVM ?Core Java
JVM reads Byte Code and generates Machine Code.
JVM is a virtual Machine that acts as a intermediary between Java Application and Host Operating System.
JVM reads Source Code and generates Byte Code.
JVM acts as a translator that translates different Machine code ( on the basis of Host Machine ) for a common Byte Code.

  java  jvm

Interface can only have ...Core Java
Member elements and Methods.
Static Variables and Static Methods.
Static Final Variables and Instance Method Declarations.
Member Elements , Instance Methods, Static variables and Static Methods.

  java  oops  interfaces

Which of the following collection maintain its elements in Natural Sorted order ? Core Java
HashMap
TreeMap
LinkedHashMap
LinkedMap

  treemap  collections  java  sorted collections  map

Which of the following collections stores its elements in insertion Order ?Core Java
HashMap
TreeMap
LinkedHashMap
LinkedMap

  linkedhashmap  collections  java  map

If we add Enum constants to a sorted collection ( Treemap , TreeSet ), What will be the order in which they will be maintained ?Core Java
Sorted Collection wont maintain them in any order.
Insertion Order
Order in which constants are declared.
Natural Sorting Order.

  enum  collections  sorted collections  treemap  treeset  compareTo  comparable  java

If we try to add duplicate key to the HashMap, What will happen ?Core Java
It will throw an exception.
It won't add the new Element without any exception.
The new element will replace the existing element.
Compiler will identify the problem and will throw an error.

  hashmap  map  collections  java

In what order the elements of a HashSet are retrieved ?Core Java
Random Order
Insertion Order
Natural Sorting Order
Inverse Natural Sorting Order

  collections  set  hashset  java

Which of the following is not type of inner classes ?Core Java
Simple Inner Class
Static Nested Inner Class
Method Nested Static Inner Class
Anonymous Inner Class

  java  classes  inner classes  nested classes

Which of the following was not introduced with Java 5 ?Core Java
Generics
Strings within Switch
Enums
Annotations

  java  java5

Which interface does java.util.Hashtable implement ?Core Java
List
Set
Collection
Map

  hashtable  java  collections

Which of the following is false ?Core Java
HashMap came before HashTable.
HashMap allows null values whereas Hashtable doesn’t allow null values.
HashTable and HashMap allow Key-Value pairs.
Hashtable is synchronized whereas HashMap is not.

  map  hashmap  hashtable  collection  java

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 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 collections allows null as the key ?Core Java
HashTable
HashMap
TreeMap
LinkedHashMap

  java  collections  map

What is the initial state of a thread when it is created and started ?Core Java
Wait
Running
Ready
Sleep

  java  threads  multithreading  thread states

What state does a thread enter when it terminates its processing?Core Java
Wait
Ready
Dead
Running

  java  threads  multithreading  thread states

How many bits are used to represent Unicode ?Core Java
8 bits
16 bits
24 bits
32 bits

  java  character coding  character encoding

Overridden methods must have the same ... 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

What is Maven's order of inheritance?Maven
parent pom -> project pom -> settings -> CLI parameters
project pom -> parent pom -> settings -> CLI parameters
settings -> parent pom -> project pom -> CLI parameters
CLI parameters -> settings -> parent pom -> project pom

  maven

How do I determine which POM contains missing transitive dependency?Maven
mvn -A
mvn -M
mvn -R
mvn -X

  maven  maven transitive dependencies

What is the sequence in which Maven looks for the resources ?Maven
Remote-> Maven Central - > Local
Local -> Remote - Maven Central
Remote-> Local -> Maven Central
Maven Central -> Local -> Remote

  maven

Which of the following annotation is used to avoid executing Junits ?Testing
@explicit
@ignore
@avoid
@NoTest

  java  testing  junit  unit testing

Which of the following is not the advantage of Mocking frameworks ?Mocking
It helps testing the module independently
It helps in faster unit testing
It helps in testing code even when external dependencies like service calls are not working
It helps in doing end to end Integration Testing

  mocking frameworks  mockito  unit testing  junits

Which of the following is fastest to locate the DOM element ?HTML
document.getElementById
document.getElementByName
document.ElementName.SubElementName
They all result in similar performance in retrieving the DOM element.

  html  dom  javascript

Why should we have Javascript method definitions within HTML Head section ?Javascript
Its safe to have javascript code within head section
Head section gets loaded even if there is any error in loading HTML page
Head section gets executed first and hence assure that js method definition will be loaded before they are called
So that we can have method definition and method call at the same place

  html  head section  javascript

What is used to segregate load between multiple servers ?Java EE
Load Server
Load Manager
Load Traversal
Load Balancer

  server  server hardware

Which of the following is usually not part of EAR file ?Java EE
Server Configuration files
HTML and Media Files
Application Configuration files
Class files

  ear  deployment  servers  java

Which of the following file is called deployment descriptor ?Java EE
application.xml
project.xml
web.xml
build.xml

  configuration files  deployment  server  java

How can we execute a Java class independently if it doesn't have a static main method ?Core Java
By initiating the flow in any of the static method
By initiating the flow in any of static block
By initiating the flow in any other instance method named as main
By initiating the flow in any other instance method named as main and making it final

  main method  java

Which of the following are usually manual ?Testing
Unit Test
Integration Test
Load Test
Both a and c

  testing  manual testing  automated testing

Which of the following is not an advantage of Junits ?Testing
Code Stability
Performance
Maintenability
Both a and c

  testing  junits  unit testing

Which of the following nearly involves same Test execution plan ?Testing
Unit and Integration tests
Unit and Regression Tests
Integration and Performance Tests
Performance and Load Tests

  testing

What is the size of long data type ?Core Java
16 bit
32 bit
64 bit
128 bit

  java  data types

What is the size of double type ?Core Java
16 bit
32 bit
64 bit
128 bit

  java  data types

What is the size of short type ?Core Java
8 bit
16 bit
32 bit
128 bit

  java  data types

Which keyword is used to provide explicit access of a code block to single thread ?Core Java
Transient
Final
Explicit
Synchronized

  java  threads  multithreading

Which of the following exception is thrown when we try to access element which is beyond the size ?Core Java
NullPointerException
ArrayIndexOutOfBoundException
ArithmeticException
ParseException

  java  exceptions  error handling

Checked exception needs to be ... Core Java
Caught
Method needs to declare that it throws these exception
Either A or B
Both A and B

  java  exceptions  checked exceptions

Collections.sort can only be performed on ..Core Java
Set
List
Map
Any Collection implementation

  collections  java  sorting

POM stands for ... Maven
Project Object Model
Project Oriented Model
Prospective Object Model
Prospective Objective Model

  maven  pom

Which of the following is not type of Maven Repository ?Maven
Local
Remote
Maven Central
Maven Local

  maven  repositories

What is the default location of local repository ?Maven
~/.m2/repo
~/m2./home/repository
~/m2./repository
~/m2./home/repo

  maven  repositories  local repositories  m2

Which of the following is not type of Maven Plugin ?Maven
Build
Reporting
Remote
All are valid Maven Plugin types

  maven  maven plugins

Which of the following is not a dependency scope in Maven ?Maven
Compile
Test
System
Export

  maven  maven dependencies

What is a project's fully qualified artifact name?Maven
::
:
::
:

  maven  artifact

Which of the following is dependency exclusion ?Maven
A doesn't depend on C and then A marks C as excluded.
A Depends on B and B depends on C and then A can mark B as excluded.
A and B depends on C and then they can mark C as excluded.
A depends upon B and B depends upon C then A marks C as excluded.

  maven  dependency exclusion

Effective Java 6 , TreeMap implements ...Core Java
Map Interface
SortedMap Interface
NavigableMap Interface
SortedNavigableMap Interface

  java  collections  map

Which of the following is not possible ?Core Java
try block followed by catch
try block followed by finally
try block followed by catch block and then finally
try block without catch or finally block

  exceptions  java  try-catch  finally

Which of the following is not the difference between Singleton and Static class ( Class with static members only ) ?Core Java
Only one object can be created for Singleton class whereas No objects are created for static class.
Singleton class instance is initiated using new keyword whereas static class instance is created using static method.
Singleton class can be serialized whereas Static class cannot be.
Singleton Class can participate in runtime Polymorphism whereas Static class cannot.

  java  oops  singleton  design pattern  static class

Which of the following is false about main method ?Core Java
It should be declared public and static
it should have only 1 argument of type String array
We can override main method
We can overload main method

  java  main method

Which of the following is false about Constructors ?
Constructor can be overloaded
A no argument constructor is provided by the compiler if we declare only constructors with arguments.
Constructors shouldn't have any return types , not even void.
If super is not explicitly called, still super() is intrinsically added by the compiler.

  java  oops  constructor

Variables of an interface are intrinsically ... Core Java
transient
final
public
static

  java  interface  interface variables

Which of the following class creates mutable objects ?Core Java
Boolean
File
String
StringBuffer

  java  immutable

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

Invoking start twice on same thread leads to ..Core Java
ClassCastException
NullPointerException
InterruptedException
IllegalStateException

  java  exception  threads

Which of the following is false about var args ?Core Java
Var Args argument should have data type followed by three dots
Three dots should be consecutive and not separated by even space
We cannot have space before and after the dots
If there is a var args in the method, it should be only one and the last one.

  java  var args

Which of the following is not valid var args declaration ?Core Java
int sum (int... numbers)
int sum (.int .. numbers)
int sum (int ... numbers)
int sum (int x, int ... numbers)

  java  var args

Strings in switch were introduced in Which Java version ?Core Java
Java 5
Java 6
Java 7
Java 8

  java  switch  string in switch

Which of the following doesn't extend Collection interface ?Core Java
Set
List
Map
Queue

  java  collections  collection interface

Which is the default Input Formats defined in Hadoop ?Core Java
SequenceFileInputFormat
ByteInputFormat
KeyValueInputFormat
TextInputFormat

  hadoop  hadoop input format

Which of the following is not an input format in Hadoop ?Core Java
TextInputFormat
ByteInputFormat
SequenceFileInputFormat
KeyValueInputFormat

  hadoop  hadoop input format

Which of the following is a valid flow in Hadoop ?Bigdata
Input -> Reducer -> Mapper -> Combiner -> -> Output
Input -> Mapper -> Reducer -> Combiner -> Output
Input -> Mapper -> Combiner -> Reducer -> Output
Input -> Reducer -> Combiner -> Mapper -> Output

  hadoop  map reduce

MapReduce was devised by ...Bigdata
Apple
Google
Microsoft
Samsung

  hadoop  map reduce

Which of the following is not a phase of Reducer ?Bigdata
Map
Reduce
Shuffle
Sort

  hadoop  map reduce

How many instances of Job tracker can run on Hadoop cluster ?Bigdata
1
2
3
4

  hadoop  hadoop cluster

Which of the following is not the Dameon process that runs on a hadoop cluster ?Bigdata
JobTracker
DataNode
TaskTracker
TaskNode

  hadoop  hadoop cluster

What is an instance variable?Core Java
An instance or object of an class
The field of an object
Any variable of a class
None of the above

  java  oops  oop  instance variable  variables

Which of the following do you think is the primary reason you would never use a static class even the application doesn't need multiple requests or threads ?Core Java
Serialization
Runtime Polymorphism
Lazy Loading
Memory

  static class  static vs singleton  java  oops  objects

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

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 Java feature promotes access protection or Hiding ?Core Java
Inheritance
Encapsulation
Abstraction
Composition

  java  java concepts  java features  oops concepts  oops features  access protection  information hiding

Which of the following is not a build tool ?
Maven
Ant
Gradle
svn

  java  build tools

Which keyword specify that a variable is effectively final ?Core Java
final
No Keyword
Both of the above
None of the above

  java  java 8  java8  final  effectively final

What is a Sequence File?Bigdata
A Sequence File contains a binary encoding of an arbitrary number of homogeneous writable objects.
A Sequence File contains a binary encoding of an arbitrary number key-value pairs. Each key must be the same type. Each value must be of same type.
A Sequence File contains a binary encoding of an arbitrary number of heterogeneous writeable objects.
A Sequence File contains a binary encoding of an arbitrary number of Writable Comparable objects, in sorted order.

  hadoop  bigdata  big data

What is the input to the Reduce function ?Bigdata
One Key and One Value
Multiple Keys and Multiple associated Values
Multiple Keys and One associated values with each
One key and associated values.

  hadoop  bigdata  big data  map-reduce  map reduce  reduce function

Which of the following is the implementation language for Map Reduce Framework ?
Big Data
Hadoop
Java
C++

  hadoop  bigdata  big data  map-reduce  map reduce framework

Which of the following has been introduced with Java 8 ?Core Java
StringBuffer
StringBuilder
StringFilter
StringJoiner

  java  java8  java 8  String  StringJoiner

enums are intrinsically ..Core Java
private
public
static
final

  java  enum

Enums cannot be declared ..Core Java
private
public
static
final

  java  enum

Which class provides the enumerated value for Bean Scope ?Spring
BeanDefinition
ConfigurableBeanFactory
WebApplicationContext
All of the Above

  spring  spring beans  spring bean scope

Which of the following Interface needs to be implemented by any object that wishes to be notified of the ApplicationContext that it runs in ?Spring
ApplicationContextAware
ApplicationContextUtils
ApplicationContext
Aware

  spring  applicationcontext  application context  ApplicationContextAware

In Spring , Which class handles the Http requests for RESTful web services ?Spring
Service
Model
Controller
Util

  spring frmaework   spring mvc    rest   webservices

When String literals are compared using ==, they always returns true if the string values are same because .. Core Java
of overridden compareTo method
of overridden compare method
of String Pool
== means that the object contents are equal

  

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

  

In case of String Literals ..Core Java
x==y on all literals always returns false
x.equals(y) on all literals always returns false
if x.equals(y) returns true, x==y returns true too
if x.equals(y) returns false, x==y returns true

  

What is a default constructor ?Core Java
Constructor without parameters declared by user
Constructor provided by Java if no constructor is declared
Constructor with empty body
All of the above

  Constructor

How can we create objects if we make the constructor private ?Core Java
We can't create objects if constructor is private
We can only create objects if we follow singleton pattern
We can only create one object
We can create new object through static method or static block

  constructor   private constructor

What will be the output of following ?

String str1 = new String("String1");
String str2 = new String("String1");
System.out.print(str1 == str2);
System.out.print(str1.equals(str2));
str1 = str2;
System.out.print(str1 == str2);
Core Java
falsetruetrue
truetruetrue
truetruefalse
falsetruefalse

  equals  object equality

What will be the output of following code ?

String str1 = "String1";
String str2 = "String1";
System.out.print(str1 == str2);
System.out.print(str1.equals(str2));
str1 = str2;
System.out.print(str1 == str2);
Core Java
falsetruetrue
falsefalsetrue
truetruetrue
falsefalsefalse

  equals  object equality  string pool

What will be the output of following code ?

String str1 = "String1";
String str2 = "String2";
str1.concat("String3");
System.out.print(str1);
System.out.print(str2);
Core Java
String1String2
String1String3String3
String1String3String1String3
String1String1

  

What will be the output of following code ?

String str1 = "String1";
String str2 = "String2";
str1=str1.concat("String3");
System.out.print(str1);
System.out.print(str2);
Core Java
String1String2
String1String3String2
String1String2String3
String1Stringg3String1

  

Which method needs to be implemented if a class is implementing comparable interface ?Core Java
comp
compare
compareTo
compareEquals

  comparable  interfaces  compare  compareTo

Which of the following is false ?Core Java
A Class cannot override both hashcode and equals method.
A class can override both hashcode and equals method.
A Class must override hashCode method if its overridding equal method.
A Class can override hashCode even if its not overridding equals method.

  hascode  equals method  overridding hashcode and equals method

Collections is a / an ..Core Java
interface
abstract class
final class
util class

  collections

Which of the following can throw ClassCastException ?Core Java
UpCasting
DownCasting
Casting to incompatible data type
Casting to Strings

  casting

Which of the following can be overridden ?Core Java
final instance methods
final static methods
non final instance methods
non final static methods

  overriding

x instanceOf y returns false ..Core Java
if x is an instance of y class
if x is an instance of class implementing y interface
if x is an instance of class extending y class
if x is an instance of Class which is a parent of Y class

  instaceOf

notify(), notifyAll(), wait() are found in which classCore Java
java.lang.Object
java.lang.Thread
java.lang.Runnable
java.lang.Implement

  

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

If X implements Y and Y extends Z, Which of the following initialization is correct ?Core Java
X x = new Y();
X x = new Z();
Z z = new Y();
Z z = new X();

  interfaces

If class A implements X interface, and Class B implements Y interface, and X is the parent of Y, Which of the following initialization is correct ?Core Java
A a = new B();
Y y = new A();
X x = new B();
Y y = new A();

  interfaces   inheritance

What will be the output of executing following class ?

public class BuggyBread {

static {
System.out.println("Static Block");
}

{
System.out.println("Initialization Block");
}

BuggyBread(){
System.out.println("Constructor");
}

public static void main(String[] args){
System.out.println("Main Method");
}
}
Core Java
Static Block
Main Method
Static Block
Instance Initialization Block
Main Method
Static Block
Constructor
Main Method
Static Block
Instance Initialization Block
Constructor
Main Method

  static block  Instance Initialization Block

What will be the output upon executing following class ?

public class BuggyBread {

static {
System.out.println("Static Block");
}

{
System.out.println("Instance Initialization Block");
}

BuggyBread(){
System.out.println("Constructor");
}

public static void main(String[] args){
System.out.println("Main Method");
new BuggyBread();
}
}
Core Java
Instance Initialization Block
Constructor
Static Block
Main Method
Static Block
Instance Initialization Block
Constructor
Main Method
Main Method
Static Block
Instance Initialization Block
Constructor
Static Block
Main Method
Instance Initialization Block
Constructor

  static block  Instance Initialization Block

With the following code, Which is a valid way to initialize ?
public class BuggyBread {

   private String element1;

   private String element2;

   private BuggyBread(String element1, String element2){
      this.element1 = element1;
      this.element2 = element2;
   }

   public static class Builder {
   
      private String element1;

      private String element2;

      Builder(BuggyBread buggybread){
         element1 = buggybread.element1;
         element2 = buggybread.element2;
      }

      Builder withElement1(String element1){
         this.element1 = element1;
         return this;
      }

      Builder withElement2(String element2){
         this.element2 = element2;
         return this;
      }

      BuggyBread build(){
         BuggyBread buggybread = new BuggyBread(element1,element2);
         return buggybread;
      }
   }
}
Core Java
BuggyBread buggybread = new BuggyBread();
BuggyBread buggybread = new BuggyBread("element1","element2");
BuggyBread.Builder builder = new BuggyBread.Builder();
BuggyBread.Builder builder = new BuggyBread.Builder("element1","element2");

  builder pattern

What will be the output of following code ?

public class BuggyBread {
   
   private int x;
   private int y;
   
   BuggyBread(int x,int y){};
   
   public static void main(String[] args){
      BuggyBread buggybread = new BuggyBread();
      System.out.println(buggybread.x);
   }
}
Core Java
0
null
compilation error due to uninitialized element
compilation error due to constructor

  default constructor

What will be the output of following ?

public class BuggyBread {

   private int x;
   private Integer y;

   BuggyBread(int x,int y){};

   public static void main(String[] args){
      BuggyBread buggybread = new BuggyBread(1,2);
      System.out.println(buggybread.x);
      System.out.println(buggybread.y);
   }
}
Core Java
0 0
0 null
null 0
null null

  default values

What will be the output of following code ?

public class BuggyBread {

   private int x;
   private Integer y;

   private BuggyBread(int x,int y){};

   public static void main(String[] args){
      BuggyBread buggybread = new BuggyBread(1,2);
      System.out.println(buggybread.x);
   }
}
Core Java
compilation error due to private constructor
compilation error due to uninitialized elements
0 null
0 0

  constructor

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

What will be the output of exceuting main method ?

public static void main(String[] args){
      List list = new ArrayList();
      list.add(1);
      list.add(2);
      list.add(3);
      System.out.println(list);
   }
Core Java
1,2,3
Order cannot be determined
compilation error
3,2,1

  collections  list  arraylist

What will be the output upon executing main method ?

public static void main(String[] args){
      Set set = new HashSet();
      set.add(1);
      set.add(2);
      set.add(3);
      System.out.println(set);
   }
Core Java
1,2,3
Order cannot be determined
Compilation error
3,2,1

  set  hashset  collections

What will be the ouput upon executing main method ?

public class Vehicle {
   public void move(){
      System.out.println("Vehicle is moving");
   }
}

public class Car {
   public void move(){
      super().move();
      System.out.println("Car is moving");
   }

   public static void main(String[] args){
      new Car().move();
   }
}
Core Java
Vehicle is moving
Car is moving
Vehicle is moving Car is moving
Compilation Error

  overriding

What will be the output upon exceuting main method ?

public class Vehicle {
   private void move(){
      System.out.println("Vehicle is moving");
   }
}

public class Car extends Vehicle{
   public void move(){
      System.out.println("Car is moving");
   }

   public static void main(String[] args){
      Vehicle vehicle = new Car();
      vehicle.move();
   }
}
Core Java
Vehicle is moving
Car is moving
Vehicle is moving Car is moving
Compilation error

  overriding

What will be the output upon executing the main method ?

public class Vehicle {
   public void move(){
      System.out.println("Vehicle is moving");
   }
}

public class Car extends Vehicle{
   public void move(){
      System.out.println("Car is moving");
   }

   public static void main(String[] args){
      Vehicle vehicle = new Vehicle();
      ((Car)vehicle).move();
   }
}
Core Java
Vehicle is moving
Car is moving
Cimpilation Error
Runtime Exception

  overriding

Which of the following is not the dependency scope in Maven ?Maven
Compile
Runtime
Debug
Test

  maven  maven dependencies scope

Which of the following is true for == operator ?Core Java
For primitives, == checks if the variables on left and right have same data type
For primitives, == checks if the variables on left and right have same value
For Objects, == checks if the references on left and right have same data type
For Objects, == checks if the references on left and right have same value

  == operator  equality

Which of following uniquely identify the artifact or dependency in Maven ?Maven
Artifact Id
Group Id
Version
All of the above

  maven

Which of following is not type of Maven Repository ?Maven
Local
Remote
Central
State

  maven   maven repository

Which of the following is equivalent to following logic ?

Not X && Not Y
Core Java
x || Y
Not(X || Y)
Not(X && Y)
Not X && Y

  logical operator

Which of the following http response means the resource is not found ?Java EE
500
200
404
400

  http status code  http  web

What is Dirty Read in Database Transactions ?Database
Data Read by Transaction 2 which hasn't yet updated by Transaction 1
Data Read by Transaction 2 which has been updated and commited by Transaction 1
Data Read by Transaction 2 which has been updated but not commited by Transaction 1
Inability of Transaction 2 to read Data when Transaction 1 is updating.

  database transaction

Which of following annotation is used to initialize objects before executing set of tests ?Junit
@Test
@Ignore
@After
@Before

  junit  junit annotations  testing

Optional has been introduced in Java 8 to get away with which of following exception ?Core Java
ArithmeticException
ParseException
NullPointerException
FileNotFoundException

  optional

Which of the following is not true for abstract classes ?Core Java
Abstract Class is only meant to be sub classed and not supposed to be instantiated.
Abstract class handlers can be used to handle derived class objects.
We can't have an abstract class without abstract methods.
Abstract class has member elements.

  abstract class  abstract methods

Which of the following is not true for static keyword ?Core Java
Static members are shared by all objects of the class.
We can override static methods.
Static methods operate on static variables only.
Static Elements are accessed using class name.

  static

Which of the following class creates immutable objects ?Core Java
String
StringBuffer
StringBuilder
None of these create immutable objects.

  String  StringBuffer  StringBuilder  Immutable

Which of the following class is synchronized ?Core Java
String
StringBuffer
StringBuilder
None of these

  String  StringBuffer  StringBuilder  Synchronized

Which of the following methods are used by Java Garbage Collection Mechanism ?Core Java
final
finally
finalize
All of the above

  garbage collection  finalize

Which of the following about Garbage collection is false ?Core Java
We can call Garbage collection explicitly
Garbage Collection guarantees that the application will not run out of memory
finalize method is used by Java for Garbage Collection
Garbage Collection Mechanism delete unclaimed objects that are no longer required

  garbage collection

What is Lazy Initialization in Hibernate ?Hibernate
Feature to load the dependencies from Cache
Feature to load all objects and relationships in advance before they can be used
Feature to not load dependencies and relationship in advance and load when required
Feature to not load the dependencies and relationships at all

  Lazy Initialization

Which of the following is not the benefit of Lazy Initialization in Hibernate ?Hibernate
Laod When required provides better performance
Object stays lighter
Less number of Database calls
Less load on Database

  Lazy Initialization  Lazy Fetching

Which of the following is not an advantage of JSON over XML ?JSON
Lighter and Faster
Object Representation
Supports multiple data types
Backward compatible with all XML applications

  JSON  XML

JSON is a ..JSON
Programming Language
Markup Language
Scripting Language
Database Language

  

Binary Search requires that the collection should beAlgorithm
Sorted in Ascending Order
Sorted in Descending Order
Sorted in any Order
Unsorted

  Binary Search  Search  Algorithm

Which of the following can be declared abstract ?Core Java
static methods
instance methods
static variable
instance variables

  abstract

Which of the following class types in MVC should have Business Logic ?Design
Model
View
Controller
JSP

  mvc

Which of the following web status code means "Resource not found" ? Java EE
500
200
401
404

  

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

What is the problem with this code ?

public class Car extends Vehicle{   
   int x;
   
   Car(int y){
      x = 5;
   }
   
   Car(){
      this(5);
      super();
   }
}
Core Java
We cannot overload constructors
Constructors should have type
we should have called super() before this(5)
We cannot have both super() and this() in a constructor

  Constructor  this  super

What is the problem with this code ?

public class Car extends Vehicle{
   int x;

   Car(int y){
      x = 5;
   }

   Car(){
      super();
      this.x = 5;
   }
}
Core Java
We cannot overload constructors
We cannot call super in overloaded constructor
we cannot have this and super in constructor
There is no problem

  constructor  this  super

The following code is an example of

public class Car extends Vehicle{
   int x;

   Car(int y){
      x = 5;
   }

   Car(){
      this(5);
   }
}
Core Java
Constructor Overloading
Constructor Chaining
Both Constructor Overloading and Chaining
None of above

  constructor  constructor overloading  constructor chaining

What is the problem with following code ?

public class Car extends Vehicle{
   int x;

   void Car(int y){
      x = 5;
   }

   void Car(){
      this(5);
   }
}
Core Java
We cannot use this() within normal method
We cannot chain methods
We cannot overload constructors
We cannot use return type void with overloaded methods

  constructor

How to append the output of a command to file Unix
command < file
command > file
command <> file
command >> file

  Unix Commands

Which command helps you know in which folder you currently are ?Unix
cat
pwd
vi
who am i

  Unix Commands

What is the command to move to your home directory ?Unix
cd
cd..
cd home
cd .

  

Which Database feature assist in ACID capabilities ?Core Java
Indexes
Stored Procedures
Locking
Cursors

  acid

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

Function variables are kept in ..Core Java
Stack
Heap
Both Stack and Heap
None of them

  memory management  stack  heap

Which of the following is a Marker Interface ?Core Java
Runnable
Serializable
Cloneable
Both Serializable and Cloneable

  marker interface  interfaces

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

Which of the following collections stores its elements in natural sorting order ?Core Java
HashMap
LinkedHashMap
TreeMap
EnumMap

  map  collections

Which of following stores its elements in natural Sorting Order ?Core Java
AbstractSet
HashSet
LinkedHashSet
TreeSet

  set  collections

Thread thats executed before the JVM exits is called ..Core Java
final thread
finally thread
daemon thread
shutdown hook

  

What kind of thread is Garbage collection thread ?Core Java
Daemon Thread
User Thread
System Thread
Active Thread

  garbage collection  thread type

Which of following is Daemon Thread ?Core Java
Thread Scheduler
Daemon Thread
Both of above
None of above

  daemon thread   threads

Which of following can be nested into another ?Core Java
class within another class
class within interface
interface within class
All of above

  nested classes   nested interface  inner classes

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

  serialization

In which case finally won't get executed ?Core Java
in case of exception
in case of normal execution
in case of return statement before end of try block
in case of force program termination

  finally

Which Java version introduced Lambda expressions ?Core Java
Java 5
Java 7
Java 8
Java 9

  

Which of following is not the method of object class ?Core Java
run
notify
wait
clone

  object class

Which of following is not true ?XML
Dom Parser loads the whole doument at once in memory
A DOM Parser is much more memory efficient
Dom Parser doesn't load the whole doument at once in memory
A SAX Parser is much more memory efficient

  xml  xml parsers

Which of the following file is called deployment descriptor ?Java EE
application.xml
web.xml
config.xml
web-application.xml

  deployment descriptor

Which of the following is not true ?Core Java
A Java class can extend multiple classes
A Java class can implement multiple interfaces
A Java interface can extend multiple interfaces
All of above are true

  inheritance  multiple inheritance

Which of following class types in MVC holds Business logic ?Java EE
Model
View
Controller
Accessor

  mvc

Which memory segment holds String Pool ?Core Java
Stack
Heap
Code Segment
Class Segment

  memory management  string pool

In this code

public class BuggyBread1{
   private static String staticVariable = "static Variable";
   
   private String instanceVariable = "instance Variable";
   
   public static void main (String args[]) {
String localVariable = "local Variable";
}
}

Where will the value 'static Variable' be stored ?
Core Java
Stack Memory Segment
Heap Memory Segment
Runtime Constant Pool within Heap Segment
Code Segment

  memory manegement

In this code

public class BuggyBread1{
   private static String staticVariable = "static Variable";
   
   private String instanceVariable = "instance Variable";
   
   public static void main (String args[]) {
String localVariable = "local Variable";
}
}

Where will the value 'static Variable' be stored ?
Core Java
Stack Memory Segment
Heap Memory Segment
Runtime Constant Pool within Heap Segment
Code Segment

  memory management

In this code

public class BuggyBread1{
   private static String staticVariable = "static Variable";
   
   private String instanceVariable = "instance Variable";
   
   public static void main (String args[]) {
String localVariable = new String("local Variable");
}
}

Where will the value 'local Variable' be stored ?
Core Java
Stack Memory Segment
Heap Memory Segment
Runtime Constant Pool within Heap Segment
Code Segment

  memory management

In this code

public class BuggyBread1{
   private static String staticVariable = new String("static Variable");
   
   private String instanceVariable = "instance Variable";
   
   public static void main (String args[]) {
String localVariable = "local Variable";
}
}

Where will the value 'static Variable' be stored ?
Core Java
Stack Memory Segment
Heap Memory Segment
Runtime Constant Pool within Heap Segment
Code Segment

  memory management

What will be the output of this code

ArrayList list = new LinkedList();
list.add(3);
list.add(2);
list.add(1);
System.out.println(list);
Core Java
1,2,3
3,2,1
Order cannot be determined
Compilation Error

  list  collections

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

  java keywords

Which of following memory segment is cleaned by Garbage Collection Mechanism ?Core Java
Stack
Heap
Code
Cache

  memory management  garbage collection

Default Constructor is provided by Java , if ..Core Java
No constructor is provided by coder
No argument constructor is not provided by Coder
No Constructor is provided by coder initializing fields to null and primitive default values
No argument constructor is provided by coder

  Constructor

Default Constructor is provided by Java ... Core Java
To Reserve Memory
To provide at least one instance method
To Make it look good
To initialize the object state

  Constructor

Which of following is an application server ?Server
Tomcat
MySql
Oracle
All of above

  servers

Which of the following wildcard is used to import multiple packages at once ?Core Java
.
?
*
&

  import packages  import

In Case a method is declared to throw an exception , We can only use a call to that method if ...Core Java
We use the call within try block and catch the exception
We declare that the method is expected to throw the exception using throws
Both 1 and 2
Either 1 or 2

  exception handling  throws

Which of the following Java feature specify hash-a relationship between objects ?Core Java
Inheritance
Composition
Polyorphism
Encapsulation

  oops

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 is not true for Hibernate Cache ?Hibernate
First level cache is enabled by default
First level Cache is Session specific
First level cache is considered global
First level Cache came with Hibernate 1.0

  hibernate cache

Which of the following is not an Hibernate AnnotationHibernate
@Id
@JoinTable
@ManyToMany
@Autowired

  hibernate annotations

Which of following is not Spring MVC annotation ?Spring
@Autowired
@Controller
@JoinColumn
@Transactional

  spring annotations

We cannot override compareTo method for ...Core Java
Abstract Class
Final Class
Enum
Interfaces

  compareTo

Which of the following keyword is expected with main method declaration ?Core Java
Final
Static
Volatile
Transient

  main method

Which of the following is true ?Core Java
http and https are secured protocols
http is a secured protocol whereas https is not a secured protocol
https is an unsecured protocol whereas https is a secured protocol
https and https are unsecured protocols

  http  https

Overriding is not possible without ..Core Java
Inheritance
Composition
Inner Classes
Abstract Classes

  overriding

Which of the following is true ?Core Java
throw and throws are used to throw an exception
throw is used to throw an exception whereas throws is a declaration that the method can throw the exception
throws is used to throw an exception whereas throw is a declaration that the method can throw the exception
throw and throws are used to declare that an exception can be thrown by the method

  throw  throws  exception handling

throws is a declaration that the ..... is expected to throw an exception ?Core Java
Variable
Method
Class
Interface

  throws  exception handling

What is out in System.out.println ?Core Java
out is static inner class
out is the reference for static inner class object
out is the static reference to OutputStream object
out is the static reference to PrintStream object

  System.out.println

With the declaration like following ,

Object obj = new String();

which of the following code will give compilation error
Core Java
obj.clone()
obj.toString()
obj.equals()
obj.append()

  

In majority of the cases, the following join will give maximum number of results ?Database
Inner Join
Outer Join
Left Join
Right Join

  sql  sql joins

Which if the following is true for SQL Joins ?Database
Left Join and Right Join gives equal number of Results
Outer Join and Inner Join gives equal number of Results
Inner Join gives maximum number of results records
Inner Join gives minimum number of result records

  sql  sql joins

Which of following about main method is not true ?Core Java
We can have multiple methods named main in a class
We can have var args with the main method
We can overload main method
We can override main method

  main method

Which of the following collection classes store their elements as Key Value pairs ?Core Java
Set
List
Map
Queue

  collections

Listeners are example of ..Design
Factory design Pattern
Abstract Factory Design Pattern
Singleton Design Pattern
Observer Design Pattern

  Design Pattern

Which of following cannot be overloaded ?Core Java
Constructors
Main Method
Final Methods
All of above can be overloaded

  overloading

Which of following is an IDE ?Tool
Jira
Maven
Eclipse
Apache

  tools

Which of following is a Build Tool ?Tool
Maven
Jira
Eclipse
Tomcat

  tool

Which of the following is a configuration management tool ?Tool
Github
Jira
Tomcat
Eclipse

  tools  configuration management

Which of following is not a configuration management tool ?Tool
SVN
Jira
GitHub
Clearcase

  configuration management  source code management  scm

An Ideal Util class doesn't have ...Core Java
private constructor
static methods
static variables
non static methods

  Util classes

Which of the following Design pattern has been used with Hibernate Criteria ?Hibernate
Filter
Prototype
Builder
Observer

  Hibernate  Design Pattern

Which of following is not core interface of Hibernate ?Hibernate
Session
Transaction
SessionFactory
TransactionFactory

  Hibernate  hibernate Core Interface

Which of the following is not true for Prepared Statements ?Database
Prepared Statements provides better performance
Prepared Statements prevent SQL Injection attacks
Prepared Statements provide ORM capabilities
Prepared Statement provides DB side caching

  database  Prepared Statements

Which of the following session method is used to disassociate / disconnect all objects from the sessionHibernate
Clear
Evict
Close
Merge

  

Which of the following session method is used to disassociate / disconnect a particular object / entity from the sessionHibernate
Clear
Evict
Close
Merge

  Hibernate  Hibernate Session

Which of following is not the resolution for preventing LazyInitializationException?Hibernate
Set fetch=FetchType.EAGER for Dependent entity mapping
Make sure that we are accessing the dependent objects before closing the session
Make sure that we are accessing the dependent objects after closing the session
Wrap the complete access within Transaction

  Hibernate  LazyInitializationException

Semaphores are used to solve problem of ... Operating system
Race Condition
Process Synchronization
Mutual Exclusion
All of above

  Semaphore  Operating system

Which of the following is a valid way to avoid NullPointerException ?Core Java
Avoid assigning null to the reference
Null Checks before accessing elements of an object
Both of the above
None of the above

  NullPointerException  null

Which of the following class cannot be extended or inherited ?

StringBuffer , StringBuilder
Core Java
StringBuffer
StringBuilder
Both cannot be extended
Both can be extended

  final classes  StringBuffer  StringBuilder

Spring MVC is a .. Spring
Model Framework
View Framework
GUI Framework
Web Framework

  Spring  Frameworks

Other name for setter methods is .. Core Java
Getter Methods
Redefinition Methods
Final methods
Mutator methods

  methods

Which type of EJB can use bean pooling?Java EE
Session Beans
Stateless Session Beans
Stateless Sessionless Beans
Any EJB Beans

  EJB  Beans