Explanation: As of now Java 21 is the latest.
Dear candidates you will find MCQ questions of JAVA here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question
Explanation: As of now Java 21 is the latest.
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.
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:
Final Answer:
β (C) Java Virtual Machine
Explanation: Archetype is a Maven plugin whose task is to create a project structure as per its template.
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
(B) It is procedural β β True
(C) It is a toolbox β β True
Final Answer:
β (D) It provides lifecycle management (False statement)
Explanation: mvn -version cmd is used to check the version of Maven.
Explanation:
Yes, JUnit tests can be run as part of a Jenkins job. Jenkins supports JUnit test execution and reporting through various plugins like:
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 β
Explanation:
A Source Code Management (SCM) tool is used to track and manage changes in the source code. Among the given options:
Thus, Git is the correct answer.
Explanation:
Thus, MAVEN_HOME is the correct answer.