Groovy Quiz 3 | Variables


Reference video | Groovy Playground


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

1. What is the keyword used to define a variable

 
 
 

2. Keyword to print data on the console

 
 
 

3.

What will be the output of the following snippet

def name = "Raghav"
println "Name is "+name
 
 
 

4.

What will be the output of this snippet

def name = "Raghav"
println 'Name is ${name}'
println "Name is ${name}"
 
 
 

5.

Guess the output of

def name = "Raghav"
name = 10
print name
 
 
 

6.

Guess the output

def (a,b,c) = [10,20,30]
println a
println b
println c
 
 
 

7.

Guess the output

def (String a, int b, Double c) = [10,20,30]
println a
println b
println c
 
 
 

8.

Guess the output

def (String a, int b, Double c) = [10,20]
println a
println b
println c
 
 
 

9.

Guess the output

def (String a, int b) = [10,20,30]
println a
println b
 
 

10.

Guess the output

def x =10
def X = 20
println x
println X
 
 
 

23