0% found this document useful (0 votes)
43 views12 pages

MCQ Unit 4

Uploaded by

legal1008data
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views12 pages

MCQ Unit 4

Uploaded by

legal1008data
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

303-Database Handling Using Python SYBCA SEM 3

MCQ : UNIT-4 Python Interaction with text and CSV


Que.1)____________ consists of an ordered collection of columns, each of which can contain a value of different
type (numeric, string, Boolean, etc.)
A. Series
B. Dataframe
C. Both A and B
D. None of the above
Ans.B

Que.2)With respect to Series object S what will be the output of S[0:4]?


A. Elements from 0 to 3 will be selected
B. Elements from 1 to 4 will be selected
C. Elements from 0 to 4 will be selected
D. Elements from 1 to 3 will be selected
Ans.A

Que.3)Which one of these is not a valid line style in matplotlib?


A. -
B. --
C. .-
D. <
Ans.D

Que.4)Which graph should be used if we want to show distribution of elements?


A. Pie
B. Scatter
C. Bar
D. Histogram
Ans.D

Que.5)Which of the following statement shows first five rows of Data Frame ?
A. df.head()
B. df.head(5)
C. Both A and B
D. Both are Incorrect
Ans.C

Que.6)The method which returns the complete information of the dataframe


A. Df.values
B. df.describe
C. df.print
D. df.show
Ans.B

Que.7)The default data structure of the pandas is


A. Series
B. Dictionary
C. List
D. Dataframe
Ans.D

Que.8)To read data in binary format which of the following access mode used when open a file ?
303-Database Handling Using Python SYBCA SEM 3
A. rb
B. r+
C. wb
D. ab
Ans.A

Que.9)To view the content of the CSV file in the form of dictionary the _____ method is used
A. reader
B. Dictreader
C. writer
D. Dictwriter
Ans.B

Que.10)To get the variance of the rows


A. Df.Var(axis=0)
B. Df.var()
C. Df.var(axis=1)
D. None of the above
Ans.C

Que.11)Which of the following module is import for handling Excel files in Python?
A. openpyxl
B. matplotlib
C. pyplot
D. sqlite3
Ans.A

Que.12)Which of the following function is used in python to skip a row in a CSV file ?
A. next()
B. skip()
C. jump()
D. goto()
Ans.A

Que.13)The functions to fetch the values from middle of the dataframe


A. a. loc()
B. b. iloc()
C. c. Tell()
D. Both a and b
Ans.D

Que.14)What is the meaning of df.iloc[-2] in python ?


A. second last row of data frame
B. first two rows of data frame
C. first two columns of data frame
D. second last column of data frame
Ans.A

Que.15)What is the meaning of df.iloc[0:2] in python ?


A. first two columns of data frame
B. first two rows of data frame
C. first three rows of data frame
D. first three columns of data frame
Ans.B
303-Database Handling Using Python SYBCA SEM 3

Que.16)What is the meaning of df.iloc[0, 2] in python ?


A. Third column of first row of data frame
B. first two rows of data frame
C. first column of third row of data frame
D. first two columns of data frame
Ans.A

Que.17)What is the meaning of df.iloc[ : , 2] in python ?


A. second row of data frame
B. second column of data frame
C. third row of data frame
D. third column of data frame
Ans.D

Que.18)What is the meaning of df.head(-2) in python ?


A. display all row except first two rows
B. display all rows except last two rows
C. display last two rows
D. display first two rows
Ans.B

Que.19)Types of Name Space


A. Local Name Space
B. Global Name Space
C. Built-in Name Space
D. All of the above
Ans.D

Que.20)What is the purpose of write() method?


A. It is used to writes any string to an open file.
B. It is used to read any number to an open file.
C. It is used to reads any string to an open file.
D. It is used to writes only number to an open file.
Ans.A

Que.21)What is the meaning of df.tail(-2) in python ?


A. display all rows except first two rows
B. display all rows except last two rows
C. display first two rows
D. display last two rows
Ans.A

Que.22)Which is not text file accessing mode?


A. R
B. W
C. A
D. rw+
Ans.D

Que.23)Which method returns the list of the lines and reaches the file end point?
A. readline()
B. readlines()
C. read()
D. None of the above
303-Database Handling Using Python SYBCA SEM 3
Ans.B

Que.24)What does csv.reader function return?


A. It returns null
B. It returns file object
C. It returns string
D. It returns number
Ans.B

Que.25)which statement is use for manipulating the files?


A. import
B. from import
C. import *
D. with
Ans.D

Que.26)Types of data structures in Pandas


A. Series
B. Link list
C. DataFrame
D. Both A and C
Ans.D

Que.27)What is the use of DictReader()


A. To read a csv file as a dictionary
B. To read a csv file
C. To write a csv file
D. To write a csv file as a dictionary
Ans.A

Que.28)Which method is useful for filling NaN or Na values?


A. dropna()
B. fillna()
C. fill()
D. None of the above
Ans.B

Que.29)Data Frame in Pandas is


A. One dimension array
B. Two dimension array
C. Three dimension array
D. None of the above
Ans.B

Que.30)Tail() method returns


A. Last n records from data frame
B. All records from data frame
C. First n records from data frame
D. None of the above
Ans.A

Que.31)Which function of pandas is used to read data from CSV file in python ?
A. read_csv()
B. read.csv()
C. readcsv()
303-Database Handling Using Python SYBCA SEM 3
D. csv.read()
Ans.A

Que.32)To retrieve the data, which function is used to run the select query?
A. fetch()
B. execute()
C. rawquery()
D. executequery()
Ans.B

Que.33)connect() function in Sqlite is used for?


A. To connect the database
B. To open the database
C. To create the database
D. All of the above
Ans.D

Que.34)What is the use of DictWriter() function?


A. To read a csv file as a dictionary
B. To write a csv file
C. To read a csv file
D. To write a csv file as a dictionary
Ans.D

Que.35)head() method returns


A. First n records from data frame
B. All records from data frame
C. Last n records from data frame
D. None of the above
Ans.A

Que.36)What is the use of read()?


A. It is used to reads any string to an open file
B. It is used to write any number to an open file
C. It is used to writes any string to an open file
D. It is used to reads any number to an open file
Ans.A

Que.37)What does csv.writer() return?


A. It returns a writer object that converts the user’s data
B. It returns a null object that converts the user’s data
C. It returns a reader object that converts the user’s data
D. It returns a number object that converts the user’s data
Ans.A

Que.38)Series in Pandas is
A. One dimensional array
B. Two dimensional array
C. Multi dimensional array
D. None of the above
Ans.A

Que.39)Which measure of central tendency takes into account the magnitude of scores?
A. Median
B. Range
303-Database Handling Using Python SYBCA SEM 3
C. Mode
D. Mean
Ans.D

Que.40)The median of an ordered set of data is the value that represents


A. The median of an ordered set of data is the value that represents
B. The most frequently observed value
C. The arithmetic average of the data values
D. The middle or approximate middle of the data set
Ans.D

Que.41)Best way to import the pandas module in your program ?


A. import pandas
B. import pandas as p
C. from pandas import *
D. All of the mentioned
Ans.D

Que.42)Which of the following takes a dict of dicts or a dict of array-like sequences and returns a DataFrame?
A. DataFrame.from_items
B. DataFrame.from_records
C. DataFrame.from_dict
D. All of the mentioned
Ans.D

Que.43)Pandas Series can have _________________ data types


A. float
B. integer
C. String
D. All of the mentioned
Ans.D

Que.44)What is the use of file mode 'r'?


A. Create and open a new file
B. Open file in read mode
C. Open file in text mode
D. None of the above
Ans.B

Que.45)What is the use of writer() method in python file operation?


A. To create object
B. To read object
C. To append object
D. None of the above
Ans.A.

Que.46)Which of the following method is similar to Dictreader() method?


A. Dictwriter()
B. Reader()
C. Read ()
D. Writer()
Ans.B.

Que.47)To append multiple rows, which method is used?


A. Readrow()
303-Database Handling Using Python SYBCA SEM 3
B. Writerow()
C. Appendrow()
D. None of the above
Ans.B

Que.48)The Dictreader class reads records from the CSV file in terms of _________
A. Dictionary
B. List
C. Dataframe
D. Object
Ans.A

Que.49)What DictReader do ?
A. Read CSV file and create Tabular Data Object
B. Read CSV file and create Tuple Listad CSV file and create Dictionary Object
C. None of the above
D. Read CSV file and create Dictionary Object
Ans.D

Que.50)____________ function takes File Pointer and returns CSV Reader Object.
A. reader()
B. writerows()
C. writer()
D. csv_reader()
Ans.A

Que.51)Which mode is used to open a file in reading mode but also allows to write
A. r
B. rw
C. w+
D. r+
Ans.D

Que.52)The _________ parameter of csv.reader() function is used to set a specific delimiter like a single quote or
double quote or space or any other character.
A. Dialect
B. Dialect_format
C. Format_dialect
D. None of the above
Ans.A

Que.53)We can use any python file as module by using


A. Import
B. Implement
C. Require
D. None of the above
Ans.A

Que.54)CSV module allows to write multiple rows using ____________ function.


A. writer
B. writers
C. write_rows
D. writerows
Ans.D
303-Database Handling Using Python SYBCA SEM 3

Que.55)Which of the following is not a function of csv module?


A. readline()
B. writerow()
C. reader()
D. writer()
Ans.A

Que.56)Which of the following is tasks cannot be done or difficult with CSV module?
A. Saving data permanently
B. Uniqueness of data
C. Data in tabular form
D. All of these
Ans.B

Que.57)__________function is used for calculating some statistical data like percentile, mean and std of the
numerical values of the Series or DataFrame.
A. Statistical ()
B. Stat_describe()
C. Describe()
D. Dialect()
Ans.C

Que.58)Which function is measured as the spread of data distribution in the given data set.
A. Varience
B. Standard Deviation
C. Median
D. Mode
Ans.B

Que.59)How to read a file when delimiter character is a part of data itself?


A. Use other delimiter
B. Wrap the data in quotes
C. Escape the delimiter character in data
D. Any of the above
Ans.D

Que.60)Which of the following function is used to write a DataFrame object to. CSV file using pandas module?
A. writer()
B. writerow()
C. writeheader()
D. to_csv()
Ans.D

Que.61)Which of the following module is used to read a CSV file?


A. csv
B. pandas
C. Both a & b
D. None of a & b
Ans.C

Que.62)Which of the following specifies the character used to surround fields that contain the delimiter
character?
A. quotechar
B. delimiter
303-Database Handling Using Python SYBCA SEM 3
C. lineterminator
D. escapechar
Ans.A

Que.63)Which of the following will be used as by default lineterminator for writing data to a file with csv
module?
A. \r\n
B. \r
C. \n
D. \n\r
Ans.A

Que.64)The open() function returns _______.


A. Total Length of File
B. file content
C. file creation detail
D. Open file pointer
Ans.D

Que.65)CSV File can be read or write using


A. CSV Module
B. Data module
C. File module
D. SQLite3 module
Ans.A

Que.66)What DictReader do?


A. Read CSV file and create Tabular Data Object
B. Read CSV file and create Dictionary Object
C. Read CSV file and create Tuple List
D. Read CSV file and create array
Ans.B

Que.67)which function is used to fetch single record?


A. fetchall()
B. fetchmany()
C. fetchone()
D. fetch()
Ans.C

Que.68)We can add a new row to a DataFrame using the _____________ method.
A. rloc[ ]
B. iloc[ ]
C. loc[ ]
D. None of the above
Ans.C

Que.69)What type of error is returned by following statement? Consider follwing code :import pandas as
pnd pnd.Series([1,2,3,4], index = [‘a’,’b’,’c’])
A. SyntaxError
B. IndexError
C. ValueError
D. None of the above
Ans.C
303-Database Handling Using Python SYBCA SEM 3

Que.70) Which of the following statement shows first five values of Series ‘S1’?
A. S1.head( )
B. S1.head( 5 )
C. Both of the above
D. None of the above
Ans.C

Que.71)Which of the following statement is wrong?


A. We can create Series from Dictionary in Python.
B. Keys of dictionary become index of the series.
C. Order of indexes created from Keys may not be in the same order as typed in dictionary.
D. All are correct
Ans.D

Que.72)Correct syntax of file.writelines() is?


A. file.writelines(sequence)
B. fileObject.writelines()
C. fileObject.writelines(sequence)
D. None
Ans.C

Que.73)In regards to separated value files such as .csv , what is the delimiter?
A. Any character such as the comma (,) or tab (\t) that is used to separate the row data
B. Anywhere the comma (,) character is used in the file
C. Delimiters are not used in separated value file
D. Any character such as the comma (,) or tab (\t) that is used to separate the column data.
Ans.D

Que.74)Panda Stands for-


A. Panel Data Analysis
B. Panel Data Analyst
C. Panel Data
D. None
Ans.C

Que.75)Which of the following command is used to install pandas?


A. pip install pandas
B. install pandas
C. pip panda
D. None
Ans.A

Que.76)Pandas is an open-source _______ Library?


A. Ruby
B. Java
C. Python
D. JavaScript
Ans.C

Que.77)Which of the following is not a function of csv module?


A. readline( )
B. reader( )
C. writer( )
D. writerow( )
303-Database Handling Using Python SYBCA SEM 3
Ans.A

Que.78)Which is the important library used to analyze the data?


A. Math
B. Pandas
C. Random
D. None
Ans.B

Que.79)In data science, which of the Python Library is most popular?


A. Numpy
B. Pandas
C. OpenCv
D. Django
Ans.B

Que.80)What is the main purpose of Pandas library?


A. Data Recovery
B. Data Backup
C. Data Visualization
D. Data Analysis
Ans.D

Que.81)PANDAS stands for _____________


A. Panel Data Analysis
B. Panel Data analyst
C. Panel Data
D. Panel Dashboard
Ans.C

Que.82)For what purpose a Pandas is used?


A. To create a database
B. To create a GUI programming
C. To create a High level array
D. All of the above
Ans.C

Que.83)What we pass in DataFrame in Pandas?


A. Integer
B. String
C. Pandas series
D. All of the above
Ans.C

Que.84)To extract row/column from a datafram, _____ function may be used? function may be used.
A. row( )
B. column( )
C. loc( )
D. All of these
Ans.C

Que.85)Missing data in Pandas object is represented through


A. Null
B. None
C. Missing
303-Database Handling Using Python SYBCA SEM 3
D. nan
Ans.D

Que.86)This function computes a summary of statistics pertaining to the DataFrame columns


A. mode()
B. median()
C. mean()
D. describe()
Ans.D

Que.87)Series() function contains which three parameters


A. data,index and name
B. data,datatype, index
C. index,datatype(size), dataframe
D. data, attribute ,index
Ans.A

Que.88)This Class is more convenient to address the field names and extract the records from the data file.
A. DictReader()
B. Reader()
C. Read()
D. None of the above
Ans.A

Que.89)Data frames are datatype specific.


A. True
B. False
C. Supports only integer.
D. None of the above
Ans.B

Que.90)Display first three names of the employees using dataframe


A. df.loc[101:103,'Name']
B. df.loc[:,'Name']
C. Both A and B
D. None of the above
Ans.C

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy