12_CS_MODEL1_QP_2023
12_CS_MODEL1_QP_2023
General instructions:
• This question paper contains five sections, Section A to E.
• All questions are compulsory.
• Section A have 18 questions carrying 01 mark each.
• Section B has 07 Very Short Answer type questions carrying 02 marks each.
• Section C has 05 Short Answer type questions carrying 03 marks each.
• Section D has 03 Long Answer type questions carrying 05 marks each.
• Section E has 02 questions carrying 04 marks each. One internal choice is given in Q34
against part C only.
• All programming questions are to be answered using Python Language only.
Section – A
Q01. State True or False (1)
“Tuple is datatype in Python which contain data in key-value pair.”
Q02. Which of the following is not a keyword? (1)
(A) eval (B) assert
(C) nonlocal (D) pass
Q03. Given the following dictionaries (1)
dict_student = {"rno" : "53", "name" : ‘Rajveer Singh’}
dict_marks = {"Accts" : 87, "English" : 65}
Which statement will merge the contents of both dictionaries?
(A) dict_student + dict_marks (B) dict_student.add(dict_marks)
(C) dict_student.merge(dict_marks) (D) dict_student.update(dict_marks)
Q04. Consider the given expression: (1)
not ((True and False) or True)
Which of the following will be correct output if the given expression is
evaluated?
(A) True (B) False
(C) NONE (D) NULL
1
Q05. Select the correct output of the code: (1)
>>> s='[email protected]'
>>> s=s.split('kv')
>>> op = s[0] + "@kv" + s[2]
>>> print(op)
(A) mail2@kvsangathan (B) mail2@sangathan.
(C) mail2@kvsangathan. (D) mail2kvsangathan.
Q06. Which functions is used to close a file in python? (1)
(A) close (B) cloose()
(C) Close() (D) close()
Q07. Fill in the blank: (1)
command is used to change table structure in SQL.
(A) update (B) change
(C) alter (D) modify
Q08. Which of the following commands will remove the entire database from (1)
MYSQL?
(A) DELETE DATABASE (B) DROP DATABASE
(C) REMOVE DATABASE (D) ALTER DATABASE
Q09. Which of the following statement(s) would give an error after executing (1)
the following code?
D={'rno':32,'name':'Ms Archana','subject':['hindi','english','cs'],'marks':(85 ,75,89)}
print(D) #S1
D['subject'][2]='IP' #S2
D['marks'][2]=80 #S3
print(D) #S4
(A) S1 (B) S3
(C) S4 (D) S3 and S4
Q10. Fill in the blank: (1)
is a non-key attribute, whose values are derived from the primary key
of some other table.
(A) Primary Key (B) Candidate Key
(C) Foreign Key (D) Alternate Key
2
Q11. The correct syntax of seek() is: (1)
(A) seek(offset [, reference_point]) (B) seek(offset, file_object)
(C) seek.file_object(offset) (D) file_object.seek(offset [, reference_point])
Q12. Fill in the blank: (1)
The SELECT statement when combined with clause, returns records without
repetition.
(A) DISTINCT (B) DESCRIBE
(C) UNIQUE (D) NULL
Q13. Fill in the blank: (1)
is a communication methodology designed to deliver both voice and
multimedia communications over Internet protocol.
(A) SMTP (B) VoIP
(C) PPP (D) HTTP
Q14. What will the following expression be evaluated to in Python? (1)
print ( round (100.0 / 4 + (3 + 2.55) , 1 ) )
(A) 30.0 (B) 30.55
(C) 30.6 (D) 31
Q15. Which function is used to display the total number of records from a table in a (1)
database?
(A) total() (B) total(*)
(C) return(*) (D) count(*)
Q16. In order to open a connection with MySQL database from within Python (1)
using mysql.connector package, function is used.
(A) open (B) connect
(C) database() (D) connectdb()
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the
correct choice as
(A) Both A and R are true and R is the correct explanation for A
(B) Both A and R are true and R is not the correct explanation for A
(C) A is True but R is False
(D) A is false but R is True
Q17. str1= “Class” + ”Work” (1)
ASSERTION: Value of str1 will be “ClassWork”.
REASONING: Operator ‘+’ adds the operands, if both are numbers &
concatenates the string if both operands are strings.
3
Q18. Assertion: CSV (Comma Separated Values) is a file format for data (1)
storage which looks like a text file.
Reason (R): The information is organized with one record on each line and
each field is separated
by semi-colon.
Section – B
Q19. Vivek has written a code to input a number and check whether it is even or (2)
odd number. His code is having errors. Rewrite the correct code and
underline the corrections made.
Q20. Write two points of difference between Bus topology and star topology. (2)
OR
Write two points of difference between XML and HTML.
Q21. (A) Given is a Python string declaration: (2)
message='FirstPreBoardExam@2022-23'
Write the output of: print(message[ : : -3].upper())
(B) Write the output of the code given below:
d1={'rno':25, 'name':'dipanshu'}
d2={'name':'himanshu', 'age':30,'dept':'mechanical'}
d2.update(d1)
print(d2.keys())
Q22. Explain the use of ‘Foreign Key’ in a Relational Database Management (2)
System. Give example to support your answer.
4
Q23. (A) Write the full forms of the following: (2)
(i) HTTP (ii) FTP
(B) What is the use of TELNET?
Q24. Predict the output of the Python code given below: (2)
OR
Q25. Differentiate between order by and group by clause in SQL with appropriate (2)
example.
OR
5
Section – C
Q26. Write the output of the queries (i) to (vi) based on the table given below: (3)
TABLE: CHIPS
LAYS ONION 10 5
LAYS TOMATO 20 12
UNCLE CHIPS SPICY 12 10
UNCLE CHIPS PUDINA 10 12
HALDIRAM SALTY 10 20
HALDIRAM TOMATO 25 A30
(i) Select BRAND_NAME, FLAVOUR from CHIPS where PRICE <> 10;
(ii) Select * from CHIPS where FLAVOUR=”TOMATO” and PRICE > 20;
(iii) Select BRAND_NAME from CHIPS where price > 15 and QUANTITY < 15;
(iv) Select count( distinct (BRAND_NAME)) from CHIPS;
(v) Select price , price *1.5 from CHIPS where FLAVOUR = “PUDINA”;
(vi) Select distinct (BRAND_NAME) from CHIPS order by BRAND_NAME desc;
Q27. Write a function countINDIA() which read a text file ‘myfile.txt’ and print (3)
the frequency of the words ‘India’ in it (ignoring case of the word).
Example: If the file content is as follows:
INDIA is my country. I live in India. India has many states.
The countIndia() function should display the output as:
Frequency of India is 3
OR
6
Q28. (A) Consider the following tables BOOKS and ISSUED in a database named (3)
“LIBRARY”. Write SQL commands for the statements (i) to (iv).
Table: BOOKS
Table: ISSUED
BID QTY_ISSUED
HIST66 10
COMP11 5
LITR88 15
(i) Display book name and author name and price of computer type books.
(ii) To increase the price of all history books by Rs 50.
(iii) Show the details of all books in ascending order of their prices.
(iv) To display book id, book name and quantity issued for all books which
have been issued.
(B) Write the command to view all tables in a database.
Q29. Write a function lenFOURword(L), where L is the list of elements (list of (3)
words) passed as argument to the function. The function returns another
list named ‘indexList’ that stores the indices of all four lettered word of L.
For example:
If L contains [“DINESH”, “RAMESH”, “AMAN”, “SURESH”, “KARN”]
The indexList will have [2, 4]
Q30. A list contains following record of a student: (3)
[StudentName, Class, Section, MobileNumber]
Write the following user defined functions to perform given operations on the
stack named ‘xiia’:
(i) pushElement() - To Push an object containing name and mobile number of
students who belong to class xii and section ‘a’ to the stack
7
(ii) popElement() - To Pop the objects from the stack and display them.
Also, display “Stack Empty” when there are no elements in the stack.
For example:
If the lists of students details are:
[“Rajveer”, “99999999999”,”XI”, “B”]
[“Swatantra”, “8888888888”,”XII”, “A”]
[“Sajal”,”77777777777”,”VIII”,”A”]
[“Yash”, “1010101010”,”XII”,”A”]
8
Section – D
Q31 Layna creates a table STOCK to maintain computer stock in vidyalaya. After (4)
. creation of the table, she has entered data of 8 items in the table.
Q32 Vishnu is a Python programmer. He has written a code and created a binary 4
.
file record.dat with studentid, subjectcode and marks. The file contains 10
records.
He now has to update a record based on the studentid id entered by the user
and update the marks.
The updated record is then to be written in the file temp.dat. The records
which are not to be updated also have to be written to the file temp.dat. If
the student id is not found, an appropriate message should to be displayed.
As a Python expert, help him to complete the following code based on
the requirement given above:
9
(i) Which module should be imported in the program? (Statement 1)
(ii) Write the correct statement required to open a temporary file named
temp.dat. (Statement 2)
(iii) Which statement should Aryan fill in Statement 3 to read the data from
the binary file, record.dat and in Statement 4 to write the updated data in
the file, temp.dat?
10
SECTION E
Q33 Aryan Infotech Solutions has set up its new center at Kamla Nagar for its 5
.
office and web based activities. The company compound has 4 buildings as
shown in the diagram below:
11
(vii) The organisation is planning to link its sale counter situated in various
parts of the same city, which type of network out of LAN, MAN or WAN will
be formed? Justify your answer.
v) What do your mean by PAN? Explain giving example.
Q34 What is the advantage of using a csv file for permanent storage? 5
.
Write a Program in Python that defines and calls the following user defined
functions:
(i) ADD() – To accept and add data of a teacher to a CSV file ‘teacher.csv’.
Each record consists of a list with field elements as tid, name and mobile to
store teacher id, teacher name and teacher mobile number respectively.
(ii) COUNTRECORD() – To count the number of records present in the
CSV file named ‘teacher.csv’.
OR
Give any one point of difference between a binary file and a csv file.
Write a Program in Python that defines and calls the following user defined
functions:
(i) add() – To accept and add data of an employee to a CSV file
‘employee.csv’. Each record consists of a list with field elements as eid,
name and salary to store employee id, employee name and employee salary
respectively.
(ii) search()- To display the records of the employee whose salary is more
than 40000.
Q35 (A) Write the output of the code given below: 5
.
12
(B) The code given below inserts the following record in the table Student:
RollNo Name Clas Marks
* The details (RollNo, Name, Clas and Marks) are to be accepted from the user.
Write the following missing statements to complete the code:
Statement 1 – to form the cursor object
Statement 2 – to execute the command that inserts the record in the table
Student.
Statement 3 - to add the record permanently in the database
OR
13
(A) Predict the output of the code given below:
(B) The code given below reads the following record from the table named
student and displays only those records who have marks greater than 90:
RollNo Name Clas Marks
Integer String Integer Integer
14
*******END********
15