Python Tutorial: MCQs CSV Files

Monday, 8 November 2021

MCQs CSV Files

MCQs CSV FILES

Q1_________ is a file format which stores records separated by comma.

a. .tsv

b. .csv

c. .py

d. .bin

Q2.The CSV files can be operated by _______software.

a. Spreadsheet

b. Notepad

c. MS Excel

d. All of the above

Q3.When you read csv file using csv.reader() function it returns the values in _______ object.

a. dictionary

b. tuple

c. nested list

d. sets

Q4.CSV module allows to write multiple rows using ____________ function.

a. writerows( )

b. writerow( )

c. writer( )

d. None of the above

Q5.Which of the following parameter needs to be added with open function to avoid blank row followed file

each row in CSV file?

a. delimiter

b. newline

c. writer, delimiter

d. file object

Q6.which is the correct way to import a csv module?

a. import csv

b. from csv import *

c. None of the above

d. Both A & B

Q7.Observe the following code and fill the blank in statement1

import csv

with _________ as f: #statement1

r = csv.______(f) #statement2

for row in ______: #statement3

print(_____) #statement4

a. open("data.csv")

b. f=open("data.csv")

c. Both A & B are Correct

d. Both A & B are incorrect

Q8.Observe the following code and fill the blank in statement2

import csv

with _________ as f: #statement1

r = csv.______(f) #statement2

for row in ______: #statement3

print(_____) #statement4

a. load

b. read()

c. reader()

d. readlines()

Q9.Observe the following code and fill the blank in statement3

import csv

with _________ as f: #statement1

r = csv.______(f) #statement2

for row in ______: #statement3

print(_____) #statement4

a. f

b. r

c. r,f

d. None of the above

Q10.Observe the following code and fill the blank in statement4

import csv

with _________ as f: #statement1

r = csv.______(f) #statement2

for row in ______: #statement3

print(_____) #statement4

a. r

b. row

c. f

d. csv

 

ANSWER KEY

1.B

2.D

3.C

4.A

5.B

6.D

7.A

8.C

9.B

10.B

 


No comments:

Post a Comment