# Google Apps Script Quiz 5

Which of the following is not a data type in Google Sheets?
What function can be used to count the number of cells in a range that meet a specific condition?
What is the syntax for a FOR loop in Apps Script?
Which of the following methods can be used to add a new sheet to a Google Sheets spreadsheet?
Which of the following methods can be used to get the value of a cell in a Google Sheets spreadsheet?

# Which of the following is not a data type in Google Sheets?

a. String

b. Integer

c. Boolean

d. Double

Solution: b. Integer. Google Sheets does not have a data type specifically for integers. Numeric values are stored as floating point numbers, which can include decimals.

Explanation: Google Sheets supports several data types, including strings (text), numbers (integers and decimals), booleans (true/false values), dates, and times.

# What function can be used to count the number of cells in a range that meet a specific condition?

a. COUNT

b. COUNTA

c. COUNTIF

d. SUMIF

Solution: c. COUNTIF. The COUNTIF function allows you to count the number of cells in a range that meet a specific condition.

Explanation: The COUNT function counts the number of cells in a range that contain numerical values. The COUNTA function counts the number of cells in a range that are not empty. The SUMIF function adds up the values in a range that meet a specific condition.

# What is the syntax for a FOR loop in Apps Script?

a. for (var i = 0; i < 10; i++)

b. for i = 0 to 10

c. for (i = 0; i <= 10; i++)

d. for (i = 0; i < 10; i++)

Solution: d. for (i = 0; i < 10; i++). This is the correct syntax for a FOR loop in Apps Script.

Explanation: A FOR loop is used to execute a block of code a specified number of times. The syntax for a FOR loop in Apps Script is similar to other programming languages: for (initialization; condition; increment) { code to be executed }.

# Which of the following methods can be used to add a new sheet to a Google Sheets spreadsheet?

b. createSheet()

c. insertSheet()

d. all of the above

Solution: d. all of the above. All three of these methods can be used to add a new sheet to a Google Sheets spreadsheet.

Explanation: The addSheet() method adds a new sheet at the end of the spreadsheet. The createSheet() method adds a new sheet at a specific index, and can also set the sheet name and properties. The insertSheet() method adds a new sheet at a specific location, such as before or after an existing sheet.

# Which of the following methods can be used to get the value of a cell in a Google Sheets spreadsheet?

a. getCell()

b. getValue()

c. getRange()

d. all of the above

Solution: b. getValue(). The getValue() method can be used to get the value of a single cell in a Google Sheets spreadsheet.

Explanation: The getCell() method returns a Range object that represents a single cell. The getRange() method returns a Range object that represents a range of cells. The getValue() method can be used with either a single cell or a range of cells to get the value of the cell or cells.