CS-PB- Sample Paper
CS-PB- Sample Paper
Q Section-C(3x3=9Marks) Marks
No.
29. A) Write a Python function that displays all the words starting from the letter
3
‘C’ in the text file "chars.txt".
OR (3)
B)Write a Python function that can read a text file and print only numbers
stored in the file on the screen (consider the text file name as "info.txt").
30. A) You have a stack named Inventory that contains records of medicines. Each
record is represented as a list containing code, name, type and price.
Write the following user-defined functions in Python to perform the
specified operations on the stack Inventory:
i. New_In (Inventory, newdata): This function takes the stack Inventory
and newdata as arguments and pushes the newdata to Inventory stack.
ii. Del_In(Inventory): This function removes the top most record from the
stack and returns it. If the stack is already empty, the function should
display "Underflow".
iii. Show_In(Inventory): This function displays the topmost element of the (3)
stack without deleting it. If the stack is empty, the function should
display 'None'.
OR
B) Write the definition of a user-defined function `Push(x)` which accepts a
string in parameter `x` and pushes only consonants in the string `N` into a Stack
named `Consonants`.
Write function Display () to display all element of the stack.
Table: Departments
(i) To display complete details of those departments where date_join is less then
5
01-01-2010
(ii) To display the details of departments with the name of incharges containing
m in their name.
(iii) To increase the grant of department by 1200 of D_no either D99 or D23.
(iv) Select d_name, grant from department where grant is null;
OR
Select sum(grant) from department where date_join>’10-10-2020’;
35. Consider a database named ‘DB’ containing a table named ‘Vehicle’ with the
following structure
Field Type
Model char(10)
Make_year Int(4)
Qty Int(3) (4)
Price Number(8,2)
Write the following Python function to perform the following operation as mentioned:
1. Add_Vehicle() - which takes input of data and store it to the table
2. Search_vehicle() – which can search a model given by user and show it on screen
* Assume the following for Python – Database connectivity:
Host: localhost, User: root, Password: root
Q. SECTIONE(2X5=10 Marks) Mar
No. ks
36. Rajiv Kumar is an owner of a company willing to manage the data of his office
employees like their biodata, salary centrally for all his offices located in the state of
Karnataka.
He planned to make a database named ‘company’ with the table ‘staff’ that contains
following structure
- ID–integer(4)
- Name–string(30)
- Designation–string(10)
- Birth_date–date
- Salary-decimal(10,2)
You as his database administrator write the following queries (I) to (IV)
(I) Create a table ‘staff’ with above structure and id as primary key. (2)
(II) Display all the records with designation ‘Sales Executive’ (1)
(III) To change the designation = ‘Assistant’ of all the staff having salary from (1)
15000 to 17000 (both values included)
(IV) To display the total number of records with name ending at letter ‘j’ (1)
37. PK International is an advertising agency who is setting up a new office in Gurgaon in
an area of 2.5 kms with four building Admin, Finance, Development, Organizers. You
have been assigned the task to suggest network solutions by answering the following
questions (i) to (v)
6
Development-Financers 40
Finance
Organizers
Development
Admin
i) Suggest the most appropriate location of the server inside the above campus.
Justify your choice.
ii) Which hardware device can be used to connect all the computers within each
building?
iii) Draw the cable layout for economic and efficiently connect various buildings
within the campus?
iv) Whether repeater is required for your given cable layout? Yes or No? Justify
your answer.
v) A) Give your recommendation for live visual communication between all the
offices and customer located in different cities
a) Video Conferencing
b) Email
c) Telephony
d) Instant Messaging
OR
B) What type of network (PAN, LAN, MAN or WAN) will be setup
among the computers connected in this campus?