Choose the function name that should be used in the blank space of line marked as Statement-5 to create the desired CSV File?

 Rohit, a student of class 12th, is learning CSV File Module in Python. During examination, he has been assigned an incomplete python code (shown below) to create a CSV File 'Student.csv' (content shown below). Help him in completing the code which creates the desired CSV File.


CSV File 

1,AKSHAY,XII,A 

2,ABHISHEK,XII,A 

3,ARVIND,XII,A 

4,RAVI,XII,A 

5,ASHISH,XII,A


Incomplete Code import_____ #Statement-1 

fh = open(_____, _____, newline='') #Statement-2

 stuwriter = csv._____ #Statement-3 

data = [] 

header = ['ROLL_NO', 'NAME', 'CLASS', 'SECTION'] 

data.append(header) 

for i in range(5): 

roll_no = int(input("Enter Roll Number : ")) 

name = input("Enter Name : ") 

Class = input("Enter Class : ")

 section = input("Enter Section : ") 

rec = [_____] #Statement-4 

data.append(rec) 

stuwriter. _____ (data) #Statement-5

 fh.close() 

*******************************************

Choose the function name that should be used in the blank space of line marked as Statement-5 to create the desired CSV File? 

a) dump() 

b) load() 

c) writerows() 

d) writerow() 

Correct Answer : c) writerows() 

No comments:

Post a Comment