Groovy Quiz 14 | Strings | Part 3


Reference video | Groovy Playground


1 Point for every correct answer | Let’s Get Started

Please enter your email:

1.

Guess the output

def str = "Raghav "
print str*3
 
 
 
 

2.

print "Automation".equals("Automation")

 
 

3.

print "Automation".equalsIgnoreCase("automation")

 
 

4.

//slashy strings
def str1 = /a green sky/
println str1

//dollar slashy strings
def str2 = $/a blue tree/$
println str2
 
 
 

5.

Interpolation or referring variables

def name = "Groovy"
//slashy strings
def str1 = /a green sky $name/
println str1

//dollar slashy strings
def str2 = $/a blue tree $name/$
println str2
 
 
 

6.

New line

def name = "Groovy"
def str1 = /a green sky 
$name/
println str1

def str2 = $/a blue tree 
$name/$
println str2
 
 

7.

def str1 = "My name is "Raghav""
println str1
 
 

8.

def str1 = "My name is \"Raghav\""
println str1
 
 
 

9.

Using slashy strings to print a word inside quotes ” “

def str1 = /My name is "Raghav"/
println str1
 
 
 

7