Saved Bookmarks
| 1. |
Rohit, a student of class 12, 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,AIncomplete 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(...........) #Statement-5stuwriter. ....... (data) #Statement-6 fh.close()1. Identify the suitable code for blank space in the line marked as Statement-1. a) csv file b) CSV c) csv d) cvs2. Identify the missing code for blank space in line marked as Statement-2. a) "Student.csv","wb" b) "Student.csv","w" c) "Student.csv","r" d) "Student.cvs","r3. Choose the function name (with argument) that should be used in the blank space of line marked as Statement-3. a) reader(fh) b) reader(MyFile) c) writer(fh) d) writer(MyFile)4. Identify the suitable code for blank space in line marked as Statement-4. a) 'ROLL_NO', 'NAME', 'CLASS', 'SECTION' b) ROLL_NO, NAME, CLASS, SECTION c) 'roll_no','name','Class','section' d) roll_no,name,Class,section5. Identify the suitable code for blank space in the line marked as Statement-5. a) data b) record c) rec d) insert6. Choose the function name that should be used in the blank space of line marked as Statement-6 to create the desired CSV File? a) dump() b) load() c) writerows() d) writerow() |
|
Answer» 1. c. csv 2. b. "Student.csv","w" 3. c. writer(fh) 4. d. roll_no,name,Class,section 5. c. rec 6. c. writerows() |
|