DSR301m (FPTU - AI) Flashcards - Quizlet
DSR301m (FPTU - AI) Flashcards - Quizlet
Save
Which of the following are examples of predictive analysis? Pandemic trends prediction.
Select two answers. Understanding human languages.
A: Dashboards.
B: Pandemic trends prediction.
C: Returning a summary of descriptive statistics for data.
D: Understanding human languages.
Which of the following statements about numeric and integer The converted value of an integer to a numeric is always equal to the original integer value.
values are true? Select three values. A numeric value can be converted to an integer.
A: The converted value of a numeric to an integer is always An integer can be converted to a numeric value.
equal to the original numeric value.
B: The converted value of an integer to a numeric is always
equal to the original integer value.
C: A numeric value can be converted to an integer.
D: An integer can be converted to a numeric value.
In RStudio, which of the following statements about writing You write code in the Console when you want to try out R commands or to run a few lines of code.
code in the File Editor and the Console are true? Select two You write code, usually for multiple lines of code, in the File Editor and execute them in batch mode.
answers.
A: Only files containing R code can be edited in the File Editor
B: You write code in the Console when you want to try out R
commands or to run a few lines of code.
C: You write code, usually for multiple lines of code, in the File
Editor and execute them in batch mode.
D: Code in the File Editor executes immediately as you type it so
you can see the results quickly.
R can perform several forms of statistical computation. What is Testing if the mean values of two groups are statistically different.
an example of hypothesis testing?
A: Inferring an unknown mean value of a population from its
samples.
B: Compute and visualize a correlation matrix among four
different variables to see if they are correlated.
C: Obtaining a representative subset of data.
D: Testing if the mean values of two groups are statistically
different.
Which of the following data type conversions may be not character (like `1`, `A`, or `test`) to numeric
allowed in R?
A: logical (like TRUE or FALSE) to numeric
B: integer (like 1L or 2L) to numeric
C: character (like `1`, `A`, or `test`) to numeric
D: numeric (like 1 or 2) to integer
What is the result of the R expression 100 * (5 - 3)? 200
A: 200
B: 497
C: 500
D: 503
After you write code in an R script file or the R Console, what R Interpreter
component of the R environment parses the code into objects in
memory?
A: R data files
B: R variables, functions, and datasets
C: R Workspace
D: R Interpreter
Which features of RStudio help facilitate code writing? Select Code auto completion
two answers. Syntax highlighting
A: Code auto completion
B: File Explorer
C: Syntax highlighting
D: Workspace visualization
True or False: Execution order does not matter when executing False
cells in a Jupyter notebook
A: True
B: False
What is the difference between the expression c(1, 2, 3, 4, 5) and They both produce a vector with five numbers but the first is in ascending order and the second is in descending order.
the expression c(5:1)?
A: The two expressions produce the same result.
B: They both produce a vector with five numbers but the first is
in ascending order and the second is in descending order.
C: They both produce a factor with five numbers but the first is in
ascending order and the second is in descending order.
D: One produces a factor and the other produces a vector.
Assume that the variable test_result contains the vector c(25, 35, [1] 25 35 40
40, 50, 75). What is the result of the expression
test_result[test_result < 50]?
A: [1] 25 35 40
B: [1] TRUE TRUE TRUE FALSE FALSE
C: [1] TRUE TRUE TRUE TRUE FALSE
D: [1] 25 35 40 50
What is the main difference between a list and a vector? A list can contain different types of data, while a vector may only contain one type of data.
A: A list is a multi-dimensional array of values, while a vector is a
single dimensional array of values.
B: It is not possible to add or remove items from a list, but you
can do this with a vector.
C: A list can contain different types of data, while a vector may
only contain one type of data.
D: A list can contain nominal or ordinal values, while a vector
cannot.
What are three types of data you can store in an array or matrix? Numeric valus
Select three answers. Strings
A: Numeric valus Integers
B: Strings
C: Vectors
D: Integers
Assume that the variable test_result contains the vector c(25, 35, 45
40, 50, 75).What is the result of the expression mean(test_result)?
A: 45
B: 40
C: 50
D: 35
Assume you have variable called employee that contains the employee["age"] <- 35
expression list(name = "Juan", age = 30). What is the correct
command to change the contents of the age item to 35?
A: employee["age"] <- 35
B: employee[age] = 35
C: employee[age] <- 35
D: employee["age"] == 35
What is the main difference between a matrix and an array? A matrix must be two dimensional, but an array can be single, two dimensional, or more than two dimensional.
A: A matrix must be two dimensional, but an array can be single,
two dimensional, or more than two dimensional.
B: A matrix can contain multiple types of data, but an array can
only contain data of the same type.
C: A matrix can contain vectors, but an array can only contain
strings, characters, or integers.
D: A matrix can be arranged by rows or columns, but an array is
always arranged by columns.
Assume that you have a data frame called employee that employee$title
contains three variables: name, age, and title. If you want to
return all the values in the title variable, what command should
you use?
A: employee$title
B: employee.title
C: employee[[3]]
D: employee[title]
Which looping statement should you use if you want to continue While loop
to perform an operation if the value of an expression is true?
A: Do While loop
B: For Each loop
C: For loop
D: While loop
What happens if a user-defined function is missing the return The function returns the last evaluated expression in the function.
statement?
A: The function returns an error.
B: The function returns the last evaluated expression in the
function.
C: The function returns a NULL value.
D: The function returns the first evaluated expression it
encounters and then immediately exits the function.
Assume you have a variable called word_string that contains the chartr()
string "The quick red fox jumped over the lazy dog." Which
function can you use to replace the word "dog" with the word
"cat" in the word_string variable?
A: strsplit()
B: substr()
C: nchar()
D: chartr()
Which of the following statements about regular expressions are Regular expressions are primarily used for data extraction.
true? Select two answers. Regular expressions are used to match patterns in strings and text.
A: Regular expressions are primarily used for data extraction.
B: Regular expressions evaluate a condition to determine if it is
true or false.
C: Regular expressions perform mathematical operations on
numeric values.
D: Regular expressions are used to match patterns in strings and
text.
How do you convert a UNIX date/time format to an R Date Pass the UNIX date/time value to the as.POSIXct() function and then pass that value to the as.Date() function.
object?
A: Pass the UNIX date/time value to the as.POSIXct() function
and then pass that value to the as.Date() function.
B: Pass the UNIX date/time value to the is.Date() function.
C: Pass the UNIX date/time value to the as.Date() function.
D: Pass the UNIX date/time value to the as.POSIXct() function
and then pass that value to the is.Date() function.
What type of statement should you add to your code if you A tryCatch statement.
know that an error or warning might occur?
A: A tryError statement.
B: Incorrect distractor
C: A tryCatch statement.
D: A catchError statement.
How do you define a global variable in a function? Use the <<- assignment operator.
A: Use the -> assignment operator.
B: Use the <- assignment operator.
C: Use the <<- assignment operator.
D: Use the == assignment operator.
When you convert a date in string format to a Date object, what The string containing the date.
information do you need to pass to the as.Date() function? The date format of the string.
Select two answers.
A: The string containing the date.
B: The UNIX format of the string.
C: The number of days since January 1, 1970.
D: The date format of the string.
What is the difference between an error and a warning in you R An error halts code execution, while a warning does not.
code?
A: An error halts code execution, while a warning does not.
B: A warning halts code execution, while an error does not.
C: You can catch a warning, but you cannot catch an error.
D: You can catch an error, but you cannot catch a warning.
What is the purpose of the readLines() function? Reads each text line (ending with a line break) in a text file and returns a character vector.
A: Reads each text line (with a line break) in a text file and
returns a data frame.
B: Reads each text line (with a line break) in a text file and
returns a character variable.
C: Reads each text line (ending with a line break) in a text file
and returns a character vector.
D: Reads each text line (ending with a line break) in a text file
and returns a character factor.
Which data structure is more suitable to be exported into a text String or characters
file rather than a .csv or Excel file?
A: String or characters
B: Matrices
C: Data frames
D: Datasets
Complete the sentence: In an HTML page, if the <head> and Sibling nodes
<body> nodes have the same parent, <html>, they are said to be
___________________ to each other.
A: Sibling nodes
B: Nested nodes
C: Root nodes
D: Child nodes
Assume you have read a .csv file into a data frame variable employee[5, c("name", "title")]
called employee. It has 20 rows of data and three variables:
name, age, and title. What is the correct statement to use to
return the fifth row of data in the name and title columns?
A: employee[c("name", "title"), 5]
B: employee[5, c("name", "title")]
C: employee[5, 2:3]
D: employee[2:3, 1:5]
How do you return the number of characters in each paragraph Use the nchar() function.
of a text file that has been read into a character vector?
A: Use the file.size() function.
B: Use the length() function.
C: Use the nchar() function.
D: Use the scan() function.
After reading an HTML page from a URL, what must you do to Use the html_node() function to return the <body> as a child node of <html> node.
get the <body> node from the root <html> node?
A: Use the html_text() function to return the <html> node.
B: Use the html_text() function to return the <body> node of the
HTML.
C: Use the html_node() function to return the <body> as a child
node of <html> node.
D: Use the html_node() function to return the <html> node.
Which of the following is a typical way that developers use the R Predictive analysis
language?
A: Systems programming
B: Web page interactivity
C: Video game development
D: Predictive analysis
One movie is 150 minutes long, and another is 90 minutes long. (150 - 90) \* 60
Using R, which of the following commands would correctly
calculate the difference in length, in seconds, between the two
films?
A: 150 - (90 \* 60)
B: (150 - 90 \*60)
C: (150 - 90) \* 60
D: 150 - 90 \* 60
In R, assume you have a vector named "age," and each element sort(age)
in the vector is the age of one person in a group. Which
command must you use to reorder the ages from youngest to
oldest?
A: rank(age)
B: order(age)
C: call(age)
D: sort(age)
Assume the array books_array contains 6 elements. The array has "It" "Misery" "The Shining"
three rows and two columns and appears as follows:
[,1] [,2] [1,] "It" "Dr. Sleep" [2,] "Misery" "Carrie" [3,] "The Shining"
"The Mist"
If you input the books_array[,1] command, what will be the
output?
A: "It" "Misery" "The Shining"
B: "The Shining"
C: "It" "Dr.Sleep"
D: "It"
In R, which command should you use to insert a new row into a rbind
data frame?
A: rbind
B: tail
C: integrate
D: head
What is the first step you must take before you can read an Install the readxl library.
Excel spreadsheet in R?
A: Run the c function.
B: Install the readxl library.
C: Run the read_excel function.
D: Convert the spreadsheet's dataset.
After installing and calling the httr library in R, which command GET("https://www.google.com/")
can you use to request information about
https://www.google.com?
A: PUT("https://www.google.com/")
B: BROWSE("https://www.google.com/")
C: GET("https://www.google.com/")
D: PATCH("https://www.google.com/")
Which of the following statements are correct about databases? All of the above
A: There are different types of databases - Relational,
Hierarchical, No SQL, etc.
B: A database is a repository of data
C: All of the above
D: A database can be populated with data and be queried
You are working on a Film database, with a FilmLocations table. A WHERE clause to limit the results to films released in 2019.
You want to retrieve a list of films that were released in 2019.You
run the following query but find that all the films in the
FilmLocations table are listed.
SELECT Title,ReleaseYear, Locations FROMFilmLocations;
What is missing?
A: Nothing, the query is correct.
B: A WHERE clause to limit the results to films released in 2019.
C: A LIMIT clause to limit the results to films released in 2019.
D: A DINSTINCT clause to specify a distinct year.
Which of the following statements would you use to add a new INSERT INTO Instructor(ins_id, lastname, firstname, city, country)
instructor to the Instructor table. VALUES(4, 'Doe', 'John', 'Sydney', 'AU');
A: SELECT Instructor(ins_id, lastname, firstname, city, country)
FROM VALUES(4, 'Doe', 'John', 'Sydney', 'AU');
B: INSERT INTO Instructor(ins_id, lastname, firstname, city,
country)
VALUES(4, 'Doe', 'John', 'Sydney', 'AU');
C: ADD INTO Instructor(ins_id, lastname, firstname, city, country)
VALUES(4, 'Doe', 'John', 'Sydney', 'AU');
D: UPDATE Instructor(ins_id, lastname, firstname, city, country)
WITH VALUES(4, 'Doe', 'John', 'Sydney', 'AU');
What is the function of a WHERE clause in an UPDATE A WHERE clause enables you to specify which rows will be updated.
statement?
A: A WHERE clause enables you to specify a new table to
receive the updates.
B: A WHERE clause is never used with an UPDATE statement.
C: A WHERE clause enables you to specify which rows will be
updated.
D: A WHERE clause enables you to list the column and data to
be updated.
True or False: The SELECT statement is called a query, and the True
output we get from executing the query is called a result set.
A: True
B: False
Which of the following SQL statements will delete the authors DELETE FROM AUTHOR WHERE AUTHOR_ID IN ('A10', 'A11')
with IDs of A10 and A11?
A: DELETE FROM AUTHOR WHERE AUTHOR_ID IS ('A10', 'A11')
B: DELETE FROM AUTHOR WHERE AUTHOR_ID IN ('A10', 'A11')
C: DELETE ('A10', 'A11') FROM AUTHOR
D: D: DELETE AUTHOR_ID IS ('A10', 'A11') FROM AUTHOR
What is the function of a primary key? The primary key uniquely identifies each row in a table.
A: The primary key is used to identify any rows in the table that
contain NULL values.
B: The primary key is used to grant access to a table.
C: The primary key enables you to add data to columns.
D: The primary key uniquely identifies each row in a table.
Data Definition Language (or DDL) statements are used to CREATE, ALTER, DROP
define, change, or delete database objects such as tables.
Which of the following statements are all DDL statements?
A: SELECT, INSERT, UPDATE
B: CREATE, ALTER, DROP
C: INSERT and UPDATE
D: SELECT and DELETE
Which of the following queries will change the data type of an ALTER TABLE author ALTER COLUMN phone SET DATA TYPE VARCHAR(20);
existing column (phone) to the varchar data type?
A: ALTER TABLE author ALTER COLUMN phone SET DATA TYPE
VARCHAR(20);
B: ALTER TABLE author ALTER COLUMN phone DATA TYPE =
VARCHAR(20);
C: ALTER COLUMN phone SET DATA TYPE VARCHAR(20);
D: ALTER TABLE author ALTER COLUMN phone SET TYPE
VARCHAR(20);
The five basic SQL commands are: CREATE, SELECT, INSERT, UPDATE, DELETE
A: CREATE, INSERT, RETRIEVE, MODIFY, DELETE
B: None of the above
C: SELECT, COPY, PASTE, INSERT, ALTER
D: CREATE, SELECT, INSERT, UPDATE, DELETE
Which of the following statements about a database is/are A database is a logically coherent collection of data with some inherent meaning
correct?
A: A database is a logically coherent collection of data with
some inherent meaning
B: Data can only be added and queried from a database, but not
modified.
C: Only SQL can be used to query data in a database.
D: All of the above
What are the basic categories of the SQL language based on Both of the above
functionality?
A: Data Definition Language
B: Data Manipulation Language
C: Both of the above
D: None of the above
You want to retrieve a list of authors from Australia, Canada, and SELECT * FROM Author WHERE Country IN ('Australia', 'Canada', 'India');
India from the table Authors. Which SQL statement is correct?
A: SELECT * FROM Author WHERE Country LIST ('CA', 'IN');
B: SELECT * FROM Author IF Country ('Australia', 'Canada',
'India');
C: SELECT * FROM Author WHERE Country BETWEEN('Australia',
'Canada', 'India');
D: SELECT * FROM Author WHERE Country IN ('Australia',
'Canada', 'India');
You want to retrieve a list of books priced above $10 and below SELECT Title, Price FROM Book WHERE Price BETWEEN 10 and 25;
$25 from the table Book. What are the two ways you can specify SELECT Title, Price FROM Book WHERE Price >= 10 and Price <= 25;
the range?
A: SELECT Title, Price FROM Book WHERE Price BETWEEN 10
and 25;
B: SELECT Title, Price FROM Book WHERE Price 10 to 25;
C: SELECT Title, Price FROM Book WHERE Price IN (10, 25);
D: SELECT Title, Price FROM Book WHERE Price >= 10 and Price
<= 25;
You want to retrieve Salary information for an employee called WHERE Firstname = 'Ed';
Ed from the Employee table. You write the following statement:
SELECT Firstname, Lastname, Salary FROM Employees
You see all the employees listed, and it's hard to find Ed's
information. Which clause should you add to reduce the number
of rows returned?
A: ORDER BY Firstname;
B: GROUP BY Firstname = 'Ed';
C: WHERE Firstname = 'Ed';
D: WHERE Employees = 'Ed';
You want to select author's last name from a table, but you only SELECT lastname from author where lastname like 'B%'
remember the author's last name starts with the letter B, which
string pattern can you use?
A: SELECT lastname from author where lastname like 'B#'
B: SELECT lastname from author where lastname like 'B%'
C: SELECT lastname from author where lastname like 'B$'
D: None of the above
In a SELECT statement, which SQL clause controls how the result ORDER BY clause
set is displayed?
A: ORDER BY clause
B: ORDER IN clause
C: ORDER WITH clause
Which of the following can be used in a SELECT statement to All of the above
restrict a result set?
A: HAVING
B: WHERE
C: DISTINCT
D: All of the above
When querying a table called Author that contains a list of SELECT Country, count(Country) FROM Author GROUP BY Country
authors and their country of residence, which of the following
queries will return the number of authors from each country?
A: SELECT Country, count(Country) FROM Author GROUP BY
Country
B: SELECT Distinct(Country) FROM Author
C: SELECT Country, count(Country) FROM Author
D: SELECT Country, distinct(Country) FROM Author GROUP BY
Country
You want to retrieve a list of books that have between 450 and WHERE Pages >= 450 and pages <= 600
600 pages. Which clause would you add to the following SQL
statement:
Which of the following SQL queries would return the day of the SELECT DAYOFWEEK(RescueDate) From PetRescue WHERE Animal = 'Dog';
week each dog was rescued?
A: SELECT DAYOFWEEK(RescueDate) From PetRescue WHERE
Animal = 'Dog';
B: SELECT DAYOFWEEK(RescueDate) From PetRescue;
C: SELECT RescueDate From PetRescue WHERE Animal = 'Dog';
D: SELECT DAY(RescueDate) From PetRescue WHERE Animal =
'Dog';
Which of the following queries will return the employees who SELECT * FROM Employees WHERE Salary < (SELECT AVG(Salary) FROM Employees);
earn less than the average salary?
A: SELECT * FROM Employees WHERE Salary < (SELECT
AVG(Salary))
B: SELECT AVG(Salary) FROM Employees WHERE Salary <
AVG(Salary)
C: SELECT * FROM Employees WHERE Salary < AVG(Salary)
D: SELECT * FROM Employees WHERE Salary < (SELECT
AVG(Salary) FROM Employees);
What are the three ways to work with multiple tables in the same Sub-queries, Implicit joins, JOIN operators
query?
A: Built-in functions, implicit joins, JOIN operators
B: Sub-queries, Implicit joins, normalization.
C: Sub-queries, APPEND, JOIN operators
D: Sub-queries, Implicit joins, JOIN operators
Which of the following will retrieve the LOWEST value of SELECT MIN(SALARY) FROM EMPLOYEES
SALARY in a table called EMPLOYEES?
A: SELECT MAX(SALARY) FROM EMPLOYEES
B: SELECT LOWEST(SALARY) FROM EMPLOYER
C: SELECT SALARY FROM EMPLOYEES WHERE
MINIMUM(SALARY) = SALARY
D: SELECT MIN(SALARY) FROM EMPLOYEES
Which of the following queries will return the first name of the SELECT FIRST_NAME FROM EMPLOYEES WHERE SALARY =
employee who earns the highest salary? ( SELECT MAX(SALARY) FROM EMPLOYEES )
A: SELECT FIRST_NAME FROM EMPLOYEES WHERE SALARY IS
HIGHEST
B: SELECT FIRST_NAME, MAX(SALARY) FROM EMPLOYEES
GROUP BY F_NAME
C: SELECT MAX(SALARY) FROM EMPLOYEES
D: SELECT FIRST_NAME FROM EMPLOYEES WHERE SALARY =
( SELECT MAX(SALARY) FROM EMPLOYEES )
Which of the following queries will return the data for SELECT * FROM EMPLOYEES WHERE DEP_ID =
employees who belong to the department with the highest ( SELECT MAX(DEPT_ID_DEP) FROM DEPARTMENTS )
value of department ID.
A: SELECT * FROM EMPLOYEES WHERE DEP_ID =
( SELECT DEPT_ID_DEP FROM DEPARTMENTS WHERE
DEPT_ID_DEP IS MAX )
B: SELECT * FROM EMPLOYEES WHERE DEP_ID = MAX(DEP_ID)
C: SELECT * FROM EMPLOYEES WHERE DEPT_ID_DEP =
MAX ( SELECT DEPT_ID_DEP FROM DEPARTMENTS )
D: SELECT * FROM EMPLOYEES WHERE DEP_ID =
( SELECT MAX(DEPT_ID_DEP) FROM DEPARTMENTS )
A DEPARTMENTS table contains DEP_NAME, and DEPT_ID_DEP SELECT D.F_NAME, E.DEP_NAME FROM EMPLOYEES E, DEPARTMENTS D WHERE DEPT_ID_DEP = DEP_ID
columns and an EMPLOYEES table contains columns called
F_NAME and DEP_ID. We want to retrieve the Department Name
for each Employee. Which of the following queries will correctly
accomplish this?
A: SELECT E.F_NAME, D.DEP_NAME FROM EMPLOYEES,
DEPARTMENTS
B: SELECT F_NAME, DEP_NAME FROM EMPLOYEES E,
DEPARTMENTS D WHERE E.DEPT_ID_DEP = D.DEP_ID
C: SELECT D.F_NAME, E.DEP_NAME FROM EMPLOYEES E,
DEPARTMENTS D WHERE DEPT_ID_DEP = DEP_ID
D: SELECT F_NAME, DEP_NAME FROM EMPLOYEES,
DEPARTMENTS WHERE DEPT_ID_DEP = DEP_ID
You are writing a query that will give you the total cost to the SELECT SUM(Cost) AS Total_Cost FROM PetRescue
Pet Rescue organization of rescuing animals. The cost of each
rescue is stored in the Cost column. You want the result column
to be called "Total_Cost". Which of the following SQL queries is
correct?
A: SELECT SUM(Cost) FROM PetRescue
B: SELECT SUM(Cost) AS Total_Cost FROM PetRescue
C: SELECT SUM(Total_Cost) From PetRescue
D: SELECT Total_Cost FROM PetRescue
How can a relational database help R handle memory issues? Running SQL queries in a relational database reduces memory demands in the R client.
A: Using a relational database increases memory use in R.
B: Using a relational database with R has no impact on memory.
C: Running SQL queries in a relational database reduces
memory demands in the R client.
D: Loading all the data from the relational database into a
dataframe reduces memory demands.
Which amongst the following is the simplest way to update Store the data in a relational database instead and make the updates there.
individual observations in a dataframe?
A: Convert the dataframe into a text file and make the changes
there.
B: There is no way to update individual observations directly in a
dataframe.
C: Store the data in a relational database instead and make the
updates there.
D: Make the updates in the dataframe and then store the results
in a binary format.