Monday , June 17 2024
Breaking News

Using R with Databases Cognitive Class Exam Quiz Answers

Using R with Databases Cognitive Class Certification 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 can significantly enhance your data analysis capabilities, allowing you to efficiently handle large datasets stored in various database management systems (DBMS). Here’s an introduction to getting started with R and databases:

  1. Understanding the Basics:
    • R Programming Language: R is a powerful open-source programming language and environment for statistical computing and graphics. It provides extensive libraries for data manipulation, analysis, and visualization.
    • Databases: A database is an organized collection of data, typically stored and accessed electronically from a computer system. Common types of databases include relational databases (e.g., MySQL, PostgreSQL, SQLite) and NoSQL databases (e.g., MongoDB, Cassandra).
  2. Why Use R with Databases?:
    • Efficiency: R can efficiently handle large datasets stored in databases without loading them entirely into memory.
    • Data Integrity: Working directly with databases ensures data integrity and security.
    • Integration: Seamless integration with various database systems allows for streamlined data manipulation and analysis workflows.
  3. R Packages for Database Connectivity:
    • RMySQL/RPostgreSQL/RSQLite: These packages provide interfaces to MySQL, PostgreSQL, and SQLite databases, respectively.
    • RODBC: This package enables connectivity to any ODBC-compliant database, including Microsoft SQL Server, Oracle, and others.
    • DBI: The Database Interface (DBI) package provides a common interface for connecting to various database systems, allowing you to write code that is independent of the underlying DBMS.
  4. Connecting to a Database:
    • Use functions provided by the respective packages to establish a connection to your database server.
    • Provide connection details such as server address, port, username, password, and database name.
  5. Executing SQL Queries:
    • Once connected, you can execute SQL queries directly from R using functions like dbSendQuery() or dbExecute() (depending on the package).
    • Retrieve query results using functions like dbFetch() or dbGetQuery().
  6. Data Manipulation:
    • Perform data manipulation operations directly within the database using SQL commands or execute R code on data retrieved from the database.
    • Utilize functions like dbWriteTable() to write R data frames into database tables.
  7. Best Practices:
    • Optimize queries for performance, especially when dealing with large datasets.
    • Handle database connections efficiently to avoid resource leaks.
    • Consider security implications, such as parameterized queries to prevent SQL injection attacks.
  8. Example Workflow:
    • Connect to a database.
    • Retrieve data using SQL queries.
    • Perform data analysis and visualization in R.
    • Optionally, write results back to the database.

By leveraging the power of R and databases together, you can efficiently manage, analyze, and visualize large datasets, making it a valuable skill for data scientists, analysts, and researchers.

About Clear My Certification

Check Also

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 *