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)
437 views
4 pages
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)
437 views
4 pages
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
Download
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
Rishabh Singh 2
PDF
No ratings yet
Rishabh Singh 2
90 pages
Class 12 Cs All Region Papers
PDF
No ratings yet
Class 12 Cs All Region Papers
213 pages
Kvs Pb i Cs 202425 Solutions
PDF
No ratings yet
Kvs Pb i Cs 202425 Solutions
62 pages
KVS_PB_I_CS_202425_QPS
PDF
No ratings yet
KVS_PB_I_CS_202425_QPS
53 pages
cs pb1 ms
PDF
No ratings yet
cs pb1 ms
16 pages
PDF&Rendition 1 1
PDF
100% (1)
PDF&Rendition 1 1
180 pages
Final Draft JEE Questions Management System 1
PDF
No ratings yet
Final Draft JEE Questions Management System 1
75 pages
Cs Pratical Codes (Final)
PDF
No ratings yet
Cs Pratical Codes (Final)
73 pages
12 CS RevisionPapers2025
PDF
No ratings yet
12 CS RevisionPapers2025
86 pages
Stacks & File Handling Worksheet-1 Class 12 CS
PDF
No ratings yet
Stacks & File Handling Worksheet-1 Class 12 CS
7 pages
12 Cs Pp Set1 Qpms 2024-25
PDF
No ratings yet
12 Cs Pp Set1 Qpms 2024-25
13 pages
CSV File Handling Assignment (2024-25)
PDF
No ratings yet
CSV File Handling Assignment (2024-25)
4 pages
XII Comp Sc SSCE Practical Examination 2024-25
PDF
No ratings yet
XII Comp Sc SSCE Practical Examination 2024-25
13 pages
Sample Paper 12 With Answer Key
PDF
No ratings yet
Sample Paper 12 With Answer Key
43 pages
TOUR & TRAVEL AGENCY SYSTEM (CS CLASS 12) PDF
PDF
No ratings yet
TOUR & TRAVEL AGENCY SYSTEM (CS CLASS 12) PDF
23 pages
Electric Generator Project File
PDF
No ratings yet
Electric Generator Project File
27 pages
PP 12 Physics 2024
PDF
No ratings yet
PP 12 Physics 2024
29 pages
cblecspu09
PDF
50% (2)
cblecspu09
9 pages
Class XII CS Practical File
PDF
No ratings yet
Class XII CS Practical File
25 pages
Computer Science Report File: By: Xii-B Board Roll No
PDF
No ratings yet
Computer Science Report File: By: Xii-B Board Roll No
46 pages
GRADE XII CS PRACTICAL FILE 2024 - 25 Final
PDF
No ratings yet
GRADE XII CS PRACTICAL FILE 2024 - 25 Final
48 pages
CSV Files
PDF
No ratings yet
CSV Files
14 pages
91-S Computer Science
PDF
No ratings yet
91-S Computer Science
15 pages
Class 12 CS Practice Paper 2024-25
PDF
No ratings yet
Class 12 CS Practice Paper 2024-25
38 pages
Informatics Practices Project - 221228 - 132356
PDF
No ratings yet
Informatics Practices Project - 221228 - 132356
30 pages
For Video Explanation of This Topic, Please Click On The Following Link
PDF
No ratings yet
For Video Explanation of This Topic, Please Click On The Following Link
8 pages
CSV Case
PDF
No ratings yet
CSV Case
7 pages
CLASS 12 PRE BOARD 2023-24 ComputerScience
PDF
No ratings yet
CLASS 12 PRE BOARD 2023-24 ComputerScience
25 pages
MCQ Questions Agra
PDF
No ratings yet
MCQ Questions Agra
116 pages
PT 2 - Practice Sheets
PDF
100% (1)
PT 2 - Practice Sheets
6 pages
Grade12 Computer Set1 AK Sahodaya
PDF
No ratings yet
Grade12 Computer Set1 AK Sahodaya
9 pages
imp CBSE Class 12 Computer Science Practical Viva Q Python 2024-2025
PDF
0% (1)
imp CBSE Class 12 Computer Science Practical Viva Q Python 2024-2025
2 pages
Exception Handing
PDF
No ratings yet
Exception Handing
5 pages
Class 12 TH Computer Science PRE BOARD 1
PDF
No ratings yet
Class 12 TH Computer Science PRE BOARD 1
12 pages
MS - 12CS - PB-I - 23-24 Set 2
PDF
No ratings yet
MS - 12CS - PB-I - 23-24 Set 2
6 pages
QP - 12CS - PB-I - 23-24 Set 2
PDF
50% (2)
QP - 12CS - PB-I - 23-24 Set 2
8 pages
Class 12 Cs Practical Exercises 2022-2023 (Updated)
PDF
No ratings yet
Class 12 Cs Practical Exercises 2022-2023 (Updated)
39 pages
XII CS Term1 Practical Solution
PDF
No ratings yet
XII CS Term1 Practical Solution
32 pages
CS Project
PDF
100% (1)
CS Project
25 pages
SESSION: 2019-20: Project Report of
PDF
50% (2)
SESSION: 2019-20: Project Report of
33 pages
G12-Cs-Practical QP, Ak
PDF
No ratings yet
G12-Cs-Practical QP, Ak
16 pages
Xii Cs 2024-25 Ms_set3
PDF
No ratings yet
Xii Cs 2024-25 Ms_set3
13 pages
Assignment # 8
PDF
No ratings yet
Assignment # 8
7 pages
CSV Flie Question Bank Solutions
PDF
No ratings yet
CSV Flie Question Bank Solutions
20 pages
Chennai T2 XII CS MS
PDF
No ratings yet
Chennai T2 XII CS MS
9 pages
Class 12 Computer Science Set 3 With Solutions
PDF
No ratings yet
Class 12 Computer Science Set 3 With Solutions
14 pages
Stack Top
PDF
No ratings yet
Stack Top
6 pages
GG Class XII CS
PDF
No ratings yet
GG Class XII CS
24 pages
Chapter 1 Python Pandas - I Type C Long Answer
PDF
No ratings yet
Chapter 1 Python Pandas - I Type C Long Answer
5 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
Python
PDF
No ratings yet
Python
17 pages
CS PROJECT FILE Class 12
PDF
No ratings yet
CS PROJECT FILE Class 12
13 pages
Sample Questions Paper (FINAL) 1
PDF
No ratings yet
Sample Questions Paper (FINAL) 1
10 pages
Computer Report File
PDF
No ratings yet
Computer Report File
21 pages
Binary File Worksheet
PDF
No ratings yet
Binary File Worksheet
8 pages
Xii Cs Practical Record
PDF
100% (1)
Xii Cs Practical Record
20 pages
XII CS Preboard - 2 QP Updated
PDF
No ratings yet
XII CS Preboard - 2 QP Updated
10 pages
PB2 Maths QP - Ernakulam
PDF
No ratings yet
PB2 Maths QP - Ernakulam
8 pages
CSV - Practice Paper
PDF
No ratings yet
CSV - Practice Paper
7 pages
Art Integrated Project
PDF
No ratings yet
Art Integrated Project
19 pages