Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
402 views
File Hand
Uploaded by
Titu Pandwy
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save file hand For Later
Download
Save
Save file hand For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
402 views
File Hand
Uploaded by
Titu Pandwy
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save file hand For Later
Carousel Previous
Carousel Next
Save
Save file hand For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 4
Search
Fullscreen
379. Diksha Behl is a student of non-IT stream. However, she wants to learn Python also as it will be helpful to her in her field. While learning Python, her teacher has assigned her an assignment to complete an incomplete program given below. The program intends to print from a csv file (people.csv) that stores tab separated fields as Empld Fname Lname. Phone 201 Vibhu Jain 295000 202 Nooh Kirk 610011 203, Haris Jamil 92055, 204 Kulwant Singh 69700 The incomplete code given to Diksha is as follows : import csv #Line1 with open(___, __) as myfile: #Line2 fin = csv (myfile, delimiter =~) “# Linea forrowin__: #Linea print(___) #Lines (a) Complete the Line2 of the given code so that given csv file is opened in read mode for processing. 1 (b) Complete Line3 so that the tab separated csv file is read into fin object. a (0) Complete the code of Lines 4 and 5 so that the records from the open csv file are printed line by line. : (4) Modify the code of Lines 4 and 5 so that only the fourth field (Phone) from each record gets printed. 1 (©) Write the output obtained by running the code of Lines 4 and 5. 1378. Sonu Bhartiya has joined as an intern at Realsoft company. The company has department spread across India and the details ofall departments are stred in a file, Dept.eso, as showy below Dept_10 Dept Nome tecation | ow | Admin Delhi o20 | Production Hyderabad, oso | marketing Bangalore oso | agriResearch Mobsl oso | Agri:Macketing | Mohali D060 | Human Resources | Hyderabad por | Finance Delhi ‘pos | public Relations | Bangalore ‘Sonu has been asked to write a program to list the departments at a specific location. He has written the following code, with some wordsleyntax missing pee #Linet swith open( snewline=__) as csvfile: # Line? data = csv.reader(. ydeLiniter =" Linea ‘for row in data Lines 4f__inrow: Lines print( ) # Lines (a) Which library must be added to the program, for it to work ? 1 Fill Linel for this ©) Compete Line 2 30 that te fle storing the depron dts ges opened i suppressed newline processing. (©) The records are to be read row by row, not field by field. For this fil inthe Blank in Line 3. 1 (4) Sonu wants to print only the departments in location “Mohali”. Complete Lines 5 and 6 for the same. 1 (6) Convert the above given incomplete code so that location name is passed to a function Deplocation( ) and the function prints the rows of department dels from th locaton. 1380. Ranjan Kumar of class 12 is writing a program to create a CSV file “user.csv” which wil) contain user name and password for some entries. He has written the following code. As 4 programmer, help him to successfully execute the given task. {CBSE Sample Paper 2020.91 import #Line 1 def addCsvF ile (UserName, Password # towrite/add data into the CSV file f= open(‘user.csv",*___ # Line 2 newFileWriter = csv.writer(F) newFileWriter.writerow([UserName, Passhord] ) F.close() csv file reading code def readCsvFile(): # to read data from CSV file with open(' user.csv’,"r*) as newFile: newFileReader=csv.___(newFile) # Line 3 for row in newFileReader: print (row[@],row[1]) newFile, Linea addCsvFile("Arjun”, "123@456") addCsvFile("Arunima”, “arugnima*) addCsvFile("Frieda”, “nyname@FRD") readCsvFile() #LineS (a) Name the module he should import in Line 1 1 (b) In which mode, Ranjan should open the file to add data into the file. i (0) Fill in the blank in Line 3 to read the data from a csv file (@) Fill in the blank in Line 4 to close the file. (©) Write the output he will obtain while executing Line 5. 1387. Dhanush’s teacher has given him the following text fle (HigherEd.txt) Higher education improves an individual’ s quality of life. ‘Studies show that, conpared to high school graduates, college graduates have longer Life spans, better access tohealth care, better dietary and health Practices, greater economic stability and security. We must ensure that our whole population receives an education that will allow full and continuing participation in this dynamic period of economic history. and the following incomplete code def FileFunctiona( ‘#FiDL_Lines fin #FALL_Lines print(_ (wn) F411 Line? —__ ‘¥ri1L Lines print( (nay) ‘#F11_Lines main N #Fi11_Linea N=, #411 Line2 Filename = #Fi11_Line3 fileFunction1 (Filename, N1, N2) Lines Help Dhanush to complete his work as per the following instructions (@) Ade code to blank lines Fill_Line1 and Fill_Line2 so that two integer numbers are read into variables NI and N2. Also, complete Fill_Line3 so that the function call below it makes sense, which is sending 3 arguments; filename, and two numbers NI and N2. 1 (8) As per the function cal, complete the function header in Fill_LineS, 1 (©) Complete Fill_Line6 so that the text file is opened for reading in the file object fin. 1 (@ Complete Fill_Line7 and Fill_Line9 so that the passed number of characters are read from the fle and printed 1 (©) Complete Fil_Line so tat the characters til he end ofthe Tne from the current position ofthe fle pointer are read but not printed 1
You might also like
CSV Flie Question Bank Solutions
PDF
No ratings yet
CSV Flie Question Bank Solutions
20 pages
Class 12 Computer Science Set 3 With Solutions
PDF
No ratings yet
Class 12 Computer Science Set 3 With Solutions
14 pages
Xii Cs 2024-25 Ms_set3
PDF
No ratings yet
Xii Cs 2024-25 Ms_set3
13 pages
Cs Pratical Codes (Final)
PDF
No ratings yet
Cs Pratical Codes (Final)
73 pages
Sample Paper 3
PDF
No ratings yet
Sample Paper 3
10 pages
MCQ Questions Agra
PDF
No ratings yet
MCQ Questions Agra
116 pages
Kvs Pb i Cs 202425 Solutions
PDF
No ratings yet
Kvs Pb i Cs 202425 Solutions
62 pages
ComputerScience Board Paper 2024 - MS
PDF
No ratings yet
ComputerScience Board Paper 2024 - MS
26 pages
Physics KV Support Material
PDF
No ratings yet
Physics KV Support Material
325 pages
CS - 11 - CS - Practical List With Program & Output
PDF
No ratings yet
CS - 11 - CS - Practical List With Program & Output
11 pages
Set-3 QP
PDF
No ratings yet
Set-3 QP
7 pages
XII_CS_WC_SET1 QP
PDF
No ratings yet
XII_CS_WC_SET1 QP
9 pages
KVS_PB_I_CS_202425_QPS
PDF
No ratings yet
KVS_PB_I_CS_202425_QPS
53 pages
CBSE 12 Holiday Homework
PDF
No ratings yet
CBSE 12 Holiday Homework
5 pages
CS Class XII Paper
PDF
No ratings yet
CS Class XII Paper
7 pages
12 Cs Prebboard1 Jbl Qpms 2024-25
PDF
No ratings yet
12 Cs Prebboard1 Jbl Qpms 2024-25
12 pages
91-S Computer Science
PDF
No ratings yet
91-S Computer Science
15 pages
Assign CS
PDF
No ratings yet
Assign CS
9 pages
Binary File MCQ Question Bank For Class 12 - CBSE Python
PDF
No ratings yet
Binary File MCQ Question Bank For Class 12 - CBSE Python
51 pages
GG Class XII CS
PDF
No ratings yet
GG Class XII CS
24 pages
Binary File Worksheet
PDF
No ratings yet
Binary File Worksheet
8 pages
12 Cs Pp Set1 Qpms 2024-25
PDF
No ratings yet
12 Cs Pp Set1 Qpms 2024-25
13 pages
Final Draft JEE Questions Management System 1
PDF
No ratings yet
Final Draft JEE Questions Management System 1
75 pages
Xii PB 2023 Ip 201123
PDF
No ratings yet
Xii PB 2023 Ip 201123
6 pages
Computer Science Project
PDF
No ratings yet
Computer Science Project
32 pages
Chennai T2 XII CS MS
PDF
No ratings yet
Chennai T2 XII CS MS
9 pages
MS - 12CS - PB-I - 23-24 Set 2
PDF
No ratings yet
MS - 12CS - PB-I - 23-24 Set 2
6 pages
QP-1 CS
PDF
No ratings yet
QP-1 CS
8 pages
Class 12 Cs Practical Exercises 2022-2023 (Updated)
PDF
No ratings yet
Class 12 Cs Practical Exercises 2022-2023 (Updated)
39 pages
CS Class 12 Chapter - 3 Type C Questions Solutions
PDF
No ratings yet
CS Class 12 Chapter - 3 Type C Questions Solutions
7 pages
CS QP 1
PDF
No ratings yet
CS QP 1
11 pages
Sultan Chand IP-CLASS-XII-SAMPLE QUESTION PAPER 1
PDF
No ratings yet
Sultan Chand IP-CLASS-XII-SAMPLE QUESTION PAPER 1
11 pages
Class 12 CS 32 Sets QP Combined Papers
PDF
No ratings yet
Class 12 CS 32 Sets QP Combined Papers
295 pages
XI CS Sample Paper
PDF
100% (1)
XI CS Sample Paper
5 pages
Class 12 Cs All Region Papers
PDF
No ratings yet
Class 12 Cs All Region Papers
213 pages
CSV Files
PDF
No ratings yet
CSV Files
14 pages
QP XII Computer Science
PDF
No ratings yet
QP XII Computer Science
11 pages
Aissce Practical I.P 2020-21-1
PDF
No ratings yet
Aissce Practical I.P 2020-21-1
6 pages
I Pre-Board Exam Computer Science, 2024-25
PDF
No ratings yet
I Pre-Board Exam Computer Science, 2024-25
8 pages
Mini Project in Python
PDF
No ratings yet
Mini Project in Python
20 pages
Exception Handing
PDF
No ratings yet
Exception Handing
5 pages
CS Study Material Chandigarh
PDF
No ratings yet
CS Study Material Chandigarh
151 pages
Python E Lab
PDF
0% (1)
Python E Lab
5 pages
Class 12 Sample Paper
PDF
No ratings yet
Class 12 Sample Paper
6 pages
Logbook
PDF
No ratings yet
Logbook
19 pages
ComputerScience-SQP Set4-MS
PDF
No ratings yet
ComputerScience-SQP Set4-MS
12 pages
NVS Preboard Marking Scheme - CS - 12
PDF
No ratings yet
NVS Preboard Marking Scheme - CS - 12
18 pages
GYM MANAGEMENT CS Project
PDF
No ratings yet
GYM MANAGEMENT CS Project
37 pages
CSSC 2022-Class Xii-Csc-Qp
PDF
100% (1)
CSSC 2022-Class Xii-Csc-Qp
14 pages
XII CS Preboard - 2 QP Updated
PDF
No ratings yet
XII CS Preboard - 2 QP Updated
10 pages
Function Practice Questions
PDF
No ratings yet
Function Practice Questions
16 pages
Computer Science Practical File Term 1 Class 12
PDF
0% (1)
Computer Science Practical File Term 1 Class 12
24 pages
Sol Cs Pb1 All KV Regions
PDF
No ratings yet
Sol Cs Pb1 All KV Regions
138 pages
Student Support Material Class Xii - Cs
PDF
No ratings yet
Student Support Material Class Xii - Cs
150 pages
CS Sample Paper 7
PDF
100% (1)
CS Sample Paper 7
9 pages
G12cs-Ms-Preboard1 2022-23
PDF
No ratings yet
G12cs-Ms-Preboard1 2022-23
21 pages
File Handling Programs For XII B
PDF
No ratings yet
File Handling Programs For XII B
16 pages
Sample Paper CS Class 12
PDF
No ratings yet
Sample Paper CS Class 12
12 pages
CSV Case
PDF
No ratings yet
CSV Case
7 pages
CSV - Practice Paper
PDF
No ratings yet
CSV - Practice Paper
7 pages