Sample Paper 2 2023-24
Sample Paper 2 2023-24
Sample Paper 2 2023-24
2. Rathin wants to create a table Players with a column playerid which should carry non null and unique
values.
6 *3 + 4**2 // 5 - 8
my_dict[‘age’]=27
my_dict[‘address’]=”Delhi”
print(my_dict.items())
5. A table student has 15 columns and 100 rows. 10 rows are added later. What is the degree and
cardinality of the table now?
6. ABC Incorpora on has its 3 offices in the city of Lucknow., connected together in a network. These
offices seprated by a distance of approximately 45-50KM. Which kind of network is formed?
(A) PAN (B) WAN (C) MAN (D) LAN
(A) 20 otnx SC@ (B) @20 mx S@ (C) @20 otnmx SC@ (D) @120 otnmx sc@
8. Consider following list for python language L=[13, 3.45, “Tree”, ‘Amar’, [10, 8.91, “Apple”], 456]
(A) (10, 8.91, ‘Apple’) (B) [10, 8.91, ‘Apple’] (C) {10, 8.91, ‘Apple’} (D) None of these
9. Which output lines of the following program will print the same result.
Tup1 = (10, 20, 30, 40, 50, 60, 70, 80, 90)
print(tup1[5:-1]) #1
print(tup1[5]) #2
print(tup1[5:]) #3
print(tup1[-4:8]) #4
(A) (1) and (2) (B) (1) and (4) C) (2) and (3) (D) (1), (3) and (4)
10. What possible output(s) are expected to be displayed on screen at the me of execu on of the
program from the following code? Also specify the maximum values that can be assigned to each of the
variables FROM and TO.
import random
AR=[20, 30, 40, 50, 60, 70]
FROM = random.randint(1,3)
TO= random.randint(2,4)
For K in range(FROM,TO+1):
Print(AR[K],end=’#’)
12. Given the following code. What should be filled in the missing blank for proper execu on of the
code.
def reverse(n): #func on to display the reverse of the number in the parameter
rev=0
while n>0:
d=n%10
rev=______________ + d
n//=10
print(“Reverse:”,rev)
13. State True or False: The code that may generate an excep on, has to be kept inside the try block.
14. Which of the following refers to the a ribute that can uniquely iden fy tuples within the rela on?
15. Fill the blank: ___________ switching technique follows the store and forward mechanism.
16. Which of the following statements open a csv file “stock.csv” for wri ng records into it?
In the following ques ons, A statement of Asser on(A) is following by a statement of Reason(R). Mark the
correct choice as.
17. Asser on(A): A func on is a block of organized and reusable code that is used to perform a single, related
ac on.
Reason (R) : Func on provides be er modularity for your applica on and a high degree of code reusability.
18. Asser on (A): Text file store Informa on in ASCII or Unicode characters.
Reason (R) : In text file, there is no delimiter for a line.
Sec on – B
19. (a) Assume that 50 employees are working in an organiza on. Each employee has been allo ed a
separate worksta on to work. In this way, all computer are connected through the server and all these
worksta on are distributed over two floors. In each floor, all the computers are connected to a switch.
Iden fy the type of network?
20. Asish has wri en a code , but I am ge ng some errors while execu ng it. Rewrite the correct code
removing all the errors.
Value = 30
for val in range(0,Value)
if val%4==0
print(val*4)
else if val%5 ==0:
print(val+3)
else
print(val+10)
21. Write the defini on of a method ZeroEnding(SCORES) to add all those values in the list SCORES,
which are ending with Zero(0) and display the sum.
If the SCORES contain SCORES=[200, 456, 300, 100, 234, 678]
The sum should be displayed as 600
OR
Write a func on namely big(LstStr) that reveives a list of string and display those strings that start and
end with a lowercase vowel.
22. Predict the output of the Python code given below:
23. Write the Python statement for each of the following tasks using BUILT-IN func on/method only.
(i) To add a key :value pair “Email”: sbc@gmil.com to the dic onary Empdict.
24. Abhijit has wri en a query to increase the marks of students of “Science” stream student by 5. But
he is not ge ng the correct output. Help him by the correct query.
Table Student :[Admno, Name, Class, Stream, Marks, DtofAdm]
Query: “Modify student change marks=marks+5 where stream equals “Science”
Then a er wri en a query to remove the column stream from the table
OR
Difference between char(n) and varchar(n) data types with respect to databases.
27. Emp
28. Write a func on in Python that counts the number of “Me” or “My” words present in a text file
“STORY.TXT”.
Example:
If the file content is as follows:
My first book
was Me and
My Family. It
Gave me
Chance to be
Known to the
world.
OR
Write a func on to count the number of lines star ng with a digit in a text file “Diary.txt”
29. Consider the table Teacher given below:
TABLE : TEACHER
30. Write a func on in Python , Push(SItem) where, SItem is a dic onary containing the details of
sta onary items – {sname:price}
The func on should push the names of those items in the stack who have price greater than 75. Also
display the count of elements pushed into the stack.
For Example:
If the dic onary contains the following data:
Ditem = {“Pen”:106, “Pencil”:59, “Notebook”:80, “Eraser”:25}
The stack should contain
Notebook
Oen
The output should be:
The count of elements in the stack is 2
SECTION D
31. Write SQL queries for (i) to (iv) based on table EMPLOYEE and DEPARTMENT given below:
Table : SCHOOL
Table : ADMIN
CODE GENDER DESIGNATION
1001 MALE VICE PRINCIPAL
1009 FEMALE COORDINATOR
1203 FEMALE COORDINATOR
1045 MALE HOD
1123 MALE SENIOR TEACHER
1167 MALE SENIOR TEACHER
1215 MALE HOD
(i) To display each designa on and count of each type for designa on where count<2.
(ii) To display the maximum experience.
(iii) To display the name of teachers who have more than 12 years of experience in ascending
order of teacher name
(iv) To display teacher names and corresponding department from both the tables.
32. Rohini is a CS student and has been assigned by her teacher to write func on ADD() and COUNTER()
for working with records of employees.
ADD() – To accept and add data of an employee to CSV file “record.csv” . Each record consists of list
with field elements as empid, name and sal to store employee id, employee name and employee
salary respec vely.
COUNTER() – To count the number of records present in the CSV file named ‘record.csv’.
SECTION E
(ii) A file sports.dat contains informa on about a formal Event Par cipant.
Write a func on that would read content from file sports.dat and create a file named Athle cs.dat
copying only those records from sports.dat where event name is “Athle cs”
OR
(i) How will you open a text file text.txt in write and read mode.
Arun, during Prac cal Examina on of Computer Science, has been assigned to write a search()
func on to search a record in a pickled file student.dat. The File student.dat is created by his
teacher and the following informa on is known about the file.
File contain s details of student in [rollno, name, marks] fromat.
File contains details of 10 students (i.e. from rollno 1 to 10) and separate list of each
student is wri en in the binary file using dump().
Help Arun in wri ng the code to search for the roll no passed to the func on.
35. (i) Define the term Candidate key with respect to RDBMS.
(ii) Write Python code to create a table loca on with following fields
(i) Which keyword is used to sort the records of a table in descending order?
(ii) Consider the table FACULTY and COURSES with structure as follows.
FACULTY COURCES
F_ID C_ID
Fname F_ID
LName Cname
Hiredate Fees
Salary
Write Python codes to display details of those facul es whose salary is greater than 12000.