# Google Apps Script Quiz 1

What is the output of the following code snippet?
What is the output of the following code snippet?
What does the following code snippet do?
What is the output of the following code snippet?
What is the output of the following code snippet?
What does the following code snippet do?
What is the output of the following code snippet?
What is the correct way to create a new sheet in Google Sheets using Google Apps Script?
What does the following code snippet do?

# What is the output of the following code snippet?

var x = 10;

var y = “5”;

console.log(x + y);

a) 510

b) 15

c) 105

d) TypeError

Solution: b

# What is the output of the following code snippet?

function myFunction() {

var name = “John”;

Logger.log(name);

}

myFunction();

a) John

b) undefined

c) null

d) ReferenceError

Solution: a

# What does the following code snippet do?

return a + b;

}

a) multiplies two numbers

b) subtracts two numbers

d) divides two numbers

Solution: c

# What is the output of the following code snippet?

var x = 10;

var y = “5”;

console.log(x – y);

a) 5

b) 15

c) 105

d) TypeError

Solution: a

What is the correct way to define a function in Google Apps Script?

a) functionName = function() {}

b) function functionName() {}

c) functionName() = function() {}

d) None of the above

Solution: b

# What is the output of the following code snippet?

var x = 10;

var y = 5;

console.log(x * y);

a) 50

b) 5

c) 2

d) 15

Solution: a

# What does the following code snippet do?

function multiply(a, b) {

return a * b;

}

a) multiplies two numbers

b) subtracts two numbers

d) divides two numbers

Solution: a

# What is the output of the following code snippet?

var x = 10;

var y = 5;

console.log(x / y);

a) 2

b) 50

c) 5

d) 0.5

Solution: d

# What is the correct way to create a new sheet in Google Sheets using Google Apps Script?

a) var sheet = new Sheet();

d) None of the above

Solution: b

# What does the following code snippet do?

function myFunction() {

var x = 10;

var y = 5;

var z = x + y;

return z;

}

a) adds two numbers and returns the result

b) subtracts two numbers and returns the result

c) multiplies two numbers and returns the result

d) divides two numbers and returns the result

Solution: a