Read and download free pdf of CBSE Class 12 Computer Science Case Study Based Questions. Students and teachers of Class 12 Computer Science can get free printable Worksheets for Class 12 Computer Science Case Study Based Questions in PDF format prepared as per the latest syllabus and examination pattern in your schools. Class 12 students should practice questions and answers given here for Computer Science in Class 12 which will help them to improve your knowledge of all important chapters and its topics. Students should also download free pdf of Class 12 Computer Science Worksheets prepared by teachers as per the latest Computer Science books and syllabus issued this academic year and solve important problems with solutions on daily basis to get more score in school exams and tests
Worksheet for Class 12 Computer Science Case Study Based Questions
Class 12 Computer Science students should refer to the following printable worksheet in Pdf for Case Study Based Questions in Class 12. This test paper with questions and answers for Class 12 will be very useful for exams and help you to score good marks
Class 12 Computer Science Worksheet for Case Study Based Questions
1. Rohit, a student ofClass 12th, is learningCSVFileModule 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(“Class : ”)
section = input(“Enter Section : ”)
rec = [_____] #Statement 4
data.append(rec)
stuwriter. _____ (data) #Statement 5
fh.close()
Question. Identify the suitable code for blank space in line marked as Statement 1.
(a) csv file
(b) CSV
(c) csv
(d) Csv
Answer : C
Question. Identify the missing code for blank space in line marked as Statement 2.
(a) “School.csv”,“w”
(b) “Student.csv”,“w”
(c) “Student.csv”,“r”
(d) “School.csv”,“r”
Answer : B
Question. Choose the function name (with argument) that should be used in the blank space of linemarked as Statement 3.
(a) reader(fh)
(b) reader(MyFile)
(c) writer(fh)
(d) writer(MyFile)
Answer : C
Question. 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,section
Answer : D
Question. Choose the function name that should be used in the blank space of linemarked as Statement 5 to create the desired CSV file?
(a) dump()
(b) load() (
c) writerows()
(d) writerow()
Answer : C
2. Amritya Seth is a programmer, who has recently been given a task to write a Python code to perform the following binary file operations with the help of two user defined functions/modules:
(a) AddStudents() to create a binary file called STUDENT.DAT containing student information – roll number, name and marks (out of 100) of each student.
(b) GetStudents() to display the name and percentage of those students who have a percentage greater than 75. In case there is no student having percentage > 75, the function displays an appropriate message. The function should also display the average percent.
He has succeeded in writing partial code and has missed out certain statements, so he has left certain queries in comment lines. You as an expert of Python have to provide the missing statements and other related queries based on the following code of Amritya. import pickle
def AddStudents():
____________ #1 statement to open the binary file to write data
while True:
Rno = int(input(“Rno :”))
Name = input(“Name:”)
Percent = float(input(“Percent :”))
L = [Rno, Name, Percent]
____________ #2 statement to write the list L into the file
Choice = input(“enter more (y/n): ”)
if Choice in “nN”:
break
F.close()
def GetStudents():
Total=0
Countrec=0
Countabove75=0
with open(“STUDENT.DAT”,“rb”) as F:
while True:
try:
____________ #3 statement to read from the file
Countrec+=1
Total+=R[2]
if R[2] > 75:
print(R[1], “ has percent = ”,R[2])
Countabove75+=1
except:
break
if Countabove75==0:
print(“There is no student who has percentage more than 75”)
average=Total/Countrec
print(“average percent of class = ”,average)
AddStudents()
GetStudents()
Answer any four questions (out of five) from the below mentioned questions.
Question. Which of the following commands is used to open the file “STUDENT.DAT” for writing only in binary format? (marked as #1 in the Python code)
(a) F= open(“STUDENT.DAT”,‘wb’)
(b) F= open(“STUDENT.DAT”,‘w’)
(c) F= open(“STUDENT.DAT”,‘wb+’)
(d) F= open(“STUDENT.DAT”,‘w+’)
Answer : A
Question. Which of the following commands is used to write the list L into the binary file
‘STUDENT.DAT’? (marked as #2 in the Python code)
(a) pickle.write(L,f)
(b) pickle.write(f, L)
(c) pickle.dump(L,F)
(d) f=pickle.dump(L)
Answer : C
Question. Which of the following commands is used to read each record from the binary file
‘STUDENT.DAT’? (marked as #3 in the Python code)
(a) R = pickle.load(F)
(b) pickle.read(r,f)
(c) r= pickle.read(f)
(d) pickle.load(r,f)
Answer : A
Question. Which of the following statement(s) are correct regarding the file access modes?
(a) ‘r+’ opens a file for both reading and writing. File object points to its beginning.
(b) ‘w+’ opens a file for both writing and reading. Adds at the end of the existing file, if it exists and creates a new one, if it does not exist.
(c) ‘wb’ opens a file for reading and writing in binary format. Overwrites the file, if it exists and creates a new one, if it does not exist.
(d) ‘a’ opens a file for appending. The file pointer is at the start of the file, if the file exists.
Answer : A
Question. Which of the following statements correctly explain the function of seek() method?
(a) Tells the current position within the file.
(b) Determines if you can move the file position or not.
(c) Indicates that the next read or write occurs from that position in a file.
(d) Moves the current file position to a given specified position
Answer : D
3. Krrishnav is looking for his dreamjob but has some restrictions.He lovesDelhi andwould take a job there, if he is paid over ` 40000 a month. He hates Chennai and demands at least ` 100000 to work there. In any another location, he iswilling towork for ` 60000 amonth. The following code shows his basic strategy for evaluating a job offer.
pay= _________
location= _________
if location == “Mumbai”:
print (“I’ll take it!”) #Statement 1
elif location == “Chennai”:
if pay < 100000:
print (“No way”) #Statement 2
else:
print(“I am willing!”) #Statement 3
elif location == “Delhi” and pay > 40000:
print(“I am happy to join”) #Statement 4
elif pay > 60000:
print(“I accept the offer”) #Statement 5
else:
print(“No thanks, I can find something better”) #Statement 6
On the basis of the above code, choose the right statementwhichwill be executedwhen different inputs for pay and location are given.
Question. Input: location = “Chennai”, pay = 50000
(a) Statement 1
(b) Statement 2
(c) Statement 3
(d) Statement 4
Answer : B
Question. Input: location = “Surat” ,pay = 50000
(a) Statement 2
(b) Statement 4
(c) Statement 5
(d) Statement 6
Answer : D
Question. Input : location = “Any Other City”, pay = 1
(a) Statement 1
(b) Statement 2
(c) Statement 4
(d) Statement 6
Answer : D
Question. Input : location = “Delhi”, pay = 50000
(a) Statement 6
(b) Statement 5
(c) Statement 4
(d) Statement 3
Answer : C
Question. Input : location = “Lucknow”, pay = 65000
(a) Statement 2
(b) Statement 3
(c) Statement 4
(d) Statement 5
Answer : D
4. Consider the following code and answer the questions that follow:
Book={1:‘Thriller’, 2:‘Mystery’, 3:‘Crime’, 4:‘Children Stories’}
Library ={‘5’:‘Madras Diaries’,‘6’:‘Malgudi Days’}
Question. Ramesh needs to change the title in the dictionary book from ‘Crime’ to ‘Crime Thriller’. He has written the following command:
Book[‘Crime’]=’Crime Thriller’
But he is not getting the answer. Help him choose the correct command:
(a) Book[2]=‘Crime Thriller’
(b) Book[3]=‘Crime Thriller’
(c) Book[2]=(‘Crime Thriller’)
(d) Book[3] =(‘Crime Thriller’)
Answer : B
Question. The command to merge the dictionary Book with Library the command would be:
(a) d=Book+Library
(b) print(Book+Library)
(c) Book.update(Library)
(d) Library.update(Book)
Answer : D
Question. What will be the output of the following line of code:
print(list(Library))
(a) [‘5’,‘Madras Diaries’,‘6’,‘Malgudi Days’]
(b) (‘5’,’Madras Diaries’,‘6’,‘Malgudi Days’)
(c) [‘Madras Diaries’,‘Malgudi Days’]
(d) [‘5’,‘6’]
Answer : D
Question. In order to check whether the key 2 is present in the dictionary Book, Ramesh uses the following command:
2 in Book He gets the answer ‘True’. Now to check whether the name ‘Madras Diaries’ exists in the dictionary Library, he uses the following command:
‘Madras Diaries’ in Library But he gets the answer as ‘False’. Select the correct reason for this.
(a) We cannot use the in function with values. It can be used with keys only.
(b) We must use the function Library.values() along with the in operator.
(c) We can use the Library.items() function instead of the in operator.
(d) Both (b) and (c)
Answer : B
Question. With reference to the above declared dictionaries, predict the output of the following code fragments.
Answer : C
5. Arun, during Practical Examination of Computer Science, has been assigned an incomplete
search() function to search in a pickled file student.dat. The file student.dat is created by his
teacher and the following information is known about the file.
l File contains details of students in [roll_no,name,marks] format.
l File contains details of 10 students (i.e. fromroll_no 1 to 10) and separate list of each student is
written in the binary file using dump().
Arun has been assigned the task to complete the code and print details of roll number 1.
def search():
f = open(“student.dat”,____) #Statement 1
____: #Statement 2
while True:
rec = pickle.____ #Statement 3
if(____): #Statement 4
print(rec)
except:
pass
____ #Statement 5
Question. In which mode, Arun should open the file in Statement 1?
(a) r
(b) r+
(c) rb
(d) wb
Answer : C
Question. Identify the suitable code to be used at blank space in line marked as Statement 2.
(a) if(rec[0]==1)
(b) for i in range(10)
(c) try
(d) pass
Answer : C
Question. Identify the function (with argument), to be used at blank space in line marked as Statement 3.
(a) load()
(b) load(student.dat)
(c) load(f)
(d) load(fin)
Answer : C
Question. What will be the suitable code for blank space in line marked as Statement 4.
(a) rec[0]==2
(b) rec[1]==2
(c) rec[2]==2
(d) rec[0]==1
Answer : D
Question. Which statement Arun should use at blank space in line marked as Statement 5 to close the file?
(a) file.close()
(b) close(file)
(c) f.close()
(d) close()
Answer : C
6. Radha Shah is a programmer, who has recently been given a task to write a Python code to performthe followingCSVfile operationswith the help of two user defined functions/modules:
(a) CSVOpen() : to create a CSV file called BOOKS.CSV in append mode containing information of books – Title, Author and Price.
(b) CSVRead() : to display the records from the CSV file called BOOKS.CSV where the field title starts with ‘R’.
She has succeeded in writing partial code and has missed out certain statements, so she has left certain queries in comment lines.
import csv
def CSVOpen():
with open(‘books.csv’,‘______’,newline=‘ ’) as csvf: #Statement 1
cw=______ #Statement 2
______ #Statement 3
cw.writerow([‘Rapunzel’,‘Jack’,300])
cw.writerow([‘Barbie’,‘Doll’,900])
cw.writerow([‘Johnny’,‘Jane’,280])
def CSVRead():
try:
with open(‘books.csv’,‘r’) as csvf:
cr=______ #Statement 4
for r in cr:
if ______: #Statement 5
print(r)
except:
print(‘File Not Found’)
CSVOpen()
CSVRead()
You as an expert of Python have to provide the missing statements and other related queries based on the following code of Radha.
Answer any four questions (out of five) from the below mentioned questions.
Question. Choose the appropriate mode in which the file is to be opened in append mode (Statement 1).
(a) w+
(b) ab
(c) r+
(d) a
Answer : D
Question. Which statement will be used to create a csv writer object in Statement 2?
(a) csv.write(csvf)
(b) csv.writer(csvf)
(c) csvf.writer()
(d) cs.writer(csvf)
Answer : B
Question. Choose the correct option for Statement 3 to write the names of the column headings in the CSV file, BOOKS.CSV.
(a) cw.writerow(‘Title’,‘Author’,‘Price’)
(b) cw.writerow([‘Title’,‘Author’,‘Price’])
(c) cw.writerows(‘Title’,‘Author’,‘Price’)
(d) cw.writerows([‘Title’,‘Author’,‘Price’])
Answer : B
Question. Which statement will be used to read a csv file in Statement 4?
(a) cs.read(csvf)
(b) csv.reader(csvf)
(c) csvf.read()
(d) csvf.reader(cs)
Answer : B
Question. Fill in the appropriate statement to check the field Title starting with ‘R’ for Statement 5 in the above program.
(a) r[0][0]==‘R’
(b) r[1][0]==‘R’
(c) r[0][1]==‘R’
(d) r[1][1]==‘R’
Answer : A
7. Priyank is a software developer with a reputed firm. He has been given the task to computerise the operations for which he is developing a form which will accept customer data as follows:
The DATA TO BE ENTERED IS :
Name
Age
Items bought (all the items that the customer bought)
Bill amount
Question. Choose the most appropriate data type to store the above information in the given sequence.
(a) string, tuple, float, integer
(b) string, integer, dictionary, float
(c) string, integer, integer, float
(d) string, integer, list, float
Answer : D
Question. Nowthe data of each customer needs to be organised such that the customer can be identified by name followed by the age, item list and bill amount. Choose the appropriate data type that will help Priyank accomplish this task.
(a) List
(b) Dictionary
(c) Nested Dictionary
(d) Tuple
Answer : C
Question. Which of the following is the correct way of storing information of customers named ‘Paritosh’ and ‘Bhavesh’ with respect to the option chosen above?
(a) customers= {‘Paritosh’:24,[‘Printed Paper’, ‘ Penstand’], 3409, ‘Bhavesh’: 45,[‘A4 Rim’,’Printer
Cartridge’, ‘Pen Carton’, ‘Gift Wrap’], 8099.99 }
(b) customers={‘Paritosh’:[24,[‘Printed Paper’, ‘ Penstand’], 3409], ‘Bhavesh’: [45,[‘A4 Rim’,’Printer
Cartridge’, ‘Pen Carton’, ‘Gift Wrap’], 8099.99] }
(c) customers= [‘Paritosh’:24,‘Printed Paper’, ‘ Penstand’, 3409, ‘Bhavesh’: 45,‘A4 Rim’,’Printer
Cartridge’, ‘Pen Carton’, ‘Gift Wrap’, 8099.99 ]
(d) customers=(‘Paritosh’:24,[‘Printed Paper’, ‘ Penstand’], 3409, ‘Bhavesh’: 45,[‘A4 Rim’,’Printer
Cartridge’, ‘Pen Carton’, ‘Gift Wrap’], 8099.99 )
Answer : B
Question. In order to calculate the total bill amount for 15 customers, Priyank
Statement 1 must use a variable of the type float to store the sum.
Statement 2 may use a loop to iterate over the values.
(a) Both statements are correct.
(b) Statement 1 is correct, but statement 2 is not.
(c) Both statements are incorrect.
(d) Statement 1 is incorrect but statement 2 is correct.
Answer : A
8. Your teacher has given you a method/function FilterWords() in Python which read lines from a text file NewsLetter.TXT and display those words, which are lesser than 4 characters. Your teachers intentionally kept few blanks in between the code and asked you to fill the blanks, so that the code will run to find desired result. Do the needful with the following Python code.
def FilterWords():
c=0
file=open(‘NewsLetter.TXT’, ‘_____’) #Statement 1
line = file._____ #Statement 2
word = _____ #Statement 3
for c in word:
if _____: #Statement 4
print(c)
______ #Statement 5
FilterWords()
Question. Write mode of opening the file in Statement 1?
(a) a
(b) ab
(c) w
(d) r
Answer : D
Question. Fill in the blank in Statement 2 to read the data from the file.
(a) File.Read()
(b) file.read()
(c) read.lines( )
(d) readlines( )
Answer : B
Question. Fill in the blank in Statement 3 to read data word by word.
(a) Line.Split()
(b) Line.split()
(c) line.split()
(d) split.word()
Answer : C
Question. Fill in the blank in Statement 4, which display the word having lesser than 4 characters.
(a) len(c) ==4
(b) len(c)<4
(c) len ( )= =3
(d) len ( )==4
Answer : B
Question. Fill in the blank in Statement 5 to close the file.
(a) file.close()
(b) File.Close()
(c) Close()
(d) end()
Answer : A
Worksheet for CBSE Computer Science Class 12 Case Study Based Questions
We hope students liked the above worksheet for Case Study Based Questions designed as per the latest syllabus for Class 12 Computer Science released by CBSE. Students of Class 12 should download in Pdf format and practice the questions and solutions given in the above worksheet for Class 12 Computer Science on a daily basis. All the latest worksheets with answers have been developed for Computer Science by referring to the most important and regularly asked topics that the students should learn and practice to get better scores in their class tests and examinations. Expert teachers of studiestoday have referred to the NCERT book for Class 12 Computer Science to develop the Computer Science Class 12 worksheet. After solving the questions given in the worksheet which have been developed as per the latest course books also refer to the NCERT solutions for Class 12 Computer Science designed by our teachers. We have also provided a lot of MCQ questions for Class 12 Computer Science in the worksheet so that you can solve questions relating to all topics given in each chapter.
You can download the CBSE Printable worksheets for Class 12 Computer Science Case Study Based Questions for latest session from StudiesToday.com
There is no charge for the Printable worksheets for Class 12 CBSE Computer Science Case Study Based Questions you can download everything free
Yes, studiestoday.com provides all latest NCERT Case Study Based Questions Class 12 Computer Science test sheets with answers based on the latest books for the current academic session
CBSE Class 12 Computer Science Case Study Based Questions worksheets cover all topics as per the latest syllabus for current academic year.
Regular practice with Class 12 Computer Science worksheets can help you understand all concepts better, you can identify weak areas, and improve your speed and accuracy.