Questions

4 Marks Each

🎯

Test yourself on this topic

11 questions · timed · auto-graded

Question 14 Marks
Aarti is new in python data-handling. Please help her to count the number of lines which begins with ‘W’ or ‘w’ in poem.txt.

(a) # Line 1 : To open file POEM.txt in read mode

(b) # Line 2 : To check first character of every line is ‘W’ or ‘w’.

(c) # Line 3 : To increase the value of count by 1.

(d) # Line 4 : To call the function count_poem.

Answer
(a) file1 = open("POEM.TXT","r")

(b) r1[0]=='W' or r1[0]=='w':

(c) count=count+1

(d) count_Poem()

View full question & answer
Question 24 Marks
Write a function AverageColumn() which accepts csv file as parameter. It will print sum and average of each row. For example if marks.csv contain 50,60,70,80,90 70,60,50,60,80 50,60,70,80,90 Then OUTPUT will be Sum is : 350.0 Average is : 116.66666666666667 Sum is : 320.0 Average is : 106.66666666666667 Sum is : 350.0 Average is : 175.0
View full question & answer
Question 34 Marks
Write a program to count no. of records in csv file and display the records in tabular form. Admno, Name, Eng, Hindi, Maths, Sci, Ssc 1101 1102 1103 1104 1105 Tejas Swati Sam Imran Heena 80 90 90 75 85 85 85 80 76 90 95 94 64 80 90 94 96 85 80 75 86 80 70
View full question & answer
Question 44 Marks
Write a menu driven program to do the following option on binary file “Student”. The program should implement through list which contains student number, student name and marks. Student Menu ------------------ 1) Add New Student 2) Display student details 3) Search student 4) Update a Record 5) Delete a Record 6) Save & Quit
View full question & answer
Question 54 Marks
Write a function delrecord() to delete the record form the binary file “student”. The record should be deleted on the basis of student number.
View full question & answer
Question 64 Marks
Write a function update () to update the record in the binary file “student”, which consist of student number, student name and marks. The updation should be done on the basis of student number entered by the user.
View full question & answer
Question 74 Marks
Write a function search () to search a record in a binary file according to the student number entered by the user. Also display the message “Record not found” in case record not found in the file.
View full question & answer
Question 94 Marks
Write a function addrecord() a add new record to the binary file “student” using list. The list should consist of student number, student name and marks of the student.
View full question & answer
Question 104 Marks
Write a function to read the content from the file “India.txt”, and store the frequency of each character in dictionary and display the dictionary in the screen. Content of the file is: ‘‘India is the fastest growing economy. India is looking for more investments around the globe. The whole world is looking at India as a great market. Most of the Indians can foresee the heights that India is capable of reaching.’’ Output is: {'I': 5, 'n': 15, 'd': 7, 'i': 15, 'a': 17, ' ': 39, 's': 13, 't': 15, 'h': 10, 'e': 20, 'f': 5, 'g': 8, 'r': 9, 'o': 17, 'w': 3, 'c': 4, 'm': 4, 'y': 1, '.': 4, 'n': 4, 'l': 6, 'k': 3, 'v': 1, 'u': 1, 'b': 2, 'T': 1, 'M': 1, 'p': 1}
View full question & answer
Question 114 Marks
Write a function to read the content from the file “India.txt”, and store the frequency of each word in dictionary and display the dictionary in the screen. Content of the file is: ‘‘India is the fastest growing economy. India is looking for more investments around the globe. The whole world is looking at India as a great market. Most of the Indians can foresee the heights that India is capable of reaching.’’ Output of the file: {‘India’: 4, ‘is’: 4, ‘the’: 4, ‘fastest’: 1, ‘growing’: 1, ‘economy.’: 1, ‘looking’: 2, ‘for’: 1, ‘more’: 1, ‘investments’: 1, ‘around’: 1, ‘globe.’: 1, ‘The’: 1, ‘whole’: 1, ‘world’: 1, ‘at’: 1, ‘as’: 1, ‘a’: 1, ‘great’: 1, ‘market.’: 1, ‘Most’: 1, ‘of’: 2, ‘Indians’: 1, ‘can’: 1, ‘foresee’: 1, ‘heights’: 1, ‘that’: 1, ‘capable’: 1, ‘reaching.’: 1}
View full question & answer
4 Marks Each - Computer Science STD 12 Humanities Questions - Vidyadip