Download - Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Transcript
Page 1: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Slip 1UNIVERSITY OF PUNE

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct - 2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ’

[Duration: 3 Hours] [Maximum Marks80]

Q.1.

a)Accept dimensions of a cylinder and print the surface area and volume (Hint: surface area = 2πr2 +2πrh, volume = πr2h)

[ 15 marks ]

b) Write a program, which accepts a number n and displays each digit in words. Example: 6702Output = Six-Seven-Zero-Two.

[ 20 marks ]

Q 1 ORWrite a menu driven program to perform the following operations on a square matrix. Write separate functions for each option.

i) Check if the matrix is symmetric.ii) Exit

[ 35 marks ]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks]Country (c_code, c_name, capital, continent)Population (p_code, population)

Country and Population are related with one-to-one relationship.Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF.

Insert 5 records in each table.

Solve the following Queries in SQL.1) Add constraint to Country table such that country name should not be null.2) Display all the records from both the tables.3) List the details of the country whose capital is ‘Delhi’.4) Find the name and population of country whose capital is “Tokyo”.5) List all the countries from Asia continent.6) Change the capital as Tokyo for the country whose code is 25.7) Delete the country details of Europe continent.

OR7) Solve the following queries.

i) List the country with highest population.ii) List population of country whose code is 20.iii) Remove table Population from database.

Q 3. Viva [10 marks]

Page 2: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Slip2UNIVERSITY OF PUNE

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct-2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks]

Doctor (dno, dname, address, city) Patient (opdno, pat_name, addr, disease) Patient and Doctor related many-to-many relationship with an attribute Fee. Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF.

Insert 5 records in each table.

Solve the following Queries in SQL.1) Add constraint to Doctor table such that address should not be null.2) Display records from all the tables.3) List all the details of doctors from ‘Nagpur’.4) Find the number of patients suffering from “Asthama”, and have been charged a fee of Rs 200,

by “Dr. Kumar”.5) List the patient details who are suffering from T.B. or cancer.6) Find all patients of “Dr. Apte” who are suffering from “T.B”. 7) Increase the fee of “Dr. Kulkarni“ by 5%.

OR 7) Solve the following queries.

i) Find the name of doctor who charges the maximum fee.ii) Delete records of patient suffering from “Cancer”.iii) Remove table patient from database.

Q 3 . Viva [10 marks]

Q.1. a) Accept temperatures in Fahrenheit (F) and print it in Celsius(C) and Kelvin (K)

(Hint: C=5/9(F-32), K = C + 273.15)

[ 15 marks ]

b) Write a program to accept two integers x and n and compute xn

[20 marks ]

Q 1. ORWrite a program to accept a decimal number and convert it to binary, octal Write separate functions.

[ 35 marks ]

Page 3: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Slip3UNIVERSITY OF PUNE

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q.2 Create the following tables. (Primary Keys are underlined) [35 Marks] Person (pnumber, pname, birthdate, income) Area (aname, area_type,pincode , city)

Person & Area related with many-to-one relationship.The attribute ‘area_type’ can have values as either ‘urban’ or ‘rural’.Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF.Insert atleast 5 records in each table

Solve the following Queries in SQL .1) add a constraint to the person table such that income is greater than zero.2) List the names of all people living in ‘rural’ area.3) List the names of all people whose birthday falls in the month of ‘Feb’4) List the details of people living in ‘urban’ and having income greater than 10,0005) List the people who are living in same area as “Mr. Joshi”& having same income as “Mr.

Joshi”.6) Give a raise of 20% to People earning less than the income Rs.10,000.7) Delete information of all people staying in ‘urban’ area

OR 7) Solve the following queries.

i) List the details of areas, which the maximum number of people.ii) List names of people with Lowest incomeiii) Remove the table Area from the database.

Q 3 . Viva [10 marks]

Q 1a) Accept the cost price and selling price from the keyboard. Find out if the

seller has made a profit or loss and display how much profit or loss has been made.

[ 15 marks ]

b) Write a program to accept an integer, count number of digits and calculate sum of digits in the number. Example: Number = 1234 Output: Digits = 4, Sum = 10

[ 20 marks ]

Q 1

OR

Write a program to find the union of the two sets of integers. Store them in another array. [ 35 marks ]

Page 4: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Slip4UNIVERSITY OF PUNE

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct-2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q.2 Create the following tables. (Primary Keys are underlined) [35 Marks] Emp(eno,ename,designation,sal) Dept(dno,dname,loc) Dept & Emp related with one-to-many relationship .

Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table.

Solve the following Queries in SQL .1) Give a 5% raise in salary to employees of ‘Finance’ department.2) Delete details of all employees of deparment 30;3) Modify the employee schema, to add a phone-no column.4) List all the employees of department 10 & 205) Display min,max,avg salary of each department, located in “pune” .6) List employees working at departments located at Calcutta.7) List the total amount spent as salary for each department in decreasing order of total salary.

OR 7) Solve the following queries: i) List the employees having salary less than 40,000. ii) List the names of employees who do not work in “sales” department. iii) Remove the table employee from the database.

Q 3 . Viva [10 marks]

Q 1a) A cashier has currency notes of denomination 1, 5 and 10. Accept the

amount to be withdrawn from the user and print the total number of currency notes of each denomination the cashier will have to give.

[ 15 marks ]

b) Write a program to accept an integer and reverse the number. Example: Input: 546, Reverse =645.

[ 20 marks ]

Q 1 ORWrite a program to find the intersection of the two sets of integers. Store them in another array.

[ 35 marks ]

Page 5: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Slip5UNIVERSITY OF PUNE

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct-2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1a) Accept initial velocity (u), acceleration (a) and time (t). Print

the final velocity (v) and the distance(s) travelled. (Hint: v = u + at, s = u + at2)

[ 15 marks ]

b) Accept a single digit from the user and display it in words. For example, if digit entered is 9, display Nine.

[20 marks ]

Q 1 ORWrite a program to merge two sorted arrays into a third array such that the third array is also in the sorted order. [ 35 marks ]

Q.2 Create the following tables. (Primary Keys are underlined) [35 Marks] Property(pno,description, city,price) Owner(ono,oname,address,phone) Property and Owner related with many –to –one relationship. Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table.

Solve the following Queries in SQL.1) Add a constraint to the property table such that information of properties belonging to ‘pune’,

’mumbai’ and ’calcutta’, are only stored in the table.2) Modify the phone no of “Mr. Nene” to 9890278008.3) Remove all properties belonging to “pune” city and owned by “ Mr. Joshi”4) List the details of the properties that cost in the range of 500000-1000000.5) Display records of Owner who has more than 2 properties.6) Display the pno, description from Property where area is pune. 7) List the names of the owners who own all their properties in the same city where “Mr.Joshi” lives.

OR 7) Solve the following Queries: i) Display all the records from both tables. ii) List the names of the owners who own a ‘bungalow’ or a ‘Flat’. iii) Remove the table Owner, from the database.

Q 3 . Viva [10 marks]

Page 6: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Slip6UNIVERSITY OF PUNE

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1a) Accept inner and outer radius of a ring and print the

perimeter and area of the ring (Hint: perimeter = 2 π (a+b) , area = π (a2-b2)

[ 15 marks ]

b) Accept radius from the user and write a program having menu with the following options and corresponding actionsOptions

1. Area of Circle Compute 2. Circumference of Circle 3. Volume of Sphere

[ 20 marks ]

Q 1 ORWrite a program to accept an mXn matrix and display an m+1 X n+1 matrix such that the m+1th row contains the sum of all elements of corresponding row and the n+1th column contains the sum of elements of the corresponding column.Write separate functions to accept and display the matrix.A B1 2 3 1 2 3 64 5 6 4 5 6 157 8 9 7 8 9 24

12 15 18 45

[ 35 marks ]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks] Student (rno,name,city) Teacher(tno,tname) Student & Teacher are related with Many –to-many relationship with ‘subject’ and ‘marks’ as attribute. Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table. Solve the following Queries in SQL .

1) List the names of students from ‘Pune’ .2) List the names of teachers who are teaching more than 2 subjects.3) Change the marks of ‘Sandeep’, for ‘maths’ subject to 70.4) Modify the student table structure to add a column ‘Status’ with constraint, values are

(‘pass’,’fail’).5) Delete all students whose Status is fail. 6) Display the records of all tables.7) List names of students who got greater than 65 marks in comp.sci subject in ascending order of

rno.OR

7) Solve the following Queries i) List the names of teachers who do not teach any subject. ii) List the names of students who got max,min avg marks with their teacher name. iii) Remove the table Teacher from the database.

Page 7: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Q 3 . Viva [10 marks] Slip7

UNIVERSITY OF PUNEF.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct-2014.

Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Write a program to accept a character, an integer n and display the next n characters

[ 15 marks ]

b) Write a program to check whether given character is a digit or a character .if it is a character check if it is in lowercase or uppercase alphabet.

[ 20 marks ]

Q 1

OR

Write a menu driven program to perform the following operations on a square matrix. Write separate functions for each option.

i) Check if it is an identity matrix.

ii)exit

[ 35 marks ]

Q 2 Create the following tables. (Primary Keys are underlined) [35 Marks] Item (item_no, name, quantity) Supplier (s_no, name, city, phone_no)

Item and supplier are related with many–to–many relationship, with rate as descriptive attribute.

Draw an E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table. Solve the following Queries in SQL .

1) Add a constraint to Item table, such that quantity > 0.2) List all records from all the tables.3) List the details of the suppliers whose name begins with ‘M’.4) Increase the rate by 5% for the item name “mouse”.5) Delete supplier details who are from ‘Pimpri’.6) List supplier wise items supplied.7) Display list of all supplier who supply “CD” and rate is more than 12.

OR 7) Solve the following queries: i)List the item name having maximum quantity. ii)Display the rate of item ‘mouse’. iii) Remove table Item from the database. Q 3 . Viva [10 marks]

Page 8: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Slip8UNIVERSITY OF PUNE

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Write a program to accept a number and check if it is divisible by 5 and 7.

[ 15 marks ]

b) Write a recursive function to calculate the sum of digits of a number till you get a single digit number. Example: 961 -> 16 -> 5. (Note: Do not use a loop)

[ 20 marks ]

Q 1 ORWrite a menu driven program to perform the following operations on a square matrix. Write separate functions for each option

i) Display the trace of the matrix (sum of diagonal elements). ii)exit

[ 35 marks ]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks] Movie (mvno,mvname,release_year) Actor (actno,actname)

Movie and Actor are related with many–to–many relationship. Draw an E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF.

Insert 5 records in each table. Solve the following Queries in SQL .

1) Add a constraint to movie table such that release year of movie should be > 0.2) List records from all the tables.3) Find all movies which are released in year 1999.4) Delete records of movies in which “Madhuri” has acted. 5) Change the release year of movie “DDLJ” to 2005.6) Find all actors of movie “Sarfarosh”.7) List the details of the movies whose names are neither ”Sarfarosh” nor “ DDLJ”

OR 7) Solve the following queries: i) List names of all actors in descending order. ii) Count the no. of movies in which “Shahrukh” has acted. iii) Remove table Movie from database.

Q 3 . Viva [10 marks]

Page 9: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Slip9UNIVERSITY OF PUNE

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Accept a character from the keyboard and display its previous and next character in order.

[ 15 marks ]

b) Accept a single digit from the user and display it in words. For example, if digit entered is 9, displayNine.

[ 20 marks ]

Q 1 ORWrite a function for Linear Search, which accepts an array of n elements and a key as parametersand returns the position of key in the array and -1 if the key is not found. Accept n numbers from theuser, store them in an array. Accept the key to be searched and search it using this function. Displayappropriate messages.

[ 35 marks ]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks] Policy (pno,pname,premium_amt,policy_type) Customer(cno,cname.city, agent_name)

Customer & Policy are related with One – to - Many relationship. Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table.

Solve the following Queries in SQL . 1) Add constraint to Policy table such that Policy_type should be ‘ yearly’ , ‘Half-yearly’ or

‘Monthly’. 2) Display records from all the tables.3) Change premium amount to 15000, for policy “Jeevan Anand” of type “Half-yearly”.4) Delete the details customers info who had bought policy from Agent ‘joshi’.5) List the details of policies that are of type “Monthly paying”.6) List the names of customers who have drawn atleast two policies from “Mr. Joshi”.7) List the details of customers and their policy details who lives in ‘Nasik’ and ‘Pune’

OR 7) Solve the following query:

i) List the names of customer whose agent name starts with ‘J’.ii) List the details of the policies whose premium is more than 50000.iii) Remove table Policy from database.

Q 3 . Viva [10 marks]

Page 10: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Slip10UNIVERSITY OF PUNE

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1a) Write a program to accept an integer and check if it is even or odd.

[ 15 marks ]

b) Write a program having a menu with the following options and corresponding actions Options Actions 1. Area of square Accept 2. Area of Rectangle 3. Area of triangle

[ 20 marks ]

Q 1 ORWrite a menu driven program to perform the following operations on a square matrix. Write separate functions for each option.

i) Check if the matrix is a lower triangular matrix.

ii) EXIT

[ 35 marks ]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks] Car (cno, car_model, owner_name, price) Driver (dno, drv_name, drv_city) Car and Driver are related with many-to-many relationship with acc_year and acc_place as attributes. Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table.

Solve the following Queries in SQL .1) Add constraint to car_driver table such that year of accident > 1990.2) List the name of drivers who lives in “Mumbai”.3) List details of drivers whose name begins with ‘B’.4) Display the details of the drivers whose names are neither ‘Mahesh’ nor ‘Sunil’5) Change driver no to 40 of “sachin” who live in “Pune”.6) Delete the car details owned by ‘Mr. Joshi’.7) List all accidents along with their place and cars involved in those accidents that took

place in the years 2002, 2003, 2005.OR

7) i) Find the names of cars whose price is between 300000 to 700000. ii) Display records from all the tables. iii) Remove table Driver from database.

Page 11: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Q 3 . Viva [10 marks] Slip11

UNIVERSITY OF PUNEF.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.

Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘ [Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Write a program to accept three numbers and check whether the first is between the other two numbers. Ex: Input 20 10 30. Output: 20 is between 10 and 30.

[ 15 marks ]

b) Write a program to display the first n Fibonacci numbers. (1 1 2 3 5 ……)

[ 20 marks ]

Q 1

ORWrite a program to accept a decimal number and convert it to hexadecimal . Write separate functions. [ 35 marks ]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks]Country (c_code, c_name, capital, continent)Population (p_code, population)

Country and Population are related with one-to-one relationship.Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF.

Insert 5 records in each table.

Solve the following Queries in SQL.1) Add constraint to Country table such that country name should not be null.2) Display all the records from both the tables.3) List the details of the country whose capital is ‘Delhi’.4) Find the name and population of country whose capital is “Tokyo”.5) List all the countries from Asia continent.6) Change the capital as Tokyo for the country whose code is 25.7) Delete the country details of Europe continent.

OR7) Solve the following queries.

i. List the country with highest population.ii. List population of country whose code is 20.iii. Remove table Population from database.

Q 3 . Viva [10 marks]

Page 12: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Slip12UNIVERSITY OF PUNE

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Write a program to accept a number and check if it is divisible by

5 and 7.

[ 15 marks ]

b) Write a program to accept real number x and integer n and calculate the sum of first n terms of the series x+ 3x+5x+7x+…

[ 20 marks ]

Q 1 ORWrite a recursive C function to print the digits of a number in reverse order. Use this function inmain to accept a number and print the digits in reverse order separated by tab.Example 34566 5 4 3

[ 35 marks ]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks]

Doctor (dno, dname, address, city) Patient (opdno, pat_name, addr, disease) Patient and Doctor related many-to-many relationship with an attribute Fee. Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF.

Insert 5 records in each table.

Solve the following Queries in SQL.1) Add constraint to Doctor table such that address should not be null.2) Display records from all the tables.3) List all the details of doctors from ‘Nagpur’.4) Find the number of patients suffering from “Asthama”, and have been charged a fee of Rs 200,

by “Dr. Kumar”.5) List the patient details who are suffering from T.B. or cancer.6) Find all patients of “Dr. Apte” who are suffering from “T.B”. 7) Increase the fee of “Dr. Kulkarni “ by 5%.

OR 7) Solve the following queries.

i. Find the name of doctor who charges the maximum fee.ii. Delete records of patient suffering from “Cancer”.iii. Remove table patient from database.

Page 13: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Q 3 . Viva [10 marks] Slip13

UNIVERSITY OF PUNEF.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct-2014.

Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘[Duration: 3 Hours] [Maximum Marks80]

Q 1a) Write a program, which accepts annual basic salary of an employee and calculates and displays the Income tax as per the following rules. Basic: < 1,50,000 Tax = 0 1,50,000 to 3,00,000 Tax = 20%

> 3,00,000 Tax = 30%

[ 15 marks ]

b)Write a program to display multiplication tables from ___ to ___ having n multiples each. The output should be displayed in a tabular format. For example, the multiplication tables of 2 to 9 having 10 multiples each is shown below. 2 × 1 = 2 3 × 1 = 3 ………….9 × 1 = 9 2 × 2 = 4 3 × 2 = 6…………..9 × 2 = 18 2 × 10 = 20 3 × 10 = 30………..9 × 10 = 90

[ 20 marks ]

Q 1

OR

Write a program to accept n numbers and store all prime numbers in an array called prime. Display this array.

[ 35 marks ]

Q.2 Create the following tables. (Primary Keys are underlined) [35 Marks] Person (pnumber, pname, birthdate, income) Area (aname, area_type,pincode , city)

Person & Area related with many-to-one relationship.The attribute ‘area_type’ can have values as either ‘urban’ or ‘rural’.Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF.Insert atleast 5 records in each tableSolve the following Queries in SQL .

1) add a constraint to the person table such that income is greater than zero.2) List the names of all people living in ‘rural’ area.3) List the names of all people whose birthday falls in the month of ‘Feb’4) List the details of people living in ‘urban’ and having income greater than 10,0005) List the people who are living in same area as “Mr. Joshi”& having same income as

“Mr. Joshi”.6) Give a raise of 20% to People earning less than the income Rs.10,000.7) Delete information of all people staying in ‘urban’ area

OR 7) Solve the following queries.

i. List the details of areas, which the maximum number of people.ii. List names of people with Lowest incomeiii. Remove the table Area from the database.

Q 3 . Viva [10 marks]

Page 14: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Slip14UNIVERSITY OF PUNE

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct-2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Accept a character from the user and check whether the character is a vowel or consonant. (Hint:

a,e,i,o,u, A, E, I, O, U are vowels)

[ 15 marks ]

b) Write a program display n lines as follows (here n=4). A B C D E F G H I

J

[ 20 marks ]

Q 1

OR

Write a function to sort an array of n integers using Bubble sort method. Accept n numbers from the user, store them in an array and sort them using this function. Display the sorted array.

[ 35 marks ]

Q.2 Create the following tables. (Primary Keys are underlined) [35 Marks] Emp(eno,ename,designation,sal) Dept(dno,dname,loc) Dept & Emp related with one-to-many relationship .

Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table.

Solve the following Queries in SQL .1) Give a 5% raise in salary to employees of ‘Finance’ department.2) Delete details of all employees of deparment 30;3) Modify the employee schema, to add a phone-no column.4) List all the employees of department 10 & 205) Display min,max,avg salary of each department, located in “pune” .6) List employees working at departments located at Calcutta.7) List the total amount spent as salary for each department in decreasing order of total salary.

OR 7) Solve the following queries: i) List the employees having salary less than 40,000. ii) List the names of employees who do not work in “sales” department. iii) Remove the table employee from the database.

Q 3 . Viva [10 marks]

Slip15

Page 15: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

UNIVERSITY OF PUNEF.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.

Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Accept any year as input through the keyboard. Write a program to check whether the year is a leap year or not.

[ 15 marks ]

b) Write a recursive C function to calculate the GCD of two numbers. Use this function in main. The GCD is calculated as : gcd(a,b) = a if b = 0

= gcd (b, a mod b) otherwise

[ 20 marks ]

Q 1

OR

Display all perfect numbers below 500. [A perfect number is a number, such that the sum of its factors is equal to the number itself]. Example: 6 (1 + 2 + 3), 28 (1+2+4+7+14)

[ 35 marks ]

Q.2 Create the following tables. (Primary Keys are underlined) [35 Marks] Property(pno,description, city,price) Owner(ono,oname,address,phone) Property and Owner related with many –to –one relationship. Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table.

Solve the following Queries in SQL.1) Add a constraint to the property table such that information of properties belonging to ‘pune’,

’mumbai’ and ’calcutta’, are only stored in the table.2) Modify the phone no of “Mr. Nene” to 9890278008.3) Remove all properties belonging to “pune” city and owned by “ Mr. Joshi”4) List the details of the properties that cost in the range of 500000-1000000.5) Display records of Owner who has more than 2 properties.6) Display the pno, description from Property where area is pune. 7) List the names of the owners who own all their properties in the same city where “Mr.Joshi” lives.

OR 7) Solve the following Queries: i) Display all the records from both tables. ii) List the names of the owners who own a ‘bungalow’ or a ‘Flat’. iii) Remove the table Owner, from the database.Q 3 . Viva [10 marks]

Slip16 UNIVERSITY OF PUNE

Page 16: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Accept a single digit from the user and display it in words. For example, if digit entered is 9, display Nine.

[ 15 marks ]

b) Write a menu driven program to perform the following operations till the user selects Exit. Accept appropriate data for each option. Use standard library functions from math.h i. Power ii. Square Root iii. Floor iv. Ceiling v. Exit

[ 20 marks ]

Q 1

OR

Write a program to display all Armstrong numbers between 1 and 500. (An Armstrong number is a number such that the sum of cube of digits = number itself Ex. 153 = 1*1*1 + 5*5*5 + 3*3*3

[ 35 marks ]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks] Student (rno,name,city) Teacher(tno,tname) Student & Teacher are related with Many –to-many relationship with ‘subject’ and ‘marks’ as attribute. Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table.

Solve the following Queries in SQL .1) List the names of students from ‘Pune’ .2) List the names of teachers who are teaching more than 2 subjects.3) Change the marks of ‘Sandeep’, for ‘maths’ subject to 70.4) Modify the student table structure to add a column ‘Status’ with constraint, values are

(‘pass’,’fail’).5) Delete all students whose Status is fail. 6) Display the records of all tables.7) List names of students who got greater than 65 marks in comp.sci subject in ascending order of

rno.OR

7) Solve the following Queries i) List the names of teachers who do not teach any subject. ii) List the names of students who got max,min avg marks with their teacher name. iii) Remove the table Teacher from the database.

Q 3 . Viva [10 marks]Slip17

UNIVERSITY OF PUNE

Page 17: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Write a program, which accepts two integers and an operator as a character (+ - * /), performs the corresponding operation and displays the result.

[ 15 marks ]

b) Accept n numbers and display the number having the maximum sum of digits

[ 20 marks ]

Q 1

OR

Write a recursive C function to calculate the sum of digits of a number. Use this function in main to accept a number and print sum of its digits.

[ 35 marks ]

Q 2 Create the following tables. (Primary Keys are underlined) [35 Marks] Item (item_no, name, quantity) Supplier (s_no, name, city, phone_no)

Item and supplier are related with many–to–many relationship, with rate as descriptive attribute.

Draw an E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table. Solve the following Queries in SQL .

1) Add a constraint to Item table, such that quantity > 0.2) List all records from all the tables.3) List the details of the suppliers whose name begins with ‘M’.4) Increase the rate by 5% for the item name “mouse”.5) Delete supplier details who are from ‘Pimpri’.6) List supplier wise items supplied.7) Display list of all supplier who supply “CD” and rate is more than 12.

OR 7) Solve the following queries: i)List the item name having maximum quantity. ii)Display the rate of item ‘mouse’. iii) Remove table Item from the database.

Q 3 . Viva [10 marks]

Slip18 UNIVERSITY OF PUNE

Page 18: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Write a program, which accepts a character from the user and

checks if it is an alphabet, digit or punctuation symbol. If it is an

alphabet, check if it is uppercase or lowercase and then change

the case.

[ 15 marks ]

b) Write a program to accept an integer n and display all even

numbers upto n.[ 20 marks ]

Q 1

ORWrite a menu driven program to perform the following operations on a square matrix. Write separate functions for each option

i) Check if the matrix is symmetric.ii) Exit

[ 35 marks ]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks] Movie (mvno,mvname,release_year) Actor (actno,actname)

Movie and Actor are related with many–to–many relationship. Draw an E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF.

Insert 5 records in each table. Solve the following Queries in SQL .

1) Add a constraint to movie table such that release year of movie should be > 0.2) List records from all the tables.3) Find all movies which are released in year 1999.4) Delete records of movies in which “Madhuri” has acted. 5) Change the release year of movie “DDLJ” to 2005.6) Find all actors of movie “Sarfarosh”.7) List the details of the movies whose names are neither ”Sarfarosh” nor “ DDLJ”

OR 7) Solve the following queries: i) List names of all actors in descending order. ii) Count the no. of movies in which “Shahrukh” has acted. iii) Remove table Movie from database.

Q 3 . Viva [10 marks]

Slip19

Page 19: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

UNIVERSITY OF PUNEF.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct.

Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Write a program to accept an integer n and display all even

numbers upto n.[ 15 marks ]

b) Write a program to accept n numbers and display the array in the reverse order.

[ 20 marks ]

Q 1

OR

Write a function that accepts a character as parameter and returns 1 if it is an alphabet, 2 if it is a digit and 3 is it is a special symbol. In main, accept characters till the user enters EOF and use the function to count the total number of alphabets, digits and special symbols entered.

[ 35marks ]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks] Policy (pno,pname,premium_amt,policy_type) Customer(cno,cname.city, agent_name)

Customer & Policy are related with One – to - Many relationship. Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table.

Solve the following Queries in SQL . 1) Add constraint to Policy table such that Policy_type should be ‘ yearly’ , ‘Half-yearly’ or

‘Monthly’. 2) Display records from all the tables.3) Change premium amount to 15000, for policy “Jeevan Anand” of type “Half-yearly”.4) Delete the details customers info who had bought policy from Agent ‘joshi’.5) List the details of policies that are of type “Monthly paying”.6) List the names of customers who have drawn atleast two policies from “Mr. Joshi”.7) List the details of customers and their policy details who lives in ‘Nasik’ and ‘Pune’

OR 7) Solve the following query:

i) List the names of customer whose agent name starts with ‘J’.ii) List the details of the policies whose premium is more than 50000.iii) Remove table Policy from database.

Q 3 . Viva [10 marks]

Slip20UNIVERSITY OF PUNE

Page 20: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Write a program to check whether given character is a digit or a character in lowercase or uppercase alphabet.

[ 15 marks ]

b) Write a program display n lines as follows (here n=4). 1 2 3 4 1 2 3 1 2

1

[ 20 marks ]

Q 1

ORWrite a function power, which calculates xy. Write another function, which calculates n! Using for loop. Use these functions to calculate the sum of first n terms of the Taylor series:sin(x) = x - x3/3! + x5/5! + …

[ 35 marks ]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks] Car (cno, car_model, owner_name, price) Driver (dno, drv_name, drv_city) Car and Driver are related with many-to-many relationship with acc_year and acc_place as attributes. Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table.

Solve the following Queries in SQL .1) Add constraint to car_driver table such that year of accident > 1990.2) List the name of drivers who lives in “Mumbai”.3) List details of drivers whose name begins with ‘B’.4) Display the details of the drivers whose names are neither ‘Mahesh’ nor ‘Sunil’5) Change driver no to 40 of “sachin” who live in “Pune”.6) Delete the car details owned by ‘Mr. Joshi’.7) List all accidents along with their place and cars involved in those accidents that took

place in the years 2002, 2003, 2005.OR

7) Solve the following queries. i) Find the names of cars whose price is between 300000 to 700000. ii) Display records from all the tables. iii) Remove table Driver from database.

Q 3 . Viva [10 marks]Slip21

UNIVERSITY OF PUNE

Page 21: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.Lab Course – I: ‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Write a program to accept an integer and check if it is even or

odd.[ 15 marks ]

b) Write a program display n lines as follows (here n=4).11 21 2 3

1 2 3 4

[ 20 marks ]

Q 1 ORAccept two fractions (numerator, denominator) and perform the following operations till the userselects Exit.i. Additionii. Subtractioniv. EXIT

[ 35 marks ]

Q 2 . Create the following tables. (Primary Keys are underlined) [35 Marks]Country (c_code, c_name, capital, continent)Population (p_code, population)

Country and Population are related with one-to-one relationship.Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF.

Insert 5 records in each table.

Solve the following Queries in SQL.1) Add constraint to Country table such that country name should not be null.2) Display all the records from both the tables.3) List the details of the country whose capital is ‘Delhi’.4) Find the name and population of country whose capital is “Tokyo”.5) List all the countries from Asia continent.6) Change the capital as Tokyo for the country whose code is 25.7) Delete the country details of Europe continent.

OR7) Solve the following queries.

i. List the country with highest population.ii. List population of country whose code is 20.iii. Remove table Population from database.

Q 3 . Viva [10 marks]

Page 22: Slip 1 UNIVERSITY OF PUNE F.Y.B.Sc (Comp. Sc.) Practical ... · F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct ... List the details of the country whose capital is ... ‘ Basic

Slip22UNIVERSITY OF PUNE

F.Y.B.Sc (Comp. Sc.) Practical Examination April/Oct -2014.Lab Course – I: Computer Science‘ Basic C ‘ and ‘ DBMS ‘

[Duration: 3 Hours] [Maximum Marks80]

Q 1 a) Accept the x and y coordinate of a point and find the quadrant in

which the point lies.[ 15 marks ]

b) Write a function, which accepts a character and integer n as parameter and displays the next n characters.

[ 20 marks ]

Q 1

OR

Accept x and y coordinates of two points and write a menu driven program to perform the followingoperations till the user selects Exit.

i) Distance between pointsii) Slope of line between the points.iii) EXIT

[ 35 marks ]

Q.2 Create the following tables. (Primary Keys are underlined) [35 Marks] Emp(eno,ename,designation,sal) Dept(dno,dname,loc) Dept & Emp related with one-to-many relationship .

Draw a E-R diagram accordingly & convert it into relational model, so that the relations are in 3NF. Insert 5 records in each table.

Solve the following Queries in SQL .1) Give a 5% raise in salary to employees of ‘Finance’ department.2) Delete details of all employees of deparment 30;3) Modify the employee schema, to add a phone-no column.4) List all the employees of department 10 & 205) Display min,max,avg salary of each department, located in “pune” .6) List employees working at departments located at Calcutta.7) List the total amount spent as salary for each department in decreasing order of total salary.

OR 7) Solve the following queries: i) List the employees having salary less than 40,000. ii) List the names of employees who do not work in “sales” department. iii) Remove the table employee from the database.

Q 3 . Viva [10 marks]