Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Which of the following annotation is used to avoid execution of Junits?(a) @NoTest(b) @explicit(c) @avoid(d) @ignoreI had been asked this question by my college professor while I was bunking the class.This intriguing question originated from Annotations in portion Application Lifecycle & Annotations of Java

Answer»

The correct OPTION is (d) @IGNORE

For explanation I WOULD say: @ignore ANNOTATION is used to avoid execution of JUNITS.

2.

Using which annotation non visible or private method can be tested?(a) @VisibleForTesting(b) @NonVisibleForTesting(c) @Visible(d) @NonVisibleThe question was posed to me in an internship interview.Question is taken from Annotations topic in section Application Lifecycle & Annotations of Java

Answer»

Right CHOICE is (a) @VisibleForTesting

The explanation: USING @VisibleForTesting annotation private or NON visible METHOD can be tested.

3.

Which one of the following is not an annotation used by Junit with Junit4?(a) @Test(b) @BeforeClass(c) @AfterClass(d) @IgnoredI have been asked this question in an interview for job.Origin of the question is Annotations in chapter Application Lifecycle & Annotations of Java

Answer»

Correct ANSWER is (d) @Ignored

Explanation: @Test, @Before, @BeforeClass, @After, @AfterClass and @Ignores are the annotations USED by Junit with JUNIT4.

4.

Which one of the following is not ID generating strategy using @GeneratedValue annotation?(a) Auto(b) Manual(c) Identity(d) SequenceThis question was addressed to me in an interview for job.My question is from Annotations in portion Application Lifecycle & Annotations of Java

Answer»

The correct CHOICE is (b) Manual

For EXPLANATION: Auto, Table, IDENTITY and Sequence are the ID generating STRATEGIES using @GeneratedValue ANNOTATION.

5.

Which one of the following annotations is not used in Hibernate?(a) @Entity(b) @Column(c) @Basic(d) @QueryI had been asked this question in an interview for job.Enquiry is from Annotations in section Application Lifecycle & Annotations of Java

Answer»

Correct option is (d) @QUERY

For EXPLANATION: @Query is not an ANNOTATION USED in HIBERNATE.

6.

Annotations which are applied to other annotations are called meta annotations.(a) True(b) FalseThe question was posed to me in an international level competition.This key question is from Annotations topic in section Application Lifecycle & Annotations of Java

Answer»

Right CHOICE is (a) True

Explanation: Annotations which are APPLIED to other annotations are CALLED META annotations.

7.

Which of the following is not pre defined annotation in Java?(a) @Deprecated(b) @Overriden(c) @SafeVarags(d) @FunctionInterfaceI got this question at a job interview.I need to ask this question from Annotations in division Application Lifecycle & Annotations of Java

Answer»

The correct ANSWER is (B) @Overriden

The BEST EXPLANATION: @Overriden is not a pre DEFINED annotation in Java. @Depricated, @Override, @SuppressWarnings, @SafeVarags and @FunctionInterface are the pre defined annotations.

8.

Annotation type definition looks similar to which of the following?(a) Method(b) Class(c) Interface(d) FieldI got this question at a job interview.I'd like to ask this question from Annotations in section Application Lifecycle & Annotations of Java

Answer» CORRECT option is (C) Interface

The explanation is: ANNOTATION type definition is similar to an interface definition in which the KEYWORD interface is preceded by the sign @.
9.

Which version of Java introduced annotation?(a) Java 5(b) Java 6(c) Java 7(d) Java 8This question was posed to me during an online interview.I need to ask this question from Annotations topic in section Application Lifecycle & Annotations of Java

Answer»

The correct ANSWER is (a) JAVA 5

To EXPLAIN I would say: ANNOTATION were introduced with Java 5 version.

10.

Which command can be used to check maven version?(a) mvn -ver(b) maven -ver(c) maven -version(d) mvn -versionThis question was addressed to me in examination.This question is from Application Lifecycle topic in division Application Lifecycle & Annotations of Java

Answer» RIGHT answer is (d) MVN -VERSION

To explain I would say: mvn -version can be used to check the version of installed maven from COMMAND prompt.
11.

Can we run Junits as a part of Jenkins job?(a) True(b) FalseI have been asked this question in my homework.This question is from Application Lifecycle in division Application Lifecycle & Annotations of Java

Answer»

Correct option is (a) True

To EXPLAIN: As a part of jenkins JOB, we can run junits, fitnesse, test COVERAGE reports, CALL shell or BAT scripts, etc.

12.

Which of the following is not true for Ant?(a) It is a tool box(b) It provides lifecycle management(c) It is procedural(d) It doesn’t have formal conventionsThe question was asked in an online quiz.My question is based upon Application Lifecycle topic in portion Application Lifecycle & Annotations of Java

Answer» RIGHT option is (b) It provides lifecycle MANAGEMENT

The EXPLANATION is: Ant doesn’t provide lifecycle management. MAVEN provides lifecycle.
13.

Which of the below is a source code management tool?(a) Jenkins(b) Maven(c) Git(d) HudsonI had been asked this question during an interview.I'd like to ask this question from Application Lifecycle topic in portion Application Lifecycle & Annotations of Java

Answer»

The correct ANSWER is (c) Git

For explanation: Source code MANAGEMENT tools HELP is version control, compare DIFFERENT versions of code, crash management, etc. Git, SVN are POPULAR source code management tools.

14.

Which environment variable is used to specify the path to maven?(a) JAVA_HOME(b) PATH(c) MAVEN_HOME(d) CLASSPATHThis question was addressed to me at a job interview.Enquiry is from Application Lifecycle in section Application Lifecycle & Annotations of Java

Answer»

Right ANSWER is (c) MAVEN_HOME

The EXPLANATION: MAVEN_HOME should be SET to the bin FOLDER of MAVEN installation.

15.

Which file is used to specify the packaging cycle?(a) build.xml(b) pom.xml(c) dependency.xml(d) version.xmlI have been asked this question in exam.This intriguing question comes from Application Lifecycle in division Application Lifecycle & Annotations of Java

Answer» CORRECT ANSWER is (a) build.xml

Explanation: PROJECT STRUCTURE is SPECIFIED in build.xml.
16.

Which file is used to define dependency in maven?(a) build.xml(b) pom.xml(c) dependency.xml(d) version.xmlThe question was posed to me in my homework.The question is from Application Lifecycle topic in section Application Lifecycle & Annotations of Java

Answer»

The correct answer is (b) POM.xml

For explanation I would say: pom.xml is USED to define DEPENDENCY which is used to package the jar. POM stands for project OBJECT model.

17.

Which of the following is not a maven goal?(a) clean(b) package(c) install(d) debugThis question was addressed to me during an internship interview.The above asked question is from Application Lifecycle topic in portion Application Lifecycle & Annotations of Java

Answer»

The correct OPTION is (d) DEBUG

Explanation: CLEAN, package, INSTALL are maven goals. Debug is used finding and resolving of defects.

18.

Which of below is not a dependency management tool?(a) Ant(b) Maven(c) Gradle(d) JenkinsThe question was posed to me by my school principal while I was bunking the class.Query is from Application Lifecycle in section Application Lifecycle & Annotations of Java

Answer»

The CORRECT choice is (d) JENKINS

Explanation: Jenkins is continuous INTEGRATION system. Ant, Maven, Gradle is used for BUILD process.