Tuesday , February 27 2024
Breaking News

Using R with Databases Cognitive Class Exam Quiz Answers

Using R with Databases Cognitive Class Certification Answers

Using R with Databases Cognitive Class Exam Quiz Answers

Question 1: What is the equivelent RDBMS concept for R dataframes?

  • schema
  • row (tuple)
  • table (relation)
  • column (attribute)
  • database

Question 2: Is this statement true or false: Character data in R will be mapped to either a fixed sized CHARACTER column or a variable size VARCHAR column in a database.

  • False
  • True

Question 3: Select all the valid reasons for using R with relational databases:

  • relational databases can manipulate large datasets
  • R can retrieve dataframes that are stored in binary formats
  • observations in dataframes can be changed dynamically by R
  • relational databases provide concurrent access to data
  • access to data can be managed using SQL GRANT and REVOKE statements

Question 1: Which statement best describes the odbcGetInfo() function:

  • queries data from a relational database into an R dataframe
  • provides similar information to the sqlColumns() function
  • returns details about the database server you have established your connection with and ODBC conformance level
  • limits the results to only certain types of tables or table object names
  • all of the above

Question 2: True or False: ODBC consists of 2 components: an ODBC Driver Manager and one or more ODBC Drivers.

  • False
  • True

Question 3: Which of the following statements about RODBC are true (select all that apply)

  • The odbcDataSources() function returns a character vector of DSNs.
  • The odbcDriverConnect() function can be used to create a direct connection to a database without a registered Data Source Name or DSN.
  • The sqlTables() function will return a dataframe of tables, views, or other table-like objects from the database server.
  • A database connection can be established using the odbcConnect() or odbcDriverConnect() functions.
  • The odbcConnect() function requires a special connection string that includes the database driver, database name and hostname.

Question 1: Which statement best describes the RODBC sqlFetch() function?

  • returns all of the columns from a relational table
  • returns all of the tables from a relational database
  • returns all of the rows from a relational table
  • returns all the data from a dataframe
  • none of the above

Question 2: The LOAD command logs each transactions and stores the data very quickly on disk.

  • False
  • True

Question 3: Which functions can be used to create dataframes in R (select all that apply)

  • sqlQuery()
  • sqlClear()
  • sqlCreate()
  • sqlFetch()
  • sqlUpdate()

Question 1: Which of the following statements is false?

  • sqlSave() function can be used to append new rows to an existing table.
  • SQL UPDATE statements and the sqlQuery() can be used to modify data in database tables.
  • sqlUpdate() function can be used to insert new rows in a table.
  • sqlSave() function can store the modified dataframe in a new database table.
  • sqlUpdate() function can be used to push the updated data to existing rows in existing tables.

Question 2: True or False: The sqlCreate() function in RODBC can be used to create a table and store the data from the data frame into the newly created table with the same column names as the dataframe.

  • False
  • True

Question 3: Select all the statements that are true:

  • The sqlQuery() function can be used to modify data in database table.
  • The sqlSave() function stores the modified database data in an existing or new R dataframe.
  • As an alternative, SQL UPDATE statements can be used to modify data in a dataframe.
  • The update in place operation can be performed using the sqlUpdate() function in RODBC.
  • The sqlUpdate() function can be used to push the updated data to the table where it originally came from.

Question 1: Which statement best describes in-database analytics?

  • in-database analytics moves the data into a database before performing data analysis on it
  • in-data base analytics requires ibmdbR and dashDB to perform data analysis
  • in-database analytics processes the data and performing analysis within the database where the data is stored
  • in-database analytics refers to data analysis on data that must be retrieved from a database
  • in-database analytics retrieves data from a database and performs data analysis on private or public clouds

Question 2: Is this statement true or false: dashdb has built-in support for R execution without the use of built-in analytic functions and tools

  • False
  • True

Question 3: Which statements describe ibmdbR? (Select all that apply)

  • ibmdbR provides methods to read, write, and sample data from a dashDB database
  • ibmdbR provides access methods for in-database analytic functions and functions for storing R objects
  • ibmdbR is hybrid data warehouse that can be deployed on public or private clouds for in-database analyltics
  • ibmdbR is an R function for processing data and performing analysis
  • ibmdbR is an open-source library for use in R runtimes such as Jupyter notebooks or R Studio

Question 1: Which R concept maps to an RDBMS database?

  • table
  • none
  • column (attribute)
  • row (tuple)
  • schema

Question 2: R has difficulty with which of the following. Choose all that are applicable.

  • manipulating large datasets
  • performing data analysis
  • performing data visualization
  • providing concurrent access to data
  • persistence, i.e., updating or changing observations within a data frame without first loading the data into R and then recreating the data file on disk

Question 3: Which R concept maps to an RDBMS row or tuple?

  • table
  • none
  • observation
  • variable
  • schema

Question 4: True or False? RJDBC does not support substitution of arguments in SQL statements

  • False
  • True

Question 5: Which function returns platform details about numeric types and limits?

  • odbcGetInfo()
  • sqlTables()
  • R .Machine
  • sqlColumns()
  • odbcDataSources()

Question 6: Which of the following statements are true? Choose all that are applicable.

  • The saveRDS() and readRDS() functions can be used to store and retrieve a single R object, respectively
  • The save.image() function preserves all of the images in your current R workspace.
  • The save() function persists single objects in R dataframes.
  • Character data in R will be mapped to either a fixed sized CHARACTER column or a variable size VARCHAR column in a database.
  • R can retrieve dataframes that are stored in binary format

Question 7: Which function can be used to call stored procedures from R?

  • sqlSelect()
  • sqlRQuery()
  • sqlQuery()
  • sqlStoredProc()
  • none of the above

Question 8: True or False? RJDBC is a package implementing a DBI in R on the basis of JDBC.

  • False
  • True

Question 9: To preserve the integrity of the data as it is analyzed using R, as the data is queried from a relational database into an R dataframe it is important to understand the data types used to store the data in the database. Which of the following commands, statements, or functions provides the column names, data types, precision/size, and whether or not null values are allowed? (select all that apply)

  • DESCRIBE command
  • odbcGetInfo() function
  • odbcGetTypeInfo() function
  • sqlColumns() function
  • SQL SELECT statement

Question 10: True or False. There are optional parameters available with the sqlTables() function to limit the results to only certain types of tables or table object names can be limited using wildcard characters.

  • False
  • True

Question 11: Commonly used visualization for database modelling involves the use of:

  • Logical models
  • Physical models
  • Entity- Relationship or ER diagrams
  • Database schemas
  • Flowchart diagrams

Question 12: Which statement is false?

  • OUTPUT parameters cannot be returned from a stored procedure using RODBC, however result set can be returned.
  • The sqlUpdate() function can be used to push the updated data to the R dataframe where it originally came from.
  • Stored procedures are valuable tools for performing analysis on data that is stored in a relational database server and they can be used to dramatically reduce the time required to perform data intensive tasks as they execute on the database server itself.
  • The sqlUpdate() function can be used to modify data in a database from R, even if not not recommended.
  • It is recommended to set the errors parameter to false and check for a -1 return value to properly handle any errors.

Question 13: Which statements describe stored procedures? Choose all that are applicable.

  • stored procedures are data-centric code modules that are stored and executed on the database server
  • stored procedures must be coded only by experienced DBAs
  • stored procedures do not allow dynamic parameters
  • stored procedures can be created using one of many different stored procedure languages
  • stored procedures eliminate network traffic delay because processing is performed on the database server

Question 14: True or False. A full-table select can be accomplished using the sqlFetch() function. The function will dynamically create a dataframe and populate it with the data from the database server.

  • False
  • True

Question 15: Which statements are true about in-database analytics? Choose all that are applicable.

  • in-database analytics involves processing of data and performing analysis in the analytic application itself
  • IBM dashDB supports in-database analytics with R
  • In-database Analytics refers to processing the data and performing of analysis within the database itself, where data is stored
  • ibmdbR is an open-source R library that facilitates in-database analytics from ibm databases like dashDB
  • in-database analytics reduces network traffic and data movement because analytics processing is performed on the database server

Introduction to Using R with Databases

Using R with databases is a common scenario, especially when dealing with large datasets and the need to perform data analysis, manipulation, and visualization. R provides various packages and tools for connecting to and querying databases. Below are the steps and considerations for using R with databases:

1. Install Relevant R Packages:

  • Install the necessary R packages for database connectivity. Common packages include:
    • DBI: The Database Interface (DBI) package provides a common interface for interacting with different database management systems (DBMS).
    • RMySQL, RPostgreSQL, RSQLite: Specific packages for MySQL, PostgreSQL, and SQLite databases, respectively.

2. Load Required Packages:

  • Load the installed packages into your R environment using the library() function.

3. Establish Database Connection:

  • Connect to the database using the appropriate driver and connection details.

4. Querying the Database:

  • Execute SQL queries on the database using the dbGetQuery() function.

5. Data Manipulation and Analysis:

  • Once data is fetched into R, you can use R’s data manipulation and analysis capabilities to explore and analyze the data.

6. Parameterized Queries:

  • For security and efficiency, use parameterized queries to handle dynamic input values.

7. Writing Data to the Database:

  • Use the dbWriteTable() function to write data frames or tables to the database.

8. Closing the Connection:

  • Always close the database connection when you’re done to free up resources.

9. Handling Transactions:

  • If you need to execute a series of queries as a single transaction, you can use the dbBegin() and dbCommit() functions.

Adjust the code according to the specific database management system you are working with (e.g., PostgreSQL, SQLite). Understanding the intricacies of your database system and its interaction with R can enhance your ability to perform efficient and effective data analysis.

About Clear My Certification

Check Also

Controlling Hadoop Jobs using Oozie Cognitive Class Exam Quiz Answers

Controlling Hadoop Jobs using Oozie Cognitive Class Exam Quiz Answers

Enroll Here: Controlling Hadoop Jobs using Oozie Cognitive Class Exam Quiz Answers Controlling Hadoop Jobs …

Leave a Reply

Your email address will not be published. Required fields are marked *