Groovy(Engineering > Computer Science And Engineering ) Questions and Answers
Question 1. How Groovy string is expressed?
It is surrounded by double quotes, for regular strings it uses single quotes
It may contain Groovy Expressions noted in ${}
Square bracket syntax may be applied like charAt(i)
All of these
Explanation:-
Answer: Option D. -> All of these
Question 2. How Groovy string is expressed?
It is surrounded by double quotes, for regular strings it uses single quotes
It may contain Groovy Expressions noted in ${}
Square bracket syntax may be applied like charAt(i)
All of these
Explanation:-
Answer: Option D. -> All of these
Question 3. What is the limitation of Groovy?
Groovy can be slower
Groovy might need lots of memory
Groovy start up time requires improvement
All of the above
Explanation:-
Answer: Option D. -> All of the above
Question 4. You write a web application with groovlets. You need to get parameter of the request with name 'age' in your script. What is the best way to do this?
Question 5. How can we build AST (Abstract Syntax Trees) in Groovy from string?
Strings
Code
From DSL like specification
All of the above
Explanation:-
Answer: Option D. -> All of the above
Question 6. Mention the features offered by groovy JDK.
The collection of literals. The literal syntax and its initialization are natural and highly readable unlike java in which they are cumbersome and unpleasant.
The Groovy Beans property. Although Java is based on the concept of JavaBeans as a structure, still it lacks a direct syntactic support. Whereas, groovy can declare a field as a property as trivial and can access it too.
This feature was presented in groovy since its first release especially in the collection framework.
All of these
Explanation:-
Answer: Option D. -> All of these
Question 7. You write a web application and build it by the Gradle build tool. When you see all Gradle tasks, there isn't task 'war'. What a problem may it be?
You forget to set plugin 'jar' in build.xml
You forget to set plugin 'war' in build.gradle
You forget to set plugin 'web' in build.gradle
You forget to set plugin 'war' in web.xml
Explanation:-
Answer: Option A. -> You forget to set plugin 'jar' in build.xml
Question 8. Explain GroovyDoc comment?
Type definitions (classes, interfaces, enums, annotations)
Fields and properties definitions
Methods definitions
All the above
Explanation:-
Answer: Option D. -> All the above
Question 9. What are Bitwise Operators in Groovy?
&: bitwise and"
I : bitwise or"
A : bitwise xor"
~ : bitwise negation
Explanation:-
Answer: Option D. -> ~ : bitwise negation
Question 10. Why Use Groovy?
For Java programmers it provides familiar syntax
It has a rich stock of Java Libraries
It easily integrate with your existing infrastructure like Servlet Containers, App Servers, Loads of databases with JDBC drivers