Gradle Fabricating Systems Questions and Answers [2022 Updated]

Question#1 To execute the hello task in the build file, type _ on the command line.

a)gradle hello or gradle -q hello

b)gradle hello

c)gradle -q hello

d)gradle task hello

Correct Answer:- gradle hello or gradle -q hello

Question#2 Consider the following gradle build script:

task a{
ext.myProperty = “Hello”
}
task b{
doLast {
println a.myProperty
println c.myProperty
}}
task c(dependsOn: b){
ext.myProperty = “Hey”
println “Hi”}

If the task gradle -q c is run, what is the output?

a)Hey Hello Hi

b)Hi Hello Hey

c)Hello Hey

d)Hello Hey Hi

Correct Answer:- Hi Hello Hey

Question#3 Gradle build scripts are written in _.

a)Groovy

b)Groovy or Kotlin

c)Scala

d)Kotlin

Correct Answer:- Groovy or Kotlin

Question#4 Gradle tasks can also be created and extended dynamically at runtime.

a)True

b)False

Correct Answer:- True

Question#5 Gradle build scripts use a combination of declarative and imperative statements.

a)True

b)False

Correct Answer:- True

Question#6 Jobs are the unit of execution in Jenkins.

a)True

b)False

Correct Answer:- True

Question#7 In Gradle, a disabled task is labelled as _.

a)ABORTED

b)STOPPED

c)DISABLED

d)SKIPPED

Correct Answer:- DISABLED

Gradle Fabricating System

Question#8 Consider the following gradle build script:

task a { doLast { println ‘A’ }
}
task b(dependsOn: a)
{ doLast { println ‘B’ }
}
task c(dependsOn: a)
{ doLast { println ‘C’ }
}

If the task gradle -q c is run, what is the output?

a)A C C

b)A C

c)A C B

d)A

Correct Answer:- A C

Question#9 Multiline comments in Gradle build files are included using _ .

a)/* Multi line/*

b)//Multi line

c)/* Multi line */

d)All the options

Correct Answer:- /* Multi line */

Question#10 Which plugins are configured while integrating gradle with Jenkins?

a)Only Gradle plugin

b)Gradle Plugin and Java plugin

c)Gradle Plugin And plugin of repository used

d)None of the options

Correct Answer:- Gradle Plugin And plugin of repository used

Question#11 The plugins provided by jenkins supports __.

a)deployment of projects

b)Build of projects

c)automation of projects

d)All the options

Correct Answer:- All the options

Question#12 Which of the following statement is true about Jenkins?

a)Open source tool

b)Continuous integration tool

c)Supports plugins

d)All the options

Correct Answer:- All the options

Question#13 Which of the following statement is true about Jenkins?

a)Jenkins supports plugins to showcase both metrics and trends.

b)Jenkins supports plugins to depict trends only.

c)Jenkins supports plugins to report metrics only.

d)None of the options

Correct Answer:- Jenkins supports plugins to showcase both metrics and trends.

Question#14 Which are the two types of plugins in Gradle?

a)binary and resolve

b)script and resolve

c)resolve and apply

d)script and binary

Correct Answer:- script and binary

Question#15 The two build files generated by Android Studio are in ____.

a)build directory

b)root folder of project and build directory

c)root folder of project and app directory

d)root folder of project

Correct Answer:- root folder of project and app directory

Question#16 The external dependencies for the build script are defined using _.

a)version number

b)name of the organization that created the dependency

c)name of the dependency

d)All the options mentioned

Correct Answer:- All the options mentioned

Question#17 Which of the following is a quality plugin of Gradle?

a)Sonar Runner

b)PMD

c)Checkstyle

d)All the options

Correct Answer:- All the options

Question#18 Applying the Application plugin also implicitly applies the Java plugin.

a)True

b)False

Correct Answer:- True

Question#19 Gradle wrapper makes the execution of the build independent of the installed Gradle version.

a)True

b)False

Correct Answer:- True

Question#20 Finalizer tasks are automatically added to the task graph when the finalized task is scheduled to run.

a)True

b)False

Correct Answer:- True

Question#21 The war plugin enables the default JAR archive generation of the Java plugin.

a)True

b)False

Correct Answer:- False

Question#22 Which of the following statements are true?

a)Only Ant script can be migrated to Gradle build script.

b)Only Maven script can be migrated to Gradle build script.

c)Ant or Maven script can be migrated to Gradle build script.

d)Ant or Maven script cannot be migrated to Gradle build script.

Correct Answer:- Ant or Maven script can be migrated to Gradle build script.

Question#23 In Gradle, JAR files are published to _.

a)multiple locations

b)remote location

c)local directory

d)All the options mentioned

Correct Answer:- All the options mentioned

Question#24 The scala plugin applied in the Gradle can deal with __.

a)pure Java code

b)Scala code

c)mixed Scala and Java code

d)All the options

Correct Answer:- All the options

Question#25 Gradle supports multiple project templates called archetypes __.

a)True

b)False

Correct Answer:- False

Question#26 Gradle requires a Java JDK or JRE and Groovy to be installed.

a)True

b)False

Correct Answer:- False

Question#27 Lifecycle tasks typically have task actions.

a)True

b)False

Correct Answer:- False

Question#28 Java plugin is a binary plugin.

a)True

b)False

Correct Answer:- True

Question#29 The build task added by the Java plugin _.

a)Performs assembling of JAR files

b)Performs build of archives in the project

c)Performs a full build of the project.

d)Assembles production class library

Correct Answer:- Performs a full build of the project.

Question#30 While building a Java project with gradle, the JAR files are created in _ after the execution of gradle build command.

a)build/classes

b)build/tmp/jar

c)build/libs

d)build/tmp

Correct Answer:- build/libs

Question#31 Which of the following is Gradle’s in-built task?

a)Rename task

b)Copy task

c)Zip task

d)All the options

Correct Answer:- All the options

Question#32 The first line added in the build script to make the Android plug-in available for a Gradle build is __.

a)apply plugin: ‘com.android’

b)apply plugin: ‘android’

c)apply plugin: ‘com.application.android’

d)apply plugin: ‘com.android.application’

Correct Answer:- apply plugin: ‘com.android.application’

Question#33 Gradle Build Init plugin is an automatically applied plugin.

a)True

b)False

Correct Answer:- True

Question#34 Gradle dependencies are stored in builds.

a)True

b)False

Correct Answer:- False

Question#35 Gradle is a _ based build tool.

a)JVM

b).NET

c)Javascript

d)C#

Correct Answer:- JVM

Question#36 When Gradle plugins are applied to a project, it is possible to _.

a)Create new tasks

b)Extend build language

c)Support additional languages

d)All the options mentioned

Correct Answer:- All the options mentioned

Question#37 Which task is added by wrapper plugin to the project?

a)wrapperDependencies

b)assemble

c)wrapperDependencies or wrapper

d)wrapper

Correct Answer:- wrapper

Question#38 Gradle is an imperative build tool.

a)True

b)False

Correct Answer:- False

Question#39 The wrapper plugin can be auto-applied to the root project of the current build without modifying the build.gradle file.

a)True

b)False

Correct Answer:- True

Question#40 In Gradle, the Java plugin searches for Java production source code in the directory _.

a)src/main/resources

b)src/test/java

c)src/java/resources

d)src/main/java

Correct Answer:- src/main/java

Question#41 Which of the following is Gradle’s in-built task?

a)Copy task

b)Zip task

c)Rename task

d)All the options

Correct Answer:- All the options

Question#42 Which task is executed to use Gradle Build Init plugin?

a)skipping

b)init

c)standard or init

d)standard

Correct Answer:- init

Question#43 To build Android project, which version of gradle is required?

a)Gradle 1.12 and above

b)Gradle 2.2.1 and above

c)Gradle 1.7 and above

d)Gradle 2.1 and above

Correct Answer:- Gradle 2.2.1 and above

Question#44 In Gradle, the Java plug-in provides tasks to __.

a)run unit tests

b)create Javadoc and JAR file

c)compile Java source code

d)All the options

Correct Answer:- All the options

Gradle – Fabricating Systems FP Handson Solutions


Try to understand these solutions and solve your Hands-On problems. (Not encourage copy and paste these solutions)

Course Path: Mobility & Wearables/BUILD TOOLS/Gradle – Fabricating Systems

1.Try it out – Fibonacci Sequence
Welcome to Gradle program to generate Fibonacii series

Gradle Fabricating Handson Fibonacci Sequence

File Name – build.gradle

def fib(n)
{
int first_num = 1
int second_num = 1
if(n==1)
println first_num
else if(n==2)
println first_num + ” “+second_num
else if (n > 2)
{
print first_num + ” “+second_num
int i = 3
while(i<=n)
{
int z = first_num + second_num
print ” “+z
first_num = second_num
second_num = z
i = i+1
}
}
}
task fibo(){
doLast
{
int n = Integer.parseInt(num)
println “First”+n+”fibonacci numbers:”
fib n
}
}

2.Try it out – Play with Dependencies
Welcome to Gradle program to define dependency tasks

Gradle Fabricating Handson dependency tasks

File Name – build.gradle

project(‘:projectA’){
task hello
}
task hello
println tasks.getByPath(‘taskA’).path
println tasks.getByPath(‘independent task’).path
println tasks.getByPath(‘taskB’).path
println tasks.getByPath(‘dependent on taskA’).path

3.Exercise to Build Java Project
Welcome to Gradle program to calculate area of circle and square

Gradle Fabricating Handson Build Java Project

File Name – build.gradle

task circle {
doLast {
double area = (22/7)Double.parseDouble(radius)Double.parseDouble(radius)
println ‘area of circle is = ‘+area
}
}
task square {
doLast {
double area = Double.parseDouble(side)*Double.parseDouble(side)
println ‘area of circle is = ‘+area
}
}

About Author


After years of Technical Work, I feel like an expert when it comes to Develop wordpress website. Check out How to Create a Wordpress Website in 5 Mins, and Earn Money Online Follow me on Facebook for all the latest updates.

Leave a Comment