Multiple Choice Question For Data Transfer between Files, SQL Database and Data frames Class 12 Informatics Practices (IP)
1. A CSV file can take _____ character as separator.
(a) ,
(b) ~
(c) |
(d) \t
(e) only (a)
(f) all of these
2. In order to work with CSV files from panda, you need to import _____ , other than pandas.
(a) .csv
(b) pandas.io
(c) newcsv
(d) no extra package required
3. The correct statement to read from a CSV file in a dataframe is :
(a) <DF>.read_csv(<file>)
(b) <File>.read_csv( )(<DF>)
(c) <DF> = pandas.read(<file>)
(d) <DF> = pandas.read_csv(<files>)
4 Which argument do you specify with read_csv() to specify a separator character?
(a) character
(b) char
(c) separator
(d) sep
5. To suppress first row as header, which of the following arguments is to be given in read_csv( )?
(a) noheader = True
(b) header = None
(c) skipheader = True
(d) header = Null
6. To read specific number of rows from a CSV file, which argument is to be given in read_csv( )?
(a) rows = <n>(b) nrows = <n>
(c) n_rows <n>
(d) number_rows = <n>
7. To skip first 5 rows of CSV file, which argument will you give in read_csv()?
(a) skiprows = 5
(b) skip_rows = 5
(c) skip = 5
(d) noread = 5
8. To skip 1st, 3rd, 5th and 7th row of CSV file, which argument will you give in read_csv()?
(a) skiprows = 1 | 3 | 5
(b) skiprows = [1, 5, 1]
(c) skiprows = [1, 3, 5]
(d) any of these
9. While reading from a CSV file, to use a column's values as index labels, argument given in read_CSV() is:
(a) index
(b) index_col
(c) index_values
(d) index_label
10. While writing a dataframe onto a CSV file, which argument would you use in to_sql() for NaN values' representation as NULL?
(a) NaN = NULL
(b) na_rep = NULL
(c) na_value = NULL
(d) na = NULL
11. Which of the following libraries let you establish a connection with a MySQL database from within Python
(a) mysql.connector
(b) Pymysql, sqlalchemy
(c) pandas
(d) numpy
12. In pandas.read_sql (<A>, <B>), <A> is
(a) connection name
(b) table name
(c) SQL query string
(d) database name
13. In pandas.read-sql (<A> <B>), <B> is
(a) connection name
(b) table name
(c) SQL query string
(d) database name
14. To suppress the creation of a column for index labels of a dataframe, _____ argument is specified in to sql().
(a) if_exists = False
(b) index = False
(c) index = True
(d) if exists = True
15. To append the content of dataframe in a table of MySQL, _____ argument is used in to_sql().
(a) if_exists = "Add"
(b) if_exists = "append"
(c) if_exists = Add
(d) if_exists = append
Thank you
ReplyDeleteWelcome 😊😊
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )