Home / CSE MCQs / Groovy ::

### CSE MCQs :: Groovy

1. What is the limitation of Groovy?
2.  A. Groovy can be slower B. Groovy might need lots of memory C. Groovy start up time requires improvement D. All of the above

3. 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?
4.  A. def age = params.age ?: 0 B. def age = params.age ? params.age : 0 C. def age = params.name == 'age' ? params.age : "not found" D. def age = params.getAge

5. How Groovy string is expressed?
6.  A. It is surrounded by double quotes, for regular strings it uses single quotes B. It may contain Groovy Expressions noted in ${} C. Square bracket syntax may be applied like charAt(i) D. All of these 7. How Groovy string is expressed? 8.  A. It is surrounded by double quotes, for regular strings it uses single quotes B. It may contain Groovy Expressions noted in${} C. Square bracket syntax may be applied like charAt(i) D. All of these

9. How can we build AST (Abstract Syntax Trees) in Groovy from string?
10.  A. Strings B. Code C. From DSL like specification D. All of the above

11. Explain GroovyDoc comment?
12.  A. Type definitions (classes, interfaces, enums, annotations) B. Fields and properties definitions C. Methods definitions D. All the above

13. Why Use Groovy?
14.  A. For Java programmers it provides familiar syntax B. It has a rich stock of Java Libraries C. It easily integrate with your existing infrastructure like Servlet Containers, App Servers, Loads of databases with JDBC drivers D. All the above

15. 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?
16.  A. You forget to set plugin 'jar' in build.xml B. You forget to set plugin 'war' in build.gradle C. You forget to set plugin 'web' in build.gradle D. You forget to set plugin 'war' in web.xml

17. Mention the features offered by groovy JDK.
18.  A. The collection of literals. The literal syntax and its initialization are natural and highly readable unlike java in which they are cumbersome and unpleasant. B. 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. C. This feature was presented in groovy since its first release especially in the collection framework. D. All of these