Groovy Pragramming | Fresco Play
Question 1: Which of the following code has an error in it?
Answer: println (Hello World)
Question 2: Groovy code is compiled to byte code that is executed by the Java Virtual Machine (JVM).
Answer: True
Question 3: The following are features of Groovy.
Answer: All the options
Question 4: Which Class in Groovy specifies the instant date and time
Answer: Date
Question 5: What will be the output for the following code? def flower = ["Name" : "Jasmine", "Colour" : "White"] println(mp.keySet());
Answer: [Name, Colour]
Question 6: In Groovy map, each element will be mapped to a
Answer: key
Question 7: For in' loop is used with
Answer: All the options
Question 8: Groovy invokes Methods during _______ time.
Answer: Run
Question 9: All the packages and classes in Groovy is imported by default, you do not have to use the import statement explicitly
Answer: True
Question 10: The built-in method "eachLine" is used to
Answer: print all the lines in a file
Question 11: If the type of exception is not declared, any type of exception can be catched
Answer: True
Question 12: In groovy all methods and classes are--------------by default
Answer: public
Question 13: What are the dependencies for Groovy at runtime?
Answer: All the options
Question 14: Java 8 lambdas are more or less considered as
Answer: anonymous inner classes
Question 15: What is the limitation of Groovy?
Answer: All the options
Question 16: It is necessary to pass parameters while calling a parameterized method in Groovy.
Answer: False
Question 17: Grape is a JAR dependency manager included into Groovy.
Answer: True
Question 18: Groovysh is
Answer: a command line application
Question 19: In which of the following applications Groovy is used?
Answer: All the Options
Question 20: Return statement is mandatory in Groovy methods.
Answer: False
Question 21: The Groovy Class used for pasing JSON is
Answer: JSONSlurper
Question 22: ‘Semicolon’ is mandatory in Groovy.
Answer: False
Question 23: Which of the function is used to display the drive in which the file is present?
Answer: listRoots
Question 24: Groovy allows you to add quickly maven repository dependencies to your classpath.
Answer: Grape dependency
Question 25: The Gscript in Groovy supports plain script
Answer: True
Question 26: A Groovy string is referred as Gstring.
Answer: True
Question 27: What will be the output for the following code? def example = 1..100 println(example.getTo())
Answer: 100
Question 28: Which block of code will always be executed, even if an exception does not occur?
Answer: finally block
Question 29: Expandoclass in Groovy are inherited by default
Answer: False
Question 30: What will be the output for the following code? def employee = ['sam', 'peter', 'ram', 'priya'] assert animals.find {it in ['sam', 'ram', 'vijay'] }
Answer: ['sam', 'ram', 'vijay']
Question 31: We cannot overload Operators in Groovy.
Answer: False
Question 32: Groovy can be used as a scripting language.
Answer: True
Question 33: What will be output for the following code? class Sample { static void main(String[] args) { def samplelist = [101,102,103,104,105] println(lst.pop()) println(lst) } }
Answer: [101,102,103,104]
Question 34: Which class is used to create an XML document
Answer: XML Markup Builder
Question 35: Which of the following is Gstring?
Answer: "Hello World"
Question 36: In while statement, the statement would be executed first and the condition would be evaluated next.
Answer: False
Question 37: Groovy Unit Testing affects the production in run time.
Answer: False
Question 38: The method collectEntries is used to
Answer: covert a map to a list
Question 39: Automatic Resource Management or ARM block from java 7 are supported in Groovy.
Answer: False
Post a comment
Get your FREE PDF on "100 Ways to Try ChatGPT Today"
Generating link, please wait for: 60 seconds
Comments
Join the conversation and share your thoughts! Leave the first comment.