Computer Science (083) - Set1 - 24-25
Computer Science (083) - Set1 - 24-25
General Instructions:
Please check this question paper contains 37 questions. There are 10 pages
The paper is divided into 5 Sections - A, B, C, D and E.
Section A, consists of 21 questions (1 to 21). Each question carries 1 Mark.
Section B, consists of 7 questions (22 to 28). Each question carries 2 Marks.
Section C, consists of 3 questions ( 29 to 31). Each question carries 3 Marks.
Section D, consists of 4 questions (32 to 35). Each question carries 4 Marks.
Section E, consists of 2 questions (36 to 37). Each question carries 5 Marks.
All programming questions are to be answered using Python Language only.
Section A
(1 mark)
1 Usage of an undefined variable will raise a Value Error Exception. True or False [1]
i) ('Feel*Bett', 'Aft')
ii) ('Feel*Bett', '*Aft')
iii) ('Feel*Bett', 'er*')
iv) ('Feel*Bett', 'er*',’Today’)
13 Give which among the statements given below will raise an exception. [1]
dict1= { (‘pen’, ‘it01’): 200, (‘pencil’, ‘it02’): 140, (‘book’, ‘it03’) : 230 }
a) dict1.get(‘pencil’, 200) b) dict1.setdefault(‘Pen’, 210)
c) print(len(dict1)) d) print(dict1.get_keys( ))
15 The ______________ keyword will categorise the rows according to the values [1]
in a column
a) order by b) where c) group d) group by
16. Which among the following can be used to find the mean of all values present
in the quantity column.
a) avg(quantity) b) mean(quantity) c) average(quantity) d)
sum(quantity)
17. Which network device should be installed inside the system to be a part of any
network
a) NIU card b) Router c) Switch d) Modem
19. Which switching technique will send the message as a complete packet from
source to destination?
20. Assertion (A): Global variables must be declared outside of all functions but [1]
they should be declared as global inside the function
Reason (R): All functions need not access the global variables . Therefore it
should be declared global inside those which needs to access them
a) Both A and R are true and R is the correct explanation of A.
b) Both A and R are true but R is not the correct explanation of A.
c) A is true but R is false.
d) A is false and R is also false
21. Assertion (A): Order by clause requires one to group the rows into a particular [1]
category.
Reason (R): Order by will arrange the rows in ascending or descending order
of the column
a) Both A and R are true and R is the correct explanation of A.
b) Both A and R are true but R is not the correct explanation of A.
c) A is true but R is false.
d) A is false but R is true.
Section B
(2 marks)
22 How is (2,) different from [2]. [2]
Give an example of an operation that is possible with [2] and not possible with
(2,).
ii)(A) Write the statement to sort the elements of L1 into descending order.
OR
ii) (B)Write the statement to remove the element ‘c’ from L1.
25 Identify the correct output(s) of the following code. Also write the minimum and [2]
maximum possible values for the variable r1
import random
st = ('Mango', 'Pear', 'Plum', 'Apple')
r1= random.randint(1,3)
for i in range(r1,0,-1):
print(st[i], end='$')
26 Give an example of equi join between two tables. State the cardinality and the [2]
degree of relation of the equi join.
27 i) (A)State the constraints that can be set on a table with no duplicate values. [2]
OR
i) (B)State the constraint that should be set on table to enable referential
integrity.
ii) (A)Write the SQL command to make Roll_No as the primary key of an
existing table STUDENT.
OR
ii) (B)Write the SQL command to replace Roll_No ( which was set as the
Primary Key) of the table STUDENT with Admno as the Primary key.
28 (A)List one advantage and one disadvantage of Radio Waves transmission. [2]
OR
(B) Expand ARPANET. What is the significance of ARPANET.
Section C
(3 marks)
29 (A)Write a Python function Find() which will read a Python program file [3]
“Myfirst.py” and display the number of lines in the file which has a print function
in it.
OR
(B)Write a Python function Create() which will read a Text file ‘Text.txt’ and add
on the number of characters in each word alongside the word in the file. Finally
read the file and display the contents.
e.g. if the file has data :-
The night sky
has thousand stars
Then the file should have the following data after program execution:-
The3 night5 sky3
has3 thousand8 stars5
30 (A)Write a Python program to implement stack operation on records of faculty [3]
stored into a variable Faculty which is a dictionary :-
{ Fac_id : [Fac_Name, Dept], Fac_id: [Fac_name, Dept],………..}
i) Write a push() function which takes Fac_stack and Faculty as parameters.
Push(Fac_Stack, Faculty) function should push the names of Faculty into
Fac_Stack from the dept “Mathematics”.
ii) Write the pop(Fac_Stack) function which will pop the topmost element from
the stack and prints the element. The pop() should return “Underflow” when
there are no more elements in the stack
iii) Write the peek(Fac_Stack) function to display the top most element in the
stack.
OR
(B)Write a Python program to push all the digits present in a number into a
stack and pop out the digits one by one and display the number as digits pop
out.
Write Push() and POP() functions for the stack operation.
OR
(B)
i) Add a column Place of type string to the above table.
ii) Display the names, DOJ and Bonus of employees who get bonus.
iii) Display the average salary of the employees who joined between 2020-01-
01 and 2019-02-20.
Section D
(4 marks)
32 (A) [4]
i) What are run time errors? Give an example.
ii) Study the program given below and state the type of error(s) that will be
trapped (if any) while executing the following program. Also give the output.
try:
x=10
num += x
print(x)
except:
print("Num is not defined")
else:
print("Successful execution")
finally:
print("Exit")
OR
(B)
i) What are compile time errors. Give an example.
ii) Study the program given below and give the output.
try:
x="Hello Python"
num = x+ 3.82
print(num)
except NameError:
print("Name Error")
except ValueError:
print("ValueError")
except TypeError:
print("TypeError")
finally:
print("Exit")
33. a) What is the importance of newline while writing data into a csv file?
b) A CSV file Item.csv has the following data:
Item Number
Name of Item
Supplier code
Quantity
Rate
Date of Purchase
i) Write a function in Python Copy( SUP_CODE) which will copy the records
from Item.csv to another file copy_item.csv all those records where Supplier
code is same as SUP_CODE.
ii) Write a function in Python DEL_REC( SUP_CODE) which will delete the
records from Item.csv all those records where Supplier code is same as
SUP_CODE.
34 Study the following tables Doctor and Patient and write the SQL commands for [4]
the following:-
Table Doctor:
ID Name DEPT Gender Experience
D01 Dr. Lally Gynoecology F 20
D02 Dr. Ninan Skin M 17
D03 Dr. Harish Opthamology M 18
D04 Dr. Bimal Cardiology M 14
D05 Dr. Sophia Cardiology F 21
D06 Dr. Neena Paediatric F 19
Table : Patient
35 The Sports ACADEMY has stored the details of the students in the database [4]
“SPORTS” in a table called Students.
The data in the students table contains data such as:
i) Name_Student String
ii) StudentId Integer
iii) Game String
iv)Category String
v) Age Integer
Username - root
Password - tiger
Host - localhost
Write a user defined function ADD_DATA() which accepts the values from the
user and stores the data into the table student.
Write a user defined function Connect(Name_sport) in Python to read the
content of the above file and display the Names of students, Category and Age
who have the sports Name_sport .
Section E
(5 marks)
36. Sister Mathilda runs an orphanage called ANGELS which houses female [5]]
children right from few days old to 12 yrs of age. Many people comes to her
orphanage to adopt these children. She wants to maintain the details of these
children in a file with following details.
Child_ID Integer
Name_Child String
Gender String
Date_entry Date
Adopted_Parent String ( value as NONE if no adoption)
As a programmer, you have been assigned to do the following tasks:
i) State the type of file (text, csv or binary) that you would use to store the
above data . Give your reason to support your answer.
ii) Write a function entry() to enter data into the above file as suggested by you
in (i)
iii) Write a function Adopted() to display the Name of the child along with
Adopted Parent who were adopted.
37 National Law School is setting up its offices at Jaipur and planning to set up a [5]
network. The university has 3 academic schools and one administration centre
as shown in the diagram below:
The National Law school also would
like to set up a connection with their
head office at Delhi which is 600
kms from there.
*************************************************************************************************