FYBSc-COMPUTER-SCIENCE-SEM2 - Slip

Download as pdf or txt
Download as pdf or txt
You are on page 1of 42

CONFIDENTIAL

Savitribai Phule Pune University


(Formerly University of Pune)

Booklet of Practical Skeleton Papers for


B.Sc. (Computer Science)
(Choice Based Credit System) (2019 Pattern)

F.Y.B.Sc. (Computer Science)


SEMESTER –II
LAB COURSE CS-123
(Advanced ‘C’ Programming
&
Relational Database Management Systems)
Important instructions to examiners:
1. It is compulsory to conduct all practicals on Linux operating
system. For database practicals, use PostgreSQL.
2. All slips are to be used for every batch.
3. Examiners should check one section each.
4. Program print-outs should be attached with the practical
examination slip.
5. Written work for RDBMS table normalization may be done on
the back side of the slip or additional Answer sheet /
supplement may be given.
6. The question-wise marks are to be written on the practical slip
and signed by each examiner.
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to find maximum of two numbers using macro. [5 marks]


ii. Write a program to compute sum and average of all elements in an [10 marks]
array using pointer.
OR
Q 1) A Write a C program to accept details of n students (roll number, name, [15 marks]
percentage) using structure. Display details of the student having
maximum percentage.

Section II : Relational Database Management Systems [15 marks]


Consider the following database
Student (roll_no integer, name varchar(30), address varchar(50), class varchar(10))
Subject (scode varchar(10), subject_name varchar(20))
Student-Subject are related with M-M relationship with attributes marks_scored.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a function which will accept the roll no and print all the
details of that student.
ii. Write a function using cursor which will accept the name of the
subject and print the roll_no, name and marks of all students for
that subject.
iii. Write a trigger which is executed when insertion is made in the
student-subject table. If marks_scored is less than 0, give
appropriate message and do not allow the insertion.

Q 3) Viva [5 marks]

Slip 1
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to display the command line arguments in [5 marks]


reverse order.
ii. Write a program to display contents of file “a.txt” on the screen. [10 marks]
OR
Q 1) A Write a menu driven program to perform the following operations on [15 marks]
strings using standard library functions:
1. Convert string to uppercase
2. Copy one string to another
3. Compare two strings
4. Concatenate two strings

Section II : Relational Database Management Systems [15 marks]


Consider the following database
Bus (bus_no int , capacity int , depot_name varchar(20))
Route (route_no int, source varchar(20), destination varchar(20), No_of_stations int)
Bus and Route are related with many to many relationship.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a stored function which will accept the route_no from user
and print all the details of that route.
ii. Write a trigger which will be executed every time insertion is
made to the Route table. If No_of_stations is less than 2 then do
not allow the insertion and display appropriate message.
iii. Write a stored function using cursor, which will give details of
all routes on which bus no 110 is running.
Q 3) Viva [5 marks]

Slip 2
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to calculate length of string using standard library [5 marks]


function.
ii. Write a program to allocate memory dynamically for n integers. [10 marks]
Accept the elements and calculate their sum and average.
OR
Q 1) A Write a program to declare a structure person (name, address) which [15 marks]
contains another structure birthdate (day, month, year). Accept the details
of n persons and display them.

Section II : Relational Database Management Systems [15 marks]


Consider the following database
Doctor (d_no int, d_name varchar(30), specialization varchar(35), charges int)
Hospital (h_no int, h_name varchar(20), city varchar(10))
Doctor and Hospital are related with many to one relationship.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a trigger before insert/update on Doctor table. Raise
exception if charges are <0 .
ii. Write a function which will accept the name of the doctor and
print the hospital details that the doctor is visiting.
iii. Write a function using cursor to accept the city name and print
the names of all hospitals in that city.

Q 3) Viva [5 marks]

Slip 3
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to calculate sum of two numbers. Pass the [5 marks]


numbers as command line arguments.
ii. Write a program to create student structure having fields roll no, [10 marks]
name. Accept details of one student and write a function to
display the details.
OR
Q 1) A Write a program to copy contents of file a.txt to b.txt by changing the [15 marks]
case of each alphabet.

Section II : Relational Database Management Systems [15 marks]


Consider the following database
Movie (m_name varchar (25), release_year integer, budget money)
Actor (a_name varchar(30), role varchar(30), charges money, a_address varchar(30) )
Movie and Actor are related with many to many relationship.

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a function which will accept the movie name as input and
prints its release year and budget.
ii. Write a function using cursor, which will accept the actor name
and print the names of all movies in which that actor has acted.
iii. Write a trigger which will be executed whenever an actor is
deleted from the actor table, display appropriate message.

Q 3) Viva [5 marks]

Slip 4
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to interchange two numbers using pointers. [5 marks]


ii. Write a program to perform the following operations on two [10 marks]
strings using standard library functions:
a. Copy b. Compare
OR
Q 1) A Write a program to read the contents of a text file and count the number of [15 marks]
characters, lines and words in the file.

Section II : Relational Database Management Systems [15 marks]


Consider the following database
Customer (cno integer, cname varchar(20), city varchar(20))
Account (a_no int, a_type varchar(10), opening_date date, balance money)
Customer and Account are related with one to many relationship

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a function which accepts account no as input and prints
the details of that account.
ii. Write a function using cursor which accepts customer name and
prints all account details of that customer. If the customer name
is invalid, print appropriate message.
iii. Write a trigger which is executed whenever update is made to
the account table. If the balance becomes less than 1000, print an
error message that balance cannot be less than 1000.
Q 3) Viva [5 marks]

Slip 5
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to compare two strings using standard library [5 marks]


function.
ii. Write a C program to copy contents of one file to another file. [10 marks]
OR
Q 1) A Write a C program to create structure employee (id, name, salary). Accept [15 marks]
details of n employees and perform the following operations:
a. Display all employees.
b. Display details of all employees having salary > ____.

Section II : Relational Database Management Systems [15 marks]

Consider the following database


Movie (m_name varchar (25), release_year integer, budget money)
Producer (p_id integer, pname vachar(30), p_address varchar (30))
Movie and Producer are related with many to many relationship.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a stored function which accepts the producer name and
prints the number of movies produced by him.
ii. Write a stored function using cursor, which will accept the
movie name and print the names of all producers who have
produced that movie.
iii. Write a trigger which will be executed whenever insertion is
made to the movie table. If the budget is less than 1,00,000 do
not allow the insertion. Give appropriate message.
Q 3) Viva [5 marks]

Slip 6
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to find maximum of two numbers using macro. [5 marks]


ii. Write a C program to store the squares of numbers 1 to n in [10 marks]
“squares.txt” file.
OR
Q 1) A Write a C program to accept n elements using dynamic memory allocation [15 marks]
and calculate the sum and average of the elements. Also find the largest
element.

Section II : Relational Database Management Systems [15 marks]

Consider the following database


Employee (e_no int, e_name varchar(30), age int, date_of joining date)
Project(p_no int, p_name varchar (25), start_date date, status varchar(10))
Employee and project are related with many to one relationship

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a function which accepts employee name and prints the
details of the project which the employee works on.
ii. Write a trigger which will be executed whenever insertion is
made to the employee table, if age is less than 21, insertion
should not be allowed.
iii. Write a function using cursor which will accept the project name
and display the names of employees working on that project.

Q 3) Viva [5 marks]

Slip 7
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program for swapping two numbers using pointers [5 marks]


ii. Write a C program to count the number of vowels and [10 marks]
consonants in a string.
OR
Q 1) A Write a C program to accept details of n items (code, name, price) using [15 marks]
structure. Perform the following operations:
a. Display all items having price > ___
b. Search for an item by name.

Section II : Relational Database Management Systems [15 marks]


Consider the following database
Teacher( t_no int, t_name varchar(20), age int, yr_experience int)
Subject (s_no int, s_name varchar(15))
Teacher and Subject are related with many to many relationship

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a function which will display the details of the teacher
having maximum experience.
ii. Write a stored function using cursor which will accept the
subject name and print the names of all teachers teaching that
subject.
iii. Write a trigger before insert/update on Teacher table. Age
should not be < 21. Print an appropriate message.
Q 3) Viva [5 marks]

Slip 8
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to display command line arguments in the [5 marks]


reverse order.
ii. Write a user defined function to calculate the length of a string. [10 marks]
Use this function in main.
OR
Q 1) A Write a C program to create a structure named student that accepts student [15 marks]
rollno, name and marks of 3 subjects. Calculate the total of marks and
percentage. Create an array of structures to enter information for n
students and display the details.

Section II : Relational Database Management Systems [15 marks]

Consider the following Item-Supplier database


Item (itemno integer, itemname varchar(20))
Supplier(supplier_no integer, supplier_name varchar(20),city varchar(20))
Item-Supplier: M-M relationship with rate(money) and quantity (integer) as descriptive attributes.

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute Any two of the following using PL/pgSQL [10 marks]
i. Write a function to display the item name with maximum
quantity.
ii. Write a cursor to display the names of suppliers in ‘Pune’ city.
iii. Write a trigger before insert or update on rate field. If the rate is
less than or equal to zero then raise appropriate exception.
Q 3) Viva [5 marks]

Slip 9
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to concatenate two strings using standard library [5 marks]


function.
ii. Write a C program to store and display the name, rollno and fees of a [10 marks]
student using structure. Pass the member of structure variable to a
function called display() to display the contents
OR
Q 1) A Write C program to copy contents of one file to another by changing case [15 marks]
of each alphabet and replacing digits by *

Section II : Relational Database Management Systems [15 marks]


Consider the following Student-Subject database
Student (rollno integer, name varchar(30),city varchar(50),class varchar(10))
Subject (scode varchar(10),subject_name varchar(20))
Student-Subject :M-M relationship with descriptive attribute marks_scored.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute Any two of the following using PL/pgSQL [10 marks]
i. Write a function to accept student name as input and displays
details of that student.
ii. Write a cursor to display the names of students who have taken
subject ___.
iii. Write a trigger which will prevent deleting students from ‘Pune’
city.
Q 3) Viva [5 marks]

Slip 10
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to find the area of a circle by using PI as [5 marks]


macro.
ii. Write a menu driven program to perform the following [10 marks]
operations on strings using standard library functions:
i) Compare ii) Copy

OR
Q 1) A Write a program to accept details of n employees (id, name, salary). [15 marks]
Display all the details. Also, search for an employee by name.

Section II : Relational Database Management Systems [15 marks]

Consider the following Customer- Account database.


Customer (cno integer, cname varchar(20), city varchar(20))
Account (accno integer, acc_type varchar(10), opening_date date, balance money)
Customer and Account are related with a one to many relationship
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute Any two of the following using PL/pgSQL [10 marks]
i. Write a function to display the number of accounts whose
opening date is before’03/07/2015’.
ii. Write a cursor to display the account details of all customers
from “Pune” city.
iii. Write a trigger before deleting an account record from Account
table. Raise a notice and display the message “Account record is
being deleted.”
Q 3) Viva [5 marks]

Slip 11
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to interchange two numbers using pointers. [5 marks]


B ii. Write a C program to count the vowels and consonants in a string. [10 marks]

OR
Q 1) A Write a C program to create a structure named book (book_name, [15 marks]
author_name and price) and display all book details having price > ____
in a proper format by passing the structure array as function argument.

Section II : Relational Database Management Systems [15 marks]

Consider the followingr Department-employee database.


Department (dno integer, dname varchar(20),city varchar(20))
Employee (eno integer, ename varchar(20), salary money)
Department and Employee are related with a one to many relationship

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute Any two of the following using PL/pgSQL [10 marks]
i. Write a function to accept department city as input and returns
the total number of departments in that city.
ii. Write a cursor to display the department-wise names of
employees whose salary is between 50000 and 70000.
iii. Write a trigger before inserting an employee record in the
Employee table. Raise an exception if salary < 0.
Q 3) Viva [5 marks]

Slip 12
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to accept and display details of one student [5 marks]


(roll number, name, percentage) using structure.
ii. Write a program to copy contents of one text file to another. [10 marks]

OR
Q 1) A Write a C program that accepts a string and character to search. The [15 marks]
program will call a function, which will search for the position of
occurrence of the character in the string and return its position. Function
should return –1 if the character is not found in the string.

Section II : Relational Database Management Systems [15 marks]


Consider the following Project-Employee database
Project (pno integer, pname varchar (30), ptype varchar (20), duration integer)
Employee (eno integer, ename varchar(20), qualification varchar(15), salary float, joining_date date)
Relationship between Project and Employee is many to many with descriptive attribute start_date,
no_of_hours_worked.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute Any two of the following using PL/pgSQL [10 marks]
i. Write a function to accept project name as input and returns the
number of employees working on the project.
ii. Write a cursor to display all projects having duration > ____.
iii. Write a trigger before insert or update on no_of_hours field. If the
no_of_hours_worked is less than zero then raise an exception and
display the appropriate message.
Q 3) Viva [5 marks]

Slip 13
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to define a macro MAX which gives the [5 marks]


maximum of two numbers. Use this macro to find the maximum of
three numbers.
ii. Write a C program to accept names of n cities and search for city [10 marks]
named “Pune”
OR
Q 1) A Accept details of n students (roll no, name, percentage) using structure. [15 marks]
Write a menu driven program for the following:

a. Display all students


b. Display all students having percentage > ___

Section II : Relational Database Management Systems [15 marks]

Consider the following Customer- Account database.


Customer (cno integer, cname varchar(20), city varchar(20))
Account (accno integer, acc_type varchar(10), opening_date date, balance money)
Customer and Account are related with a one to many relationship
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute Any two of the following using PL/pgSQL [10 marks]
i. Write a function to accept account type as input and give the
maximum account balance of that type.
ii. Write a cursor to display account details of all customers of
“Pune” city.
iii. Write a trigger before inserting an account record in Account
table and raise exception if balance is <500.
Q 3) Viva [5 marks]

Slip 14
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to compare two strings using standard library [5 marks]


function.
ii. Write a C program to accept three integers as command line [10 marks]
arguments and find the maximum of the three.
OR
Q 1) A Write a C program to copy the contents of one text file to another such [15 marks]
that uppercase alphabets are converted to lowercase, lowercase to
uppercase and digits are converted to *.

Section II : Relational Database Management Systems [15 marks]


Consider the following Department-employee database.
Department (dno integer, dname varchar(20),city varchar(20))
Employee (eno integer, ename varchar(20), salary money)
Department and Employee are related with a one to many relationship

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute Any two of the following using PL/pgSQL [10 marks]
i. Write a function to accept department name and display the
average salary of employees in that department.
ii. Write a cursor to display the names of employees who works in
“HR” department.
iii. Write a trigger before updating an employee record in the
Employee table. Raise a notice and display the message
“Employee record is being updated”.
Q 3) Viva [5 marks]

Slip 15
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to store the information of one person as his [5 marks]


Pancard number or Aadhar card number using union.
ii. Write a C program to count the number of characters and lines in a [10 marks]
text file.
OR
Q 1) A Write a program to perform the following operations on strings using user [15 marks]
defined functions:
a. Length of string
b. Copy one string to another
c. Convert string to uppercase

Section II : Relational Database Management Systems [15 marks]


Consider the following Item-Supplier database
Item(itemno integer, itemname varchar(20))
Supplier(supplier_no integer, supplier_name varchar(20), city varchar(20))
Item-Supplier: M-M relationship with rate(money) and quantity (integer) as descriptive attributes.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute Any two of the following using PL/pgSQL [10 marks]
i. Write a function to accept the city name as input and returns the
number of suppliers living in that city.
ii. Write a cursor to display the names of items whose rate is more
than 500.
iii. Write a trigger before insert or update on rate field. If the rate is
less than 50 then raise the appropriate exception.
Q 3) Viva [5 marks]

Slip 16
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to find the length of a string using standard library [5 marks]
function.
ii. Write a program to read a text file and display all the characters such [10 marks]
that the case is reversed (upper to lower and lower to upper case).
OR
Q 1) A Write a program to accept ‘n’ employee details (eno, ename, salary) and [15 marks]
display all employee details whose salary is more than 10000, by passing
array of structure to the function.

Section II: Relational Database Management Systems [15 marks]

Consider the following database


Student (Roll_No int, Sname varchar (20), Sclass char (10))
Teacher (T_No int, Tname char (20), Experience int)
Student and Teacher are related with many to many relationship with the descriptive attribute Subject.

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a trigger before insert the record of the student in the Student
table. If the Roll_No is less than or equal to zero then the trigger
gets fired and displays the message “Invalid Roll Number”.
ii. Write a cursor to accept the student's name from the user as an
input and display names of all teachers teaching that student.
iii. Write a stored function to count the number of teachers having
experience > 10 years
Q 3) Viva [5 marks]

Slip 17
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to calculate area of a circle. Use macro for PI. [5 marks]
ii. Write a program to perform the following operations on strings using [10 marks]
standard library functions:
a. Copy one string to another
b. Convert a string to uppercase.
OR
Q 1) A A file “student.txt” contains rollno, name and total_marks. Write a [15 marks]
program to read this file to display all student details on screen.

Section II: Relational Database Management Systems [15 marks]

Consider the following database


Student (Roll_No int, Sname varchar (20), Sclass char (10))
Teacher (T_No int, Tname char (20), Experience int)
The Student and Teacher are related with many to many relationship with the descriptive
attribute Subject.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a trigger before inserting the teacher record into a teacher
table. Experience should be a minimum of 4 years. If it is less than 4
years trigger gets fired and displays an appropriate message.
ii. Write a cursor to accept the student name from the user as an input
and give list of subjects taken by the student.
iii. Write a stored function to find the details of the maximum
experienced teacher.
Q 3) Viva [5 marks]

Slip 18
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to store the information of one person as his Pancard [5 marks]
number or Aadhar card number using union.
ii. Write a program to copy contents of one file to another. [10 marks]
OR
Q 1) A Write a menu driven program using standard library function [15 marks]
 To find Length of string
 To compare two strings
 To copy one string to other.
 To concatenate two strings

Section II: Relational Database Management Systems [15 marks]

Consider the following database


Project (pno int, pname char (30), ptype char (20), duration int)
Employee (eno int, ename char (20), salary float, joining_date date)
Relationship between Project and Employee is many to many with descriptive attribute
start_date.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a cursor to accept the employee name as an input parameter
and displays the names of projects of that employee.
ii. Write a stored function to count all employees who have joined
before ‘01/02/2010’.
iii. Write a trigger which ensures that if an employee's salary entered
less than zero, the trigger gets fired.

Q 3) Viva [5 marks]

Slip 19
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to interchange two numbers using pointers. [5 marks]


ii. Write a program to accept and display details of 5 students (roll no, [10 marks]
name, percentage) using structure.
OR
Q 1) A Write a program to accept a filename as command line argument and [15 marks]
count number of characters, words and lines in it.

Section II: Relational Database Management Systems [15 marks]

Consider the following database


Project (pno int, pname char (30), ptype char (20), duration int)
Employee (empno int, ename char (20), joining_date date)
The relationship between Project and Employee is many to many with descriptive attribute
start_date.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a stored function to accept empno as an input parameter from
the user and count the number of projects of a given employee.
Raise an exception if the employee number is invalid.
ii. Write a trigger before insert/update on project table. Raise an
exception if duration is <=0.
iii. Write a cursor to accept the project name as an input parameter from
the user and display the names of employees working on that
project.

Q 3) Viva [5 marks]

Slip 20
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to calculate length of string using predefined function. [5 marks]


ii. Write a program to copy the contents of one file to another. [10 marks]
OR
Q 1) A Write a program to accept names of ‘n’ cities. Find the name of the city [15 marks]
having maximum characters.

Section II: Relational Database Management Systems [15 marks]

Consider the following database


Person (pno int, name varchar (20), birthdate date, income money)
Area (aid int, aname varchar (20), area_type varchar (5) )
The person and area related to many to one relationship. The attribute ‘area_type’ can have
values either ‘urban’ or ‘rural’.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a cursor to accept a month as an input parameter from the user
and display the names of persons whose birthday falls in that
particular month.
ii. Write a trigger before inserting the record into the area table. If the
area name is null then the trigger should get fired and display an
appropriate message.
iii. Write a stored function that accepts the area name as an input
parameter from the user and displays the count of persons living in
that area.

Q 3) Viva [5 marks]

Slip 21
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Define a macro EQUALNUM to compare two numbers x and y [5 marks]


which gives 1 if they are equal and 0 otherwise. Use this in main.
ii. Write a program to accept details of n items (code, name, price) [10 marks]
using structure and display the details.
OR
Q 1) A Write a function which accepts a number and three flags as parameters if [15 marks]
number is even set first flag to 1. If number is prime set second flag to 1
and if number is divisible by 3 or 7 set the third flag to 1(pass addresses of
flags to the function.)

Section II: Relational Database Management Systems [15 marks]

Consider the following database


Person (pno int, pname varchar (20), birthdate date, income money)
Area (aid int,aname varchar (20), area_type varchar (5) )
The person and area related to many to one relationship. The attribute ‘area_type’ can have
values either ‘urban’ or ‘rural’.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a stored function to update the income of all persons living in
rural area by 10%.
ii. Write a trigger before deleting a person's record from the person's
table. Raise a notice and display the message “person record is being
deleted”.
iii. Write a cursor to display the names of persons living in urban area.
Q 3) Viva [5 marks]

Slip 22
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to create a structure student (rollno, name, [5 marks]


percentage). Initialize values for one student and display the same.
ii. Write a program to print maximum of three numbers using command [10 marks]
line argument. Display error message if user gives less number of
arguments.
OR
Q 1) A Write a menu driven program for the following options [15 marks]
a. Calculate the length of a string
b. Copy one String to another
(Write separate user defined function for each option.)

Section II: Relational Database Management Systems [15 marks]

Consider the following database


Bus (bus_no int , capacity int , depot_name varchar(20))
Route (route_no int, source varchar(20), destination varchar(20), No_of_stations int)
Bus and Route are related with many to many relationship.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a stored function which will accept the route_no from user and
print all the details of that route.
ii. Write a trigger which will be executed every time insertion is made
to the Bus table. Raise exception if Capacity is <= 0.
iii. Write a stored function using cursor, which will give details of all
buses on route from “Station” to “Airport”.
Q 3) Viva [5 marks]

Slip 23
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to accept a string and an index from user and [5 marks]
displays the character at that specific index.
ii. Write a program to accept the name of a file as command line [10 marks]
argument and display the contents of that file.
OR
Q 1) A Write a program to accept details of ‘n’ books (bno, bname, price). [15 marks]
Display all the details. Also display all books having price > p.

Section II: Relational Database Management Systems [15 marks]


Consider the following database:
Movie (m_name varchar (25), release_year integer, budget money)
Actor (a_name varchar(30), role varchar(30), charges money, a_address varchar(30) )
Movie and Actor are related with many to many relationship.

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a function which will give the average charges of an actor.
ii. Write a function using cursor, which will accept the movie name and
prints the names of all actors in that movie.
iii. Write a trigger which will be executed whenever a movie is deleted
from the movie table, display appropriate message.

Q 3) Viva [5 marks]

Slip 24
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]


Q 1) A i. Define a macro MAX which gives the maximum of two numbers. Use [5 marks]
this macro to find the maximum of two numbers.
ii.Write a program to count the total number of words in a string. [10 marks]
OR
Q 1) A Write a program to accept details of ‘n’ cricket players (name, type). If [15 marks]
type = 1 (batsman), accept batting_average. If type=2 (bowler), accept
number_wickets. Use nested union. Display information of all batsmen
and bowlers.

Section II :Relational Database Management Systems [15 marks]


Consider the following database :
Person (pnumber, pname, birthdate, income),
Area (aname,area_type).
An area can have one or more persons living in it, but a person belongs to exactly one area. The
attribute ‘area_type’ can have values either ‘urban’ or ‘rural’.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a stored function to accept area name as input and print the
names of Person living in that area. Raise an exception for an invalid
area name.
ii. Write a trigger before Deleting a record from an Area table. Display
message “Record has been Deleted “.
iii. Write a cursor to print names of all persons having income between
50000 and 100000.
Q 3) Viva [5 marks]

Slip 25
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]


Q 1) A i. Write a C program to compare one string to another using standard [5 marks]
library function.
ii. Write a program in C to display the contents of an array in the reverse [10 marks]
order using pointer.
OR
Q 1) A Write a program to create a structure employee (id, name, salary). Accept [15 marks]
details of n employees and write a menu driven program to perform the
following operations.
i) Search by name
ii) Display all

Section II : Relational Database Management Systems [15 marks]


Consider the following database:
Car (c_no int, owner varchar(20), model varchar(10), color varchar(10)
Driver (driver_no int, driver_name varchar(20), license_no int, d_age int, salary float)
Car and Driver are related with many to many relationship
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a function which accepts the driver name and counts the
number of cars driven by the driver.
ii. Write a stored function with cursor which accepts the color and
prints the names of all owners who own a car of that color.
iii. Write a trigger before insert/update on Driver. Raise exception if
driver salary is negative or zero.
Q 3) Viva [5 marks]

Slip 26
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to find maximum of two numbers using MACRO. [5 marks]


ii.Write a menu driven program to perform the following operations on [10 marks]
strings using standard library functions: i)Length ii) Copy
OR
Q 1) A Write a program to accept details of ‘n’ cricket players (name, type). If [15 marks]
type = 1 (batsman), accept batting_average. If type=2 (bowler), accept
number_wickets. Use nested union. Display information of all batsmen
and bowlers.

Section II : Relational Database Management Systems [15 marks]


Consider the following database :
Company (Name varchar(30),address (50),city varchar(20), share_value money)
Person (pname varchar(30),pcity varchar (20))
Company_Person are related with M to M relationship with descriptive attribute No_of_shares

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a stored function using cursors to accept person name as input
and print company names and shares owned by that person.
ii. Write a stored function to update the share_values by 20% for Person
“____”.
iii. Write a trigger before deleting company record. Display appropriate
message to the user.
Q 3) Viva [5 marks]

Slip 27
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]


Q 1) A i. Write a C program to calculate SQUARE of given number using [5 marks]
MACRO.
ii. Write a menu driven C program to perform the following operations [10 marks]
on strings using standard library functions:
a. Convert string to lowercase
b. Compare two strings
OR
Q 1) A Write a C program to accept file name and character as command line [15 marks]
arguments and count number of occurrences of given character in the
file.

Section II : Relational Database Management Systems [15 marks]

Consider the following database :


Student (rollno integer, name varchar(30),class varchar(10))
Subject(Scode varchar(10),subject name varchar(20))
Student and subject are related with M-M relationship with attributes marks_scored.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a stored function using cursors, to accept class from the user
and display the details of the students of that class.
ii. Write a cursor to display subject-wise average marks_scored.
iii.Write a trigger before insert/update the marks_scored. Raise
exception if Marks are negative.
Q 3) Viva [5 marks]

Slip 28
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]


Q 1) A i. Write a C program to accept a string and convert it into lower case [5 marks]
using standard library function.
ii. Write a C program to accept and display information of 5 customers [10 marks]
(customer_no, customer_name, customer_phone) using structure.
OR
Q 1) A Write a C program to accept and display a matrix of order nXn. Use [15 marks]
dynamic memory allocation. Also calculate sum of diagonal elements.

Section II :Relational Database Management Systems [15 marks]

Consider the following database :


Item (itemno integer, Itemname varchar(20), quantity integer)
Supplier(supplierno integer ,Supplier name varchar(20),city varchar(20))
Item and supplier are related with many to many relationship. Rate is descriptive attribute.

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a stored function using cursors, to accept Item name from the
user and display the Rate and Supplier Name for that Item.
ii. Write a stored function to delete records of the Item name “PEN”.
iii. Write a trigger before update on rate field. If the difference in the old
rate and new rate is more than Rs 2000, raise an exception and
display the corresponding message.
Q 3) Viva [5 marks]

Slip 29
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to find length of a string using predefined function. [5 marks]


ii. Write a program to display the elements of an array containing n [10 marks]
integers in the reverse order using a pointer to the array.
OR
Q 1) A Create a structure employee (id, name, salary). Accept details of n [15 marks]
employees and find the details of employee having maximum salary.
Write separate function.

Section II : Relational Database Management Systems [15 marks]


Consider the following database
Customer (cno integer, cname varchar(20), city varchar(20))
Account (a_no int, a_type varchar(10), opening_date date, balance money)
Customer and Account are related with one to many relationship

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a function which accepts customer name as input and counts
the total number of accounts of that customer.
ii. Write a function using cursor which accepts city name as input and
prints the details of all customers in that city
iii. Write a trigger which does not allow deletion of accounts of ___
type.
Q 3) Viva [5 marks]

Slip 30
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]


Q 1) A i. Write a program using command line arguments for addition of two [5 marks]
numbers.
ii. Write a program to read contents of a text file and display it on screen [10 marks]
OR
Q 1) A Write a menu driven program to perform the following operations on [15 marks]
strings using user defined functions:
i)Length ii)Copy

Section II : Relational Database Management Systems [15 marks]

Consider the following Department-employee database.


Department (dno integer, dname varchar(20),city varchar(20))
Employee (eno integer, ename varchar(20), salary money)
Department and Employee are related with a one to many relationship

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute Any two of the following using PL/pgSQL [10 marks]
i. Write a function to accept department name and return the
number of employees of that department.
ii. Write a cursor to accept salary as input and display the names of
employees having salary > that value.
iii. Write a trigger after insert on an employee record. Display
appropriate message when the record is inserted.
Q 3) Viva [5 marks]

Slip 31
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]


Q 1) A i. Write a program to sum of all numbers in an array using pointer. [5 marks]
ii. Write a program to copy contents of one file to another. [10 marks]
OR
Q 1) A Write a program to accept details of n students (roll number, name, and [15 marks]
percentage) using structure. Perform the following operations
using menu:
a. Display all students
b. Display all students having percentage > ___.

Section II : Relational Database Management Systems [15 marks]


Consider the following Person-Area database
Person(pnumber integer, pname varchar(20)birthdate date,income money)
Area(aname varchar(20),area_type varchar(10))
An area have one or more persons living in it, but a person belongs to exactly one area.
The attribute area_type can have values either ‘urban’ or ‘rural’.
Q 2) A Create the above database in PostGreSQL and insert sufficient records.[5 Marks]
B Execute any two of the following using PL/pgSQL [10 Marks]
i. Write a function to count the people who are born in month _______.
ii. Write a trigger which will prevent deleting persons from area________.
iii. Write a cursor to accept area_type from user and count people living in that
area.
Q 3) Viva [5 Marks]

Slip 32
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program using macro to find maximum of two numbers. [5 marks]


ii. Write a program to accept n integers and calculate their sum and [10 marks]
average. Use dynamic memory allocation.
OR
Q 1) A Write a program to read the contents of a text file and count the number of [15 marks]
characters, lines and words in the file.

Section II : Relational Database Management Systems [15 marks]

Consider the following database


Car (c_no int, owner varchar(20), model varchr(10), color varchar(10)
Driver (driver_no int, driver_name varchar(20), license_no int, d_age int, salary float)
Car and Driver are related with many to many relationship

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a function which accepts the model name and prints all
cars of that model.
ii. Write a trigger before insert/update on Driver. Raise
exception if driver age is < 21.
iii. Write a cursor which accepts the driver name and prints the
details of all cars that this driver has driven, if the driver
name is invalid, print an appropriate message.

Q 3) Viva [5 marks]

Slip 33
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to accept and display information of one person [5 marks]


(either PAN number or AADHAR number) using union.
ii. Write a program to calculate the sum and average of elements in [10 marks]
an array. Use dynamic memory allocation.
OR
Q 1) A Write a program to perform the following operations on strings using user [15 marks]
defined functions.
a. Copy one string to another
b. Calculate length of a string

Section II : Relational Database Management Systems [15 marks]

Consider the following database


Movie (m_name varchar (25), release_year integer, budget money)
Actor (a_name varchar(30), role varchar(30), charges money, a_address varchar(30) )
Movie and Actor are related with many to many relationship.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a function which will give actor details with maximum
charges.
ii. Write a function using cursor, which will accept the actor name and
prints all movie names in which that actor has acted.
iii. Write a trigger which will be executed whenever an actor is deleted
from the actor table, display appropriate message.
Q 3) Viva [5 marks]

Slip 34
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to interchange two numbers using pointers. [5 marks]


ii. Write a program to accept and display details of 5 employees (id, [10 marks]
name, salary) using structure.
OR
Q 1) A Write a program to add two matrices and display the result. Use dynamic [15 marks]
memory allocation.

Section II: Relational Database Management Systems [15 marks]

Consider the following database


Project (pno int, pname char (30), ptype char (20), duration int)
Employee (empno int, ename char (20), joining_date date)
The relationship between Project and Employee is many to many with descriptive attribute
start_date.
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a stored function to accept project type as an input and display
all project names of that type. Raise an exception if the type is
invalid.
ii. Write a trigger which will get fired before insert/update on project
table which will check the duration > 0. Display appropriate
message.
iii. Write a cursor to accept the project name as an input parameter from
the user and display the names of employees working on that
project.

Q 3) Viva [5 marks]

Slip 35
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program for swapping of two numbers using pointers [5 marks]


ii. Write a C program to count the number of uppercase and [10 marks]
lowercase characters in a string.
OR
Q 1) A Write a program to accept details of ‘n’ books (bno, bname, price) and [15 marks]
perform the following operations:
a. Display all books having price > p.
b. Search for specific book by name.

Section II : Relational Database Management Systems [15 marks]

Consider the following database


Teacher( t_no int, t_name varchar(20), age int, yr_exp int)
Subject (s_no int, s_name varchar(15))
Teacher and subject are related with many to many relationship
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a function which will accept subject name as parameter and
display all teachers teaching that subject.
ii. Write a trigger before insert/update on teacher. Raise exception if
experience < 0.
iii. Write a function which will accept experience as input and print the
teacher names having experience more than the given value.
Q 3) Viva [5 marks]

Slip 36
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a program to display elements of an array using pointer. [5 marks]


ii. Write a program to copy contents of one text file to another. [10 marks]
OR
Q 1) A Define an appropriate structure for student information - roll number, [15 marks]
birthdate, percentage. Birthdate contains three fields - day, month and
year. Write a program to accept details of n students and display them.

Section II : Relational Database Management Systems [15 marks]

Consider the following database


Doctor(d_no int, d_name varchar(30), specialization varchar(35), phone_no int, charges int)
Hospital(h_no int, h_name varchar(20), city varchar(10))
Doctor and Hospital are related with many to one relationship.

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a trigger before insert/update on Doctor. Raise exception
if charges are <0.
ii. Write a function which will accept the name of the hospital and
calculate the average charges of doctors visiting that hospital.
iii. Write a function using cursor to accept the specialization and
print the details of all doctors with that specialization.
Q 3) Viva [5 marks]

Slip 37
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]

Q 1) A i. Write a C program to compare two strings using standard library [5 marks]


function.
ii. Write a C program to accept details of n items (id, name, price) [10 marks]
using structure and display the details.
OR
Q 1) A Write a C program to copy the contents of one text file to another such [15 marks]
that uppercase alphabets are converted to lowercase, lowercase to
uppercase and digits are converted to *.

Section II : Relational Database Management Systems [15 marks]


Consider the following Department-employee database.
Department (dno integer, dname varchar(20),city varchar(20))
Employee (eno integer, ename varchar(20), salary money)
Department and Employee are related with a one to many relationship

Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute Any two of the following using PL/pgSQL [10 marks]
iv. Write a function to accept department name and display the
maximum salary of an employee in that department.
v. Write a cursor to display the department-wise names of all
employees.
vi. Write a trigger before insert/update on an employee record.
Raise exception if salary <0.
Q 3) Viva [5 marks]

Slip 38
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]


Q 1) A i. Write a program to concatenate two strings (use predefined function. [5 marks]
ii. Write a program to accept and display information (emp_no, [10 marks]
emp_name, emp_salary) of 5 employees using structure.
OR
Q 1) A Write a program to accept two filenames as command line arguments. [15 marks]
Copy the contents of the first file to the second such that the case of all
alphabets is reversed.

Section II : Relational Database Management Systems [15 marks]


Consider the following database:
Newspaper (title varchar(20), language varchar(20),Publisher varchar(20),cost money)
City (pincode varchar(6), name varchar(20), state varchar(20))
Newspaper and City are having Many to Many relationship with descriptive attribute
daily_required integer
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a stored function to accept city name as input and print the
names of Newspapers available in that City. Raise an exception for
an invalid City name.
ii. Write a trigger which will prevent deleting cities from Maharashtra
state. Display appropriate Message.
iii. Write a cursor to accept language as input and print all newspapers
of that language.
Q 3) Viva [5 marks]

Slip 39
Savitribai Phule Pune University
F.Y.B.Sc. Computer Science Practical Examination
Semester II (2019 pattern)
Laboratory Course CS-123
(Advanced ‘C’ Programming & Relational Database Management Systems)
Duration: 3 Hours Maximum Marks: 35

Day and Date: __________________________ Signature of Invigilator

Seat No: _________ Seat No (in words):________________________________________________

Marks Signature Examiner 1


+ + =
15 15 5 35 Examiner 2

Section I : Advanced ‘C’ Programming [15 marks]


Q 1) A i. Write a C program to convert a string to upper case using standard [5 marks]
library function.
ii. Write a C program to accept and display information (player_name, [10 marks]
team_name, average, highest_score,) of 5 cricketers using structure.
OR
Q 1) A Write a program to count the number of characters, lines and words in a [15 marks]
text file.

Section II : Relational Database Management Systems [15 marks]

Consider the Database as follows:


Supplier (S_no int, S_name varchar(20), S_addr varchar (20),S_city varchar(20),phone number )
Part (p_id int, p_name varchar(20), p_weight float, unit int , color varchar(10))
Supplier-Part has M-M relationship with descriptive attribute Quantity .
Q 2) A Create the above database in PostGreSQL and insert sufficient records. [5 marks]
B Execute any two of the following using PL/pgSQL [10 marks]
i. Write a PL/pgsql function to Find number of suppliers who
supplies part “Wheel”.
ii. Write a stored function using cursors to accept name of city as
input and print names of all suppliers in that city.
iii. Write a trigger before Insert or Update the Quantity field in the
Supplier_Part table. Quantity should be >30 and print a message to
the user.
Q 3) Viva [5 marks]

Slip 40

You might also like