πŸ“Š JAVA
Q. What is the lastest version of Java?
  • (A) 17
  • (B) 21
  • (C) 9
  • (D) 8
πŸ’¬ Discuss
βœ… Correct Answer: (B) 21

Explanation: As of now Java 21 is the latest.

πŸ“Š JAVA
Q. Identify the incorrect statement?
  • (A) Java is programming language
  • (B) Java is a platform
  • (C) Java is dynamically typed
  • (D) Java is statically typed
πŸ’¬ Discuss
βœ… Correct Answer: (C) Java is dynamically typed

Explanation: Java is not a dynamically typed language; it is a statically typed language. This means that variable types are checked at compile-time, not at runtime.

Static Typing in Java

When you declare a variable in Java, you must specify its type explicitly.

Once assigned, the type cannot change.


Example:

int num = 10; // 'num' is explicitly declared as an integer
num = "Hello"; // ❌ Compile-time error: incompatible types

This strict type-checking helps catch errors early, making Java a strongly typed and statically typed language.

πŸ“Š JAVA
Q. JVM stands for ____
  • (A) Java vacuum machine
  • (B) Java void machine
  • (C) Java Virtual machine
  • (D) Java Virtual model
πŸ’¬ Discuss
βœ… Correct Answer: (C) Java Virtual machine

Explanation:

JVM (Java Virtual Machine) is a crucial part of the Java Runtime Environment (JRE). It is responsible for executing Java bytecode, making Java platform-independent by allowing it to run on any operating system that has a JVM.

Key Functions of JVM:

  • Converts Java bytecode into machine code for execution.
  • Manages memory allocation and garbage collection.
  • Ensures security and portability of Java applications.

Final Answer:

βœ… (C) Java Virtual Machine

πŸ“Š JAVA
Q. Which maven plugin creates the project structure?
  • (A) execution
  • (B) dependency
  • (C) properties
  • (D) archetype
πŸ’¬ Discuss
βœ… Correct Answer: (D) archetype

Explanation: Archetype is a Maven plugin whose task is to create a project structure as per its template.

πŸ“Š JAVA
Q. Which of the following is not true for Ant?
  • (A) It doesn’t have formal conventions
  • (B) It is procedural
  • (C) It is a tool box
  • (D) It provides lifecycle management
πŸ’¬ Discuss
βœ… Correct Answer: (D) It provides lifecycle management

Explanation:

Apache Ant is a Java-based build tool that automates software build processes. However, it does not provide lifecycle management like Maven or Gradle. Instead, it follows a procedural approach where tasks are defined in a specific sequence.

Why the other options are true?

(A) It doesn’t have formal conventions β†’ βœ… True

  • Unlike Maven, which enforces a standard project structure, Ant allows users to define their own build processes.

(B) It is procedural β†’ βœ… True

  • Ant follows a step-by-step (procedural) approach, where you explicitly define what should be done and in what order.

(C) It is a toolbox β†’ βœ… True

  • Ant provides a flexible set of tasks (tools) that can be customized according to project needs.

Final Answer:

βœ… (D) It provides lifecycle management (False statement)

πŸ“Š JAVA
Q. Which command can be used to check maven version?
  • (A) mvn -version
  • (B) maven -version
  • (C) maven -ver
  • (D) mvn -ver
πŸ’¬ Discuss
βœ… Correct Answer: (A) mvn -version

Explanation: mvn -version cmd is used to check the version of Maven.

πŸ“Š JAVA
Q. Can we run Junits as a part of Jenkins job?
  • (A) False
  • (B) True
  • (C) ---
  • (D) ---
πŸ’¬ Discuss
βœ… Correct Answer: (B) True

Explanation:

Yes, JUnit tests can be run as part of a Jenkins job. Jenkins supports JUnit test execution and reporting through various plugins like:

  • JUnit Plugin – Used to display test reports.
  • Maven / Gradle Integration – Runs JUnit tests as part of the build process.
  • Pipeline scripts – JUnit tests can be executed in scripted and declarative pipelines using junit step.

Example: Running JUnit in Jenkins Pipeline

pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'mvn clean test' // Runs JUnit tests
}
}
stage('Report') {
steps {
junit '**/target/surefire-reports/*.xml' // Publishes JUnit reports
}
}
}
}

Thus, the correct answer is: (B) True βœ…

πŸ“Š JAVA
Q. Which of the below is a source code management tool?
  • (A) Git
  • (B) Hudson
  • (C) Maven
  • (D) Jenkins
πŸ’¬ Discuss
βœ… Correct Answer: (A) Git

Explanation:

A Source Code Management (SCM) tool is used to track and manage changes in the source code. Among the given options:

  • Git β†’ βœ… SCM tool used for version control.
  • Hudson β†’ ❌ Old CI/CD tool (predecessor of Jenkins).
  • Maven β†’ ❌ Build automation tool.
  • Jenkins β†’ ❌ CI/CD tool for automation.

Thus, Git is the correct answer.

πŸ“Š JAVA
Q. Which environment variable is used to specify the path to maven?
  • (A) PATH
  • (B) CLASSPATH
  • (C) JAVA_HOME
  • (D) MAVEN_HOME
πŸ’¬ Discuss
βœ… Correct Answer: (D) MAVEN_HOME

Explanation:

 

  • MAVEN_HOME β†’ βœ… This environment variable is used to specify the installation directory of Maven.
  • PATH β†’ ❌ Used to set executable directories, including Maven’s bin directory.
  • CLASSPATH β†’ ❌ Used to specify Java classes and libraries, not for Maven.
  • JAVA_HOME β†’ ❌ Used to specify the JDK installation path, required for running Java applications but not directly for Maven.

Thus, MAVEN_HOME is the correct answer.

πŸ“Š JAVA
Q. Which file is used to specify the packaging cycle?
  • (A) dependency.xml
  • (B) build.xml
  • (C) version.xml
  • (D) pom.xml
πŸ’¬ Discuss
βœ… Correct Answer: (B) build.xml