Indira College of Commerce and Science Pune
T.Y. B.Sc. (CS) (Semester –IV) 2013 Pattern
CS-348 Programming in Java and Computer Graphics Practical Examination
[Time: 3hrs] [ Total Marks 80]
Q.1 A] Create an abstract class shape. Derive three classes sphere, cone, and
cylinder from it. Calculate area and volume of all (use method overriding) [15]
Q.2 A] Design a servlet that provides information about a HTTP request from a
client, such as IP address and browser type. The servlet also provides information
about the server on which the servlet is running, such as the operating system
type, and the names of currently loaded servlet.
[15]
OR
B] Define thread called “PrintTextThread” for printing text on command prompt for
n number of times. Create three threads and run them. pass the text and n as
parameters to the thread constructor. [15]
Example:
a) First thread prints “I am in FY” 10 times.
b) Second thread prints “I am in SY” 20 times.
c) Third thread prints “I am in TY” 30 times.
Q.3 A] MCQ [Java (15) + CG (5)] [20]
B] Viva [30]
----Slip 1 -----
Indira College of Commerce and Science Pune
T.Y. B.Sc. (CS) (Semester –IV) 2013 Pattern
CS-348 Programming in Java and Computer Graphics Practical Examination
[Time: 3hrs] [ Total Marks 80]
Q.1 A] Write a program to create a super class Vehicle having members Company
and price. Derive two different classes LightMotorVehicle(mileage) and
HeavyMotorVehicle (capacity_in_tons). Accept the information for “n” vehicles and
display the information in appropriate from. While taking data, ask user about the
type of vehicle first. [15]
Q.2 A] Accept “n” integers from the user and store them in a collection. Display
them in the sorted order. The collection should not accept duplicate elements (Use
suitable collection). Search for a particular element using predefined search
method in the collection framework.
[15]
OR
B] Create a table Student with the fields roll number, name, percentage using
Postgresql. Write a menu driven program (Command line interface) to perform the
following operations on student table.
a) Insert
b) Modify
c) Delete
d) Search
e) View All
f) Exit
Q.3 A] MCQ [Java (15) + CG (5)] [20]
B] Viva [30]
----Slip 2 -----
Indira College of Commerce and Science Pune
T.Y. B.Sc. (CS) (Semester –IV) 2013 Pattern
CS-348 Programming in Java and Computer Graphics Practical Examination
[Time: 3hrs] [ Total Marks 80]
Q.1 A] Create a package named Series having two different classes to print the
following series:
a) Prime numbers.
b) Squares of numbers.
Write a program to generate ‘n’ terms of above series. [15]
Q.2 A] Create a Hash table containing student name and percentage. Display the
details of the hash table. Also search for a specific student and display percentage
of that student. [15]
OR
B] Write a program to create a shopping mall. User must be allowed to do
purchase from two pages. Each page should have a page total. The third page
should display a bill, which consists of page total of whatever the purchase has
been done and print the total.
[15]
Q.3 A] MCQ [Java (15) + CG (5)] [20]
B] Viva [30]
----Slip 3 -----
Indira College of Commerce and Science Pune
T.Y. B.Sc. (CS) (Semester –IV) 2013 Pattern
CS-348 Programming in Java and Computer Graphics Practical Examination
[Time: 3hrs] [ Total Marks 80]
Q.1 A] Define a class MyNumber having one private integer data member. Write a
default constructor to initialize it to 0 and another constructor to initialize it to a
value (use this). Write methods isNegative, isPositive, isZero, isOdd, isEven. Create
an object in main. Use command line arguments to pass a value to the object and
perform the above tests. [15]
Q.2 A] Construct a linked list containing names of colors: red, blue, yellow and
orange. Then extend your program to do the following:
i. Display the contents of the List using an Iterator.
ii. Display the contents of the List in reverse order using a ListIterator.
iii. Create another list containing pink and green. Insert the elements of this list
between blue and yellow. [15]
OR
B] Design the table Login(login_name, password) using Postgresql. Also design an
HTML login screen accepting the login name and password from the user. Write a
servlet program that validates accepted login name and password entered by user
from the login table you have created. The servlet sends back an appropriate
response. [15]
Q.3 A] MCQ [Java (15) + CG (5)] [20]
B] Viva [30]
----Slip 4 -----
Indira College of Commerce and Science Pune
T.Y. B.Sc. (CS) (Semester –IV) 2013 Pattern
CS-348 Programming in Java and Computer Graphics Practical Examination
[Time: 3hrs] [ Total Marks 80]
Q.1 A] Define a class SavingAccount (acno, name, balance). Define appropriate
constructors and operations withdraw (), deposit (), and viewbalance(). The
minimum balance must be 500. Create an object and perform operations. Raise
user defined “InsufficientFundsException” when balance is not sufficient for
withdraw operation
[15]
Q.2 A] Construct a linked list containing names of colors: red, blue, yellow and
orange. Then extend your program to do the following:
i. Display the contents of the List using an Iterator.
ii. Display the contents of the List in reverse order using a ListIterator.
iii. Create another list containing pink and green. Insert the elements of this list
between blue and yellow. [15]
OR
B] Define thread called “PrintTextThread” for printing text on command prompt for
’n’ number of times. Create three threads and run them. pass the text and ‘n’ as
parameters to the thread constructor. [15]
Example:
a) First thread prints “I am in FY” 10 times.
b) Second thread prints “I am in SY” 20 times.
c) Third thread prints “I am in TY” 30 times.
Q.3 A] MCQ [Java (15) + CG (5)] [20]
B] Viva [30]
----Slip 5 -----
Indira College of Commerce and Science Pune
T.Y. B.Sc. (CS) (Semester –IV) 2013 Pattern
CS-348 Programming in Java and Computer Graphics Practical Examination
[Time: 3hrs] [ Total Marks 80]
Q.1 A] Define a class MyData (Day, Month, year) with methods to accept and
display a MyData object Accept data as dd, mm, yyyy. Throw user defined
execution “InvalidDateException” if the data is invalid.
[15]
Example of invalid dates:
a. 12 15 2015
b. 31 6 1990
c. 29 2 2015
Q.2 A] Construct a linked list containing names of colors: red, blue, yellow and
orange. Then extend your program to do the following:
i. Display the contents of the List using an Iterator.
ii. Display the contents of the List in reverse order using a ListIterator.
iii. Create another list containing pink and green. Insert the elements of this list
between blue and yellow. [15]
OR
B] Create a table Student with the fields roll number, name, percentage using
Postgresql. Write a menu driven program (Command line interface) to perform the
following operations on student table. [15]
a) Insert
b) Modify
c) Delete
d) Search
e) View All
f) Exit
Q.3 A] MCQ [Java (15) + CG (5)] [20]
B] Viva [30]
----Slip 6-----
Indira College of Commerce and Science Pune
T.Y. B.Sc. (CS) (Semester –IV) 2013 Pattern
CS-348 Programming in Java and Computer Graphics Practical Examination
[Time: 3hrs] [ Total Marks 80]
Q.1 A] Write a program to create the following GUI and apply the changes to the
text in the TextField.
[15]
Q.2 A] Create a Hash table containing student name and percentage. Display the
details of the hash table. Also search for a specific student and display percentage
of that student. [15]
OR
B] Write a program to create a shopping mall. User must be allowed to do
purchase from two pages. Each page should have a page total. The third page
should display a bill, which consists of page total of whatever the purchase has
been done and print the total.
Q.3 A] MCQ [Java (15) + CG (5)] [20]
B] Viva [30]
----Slip 7-----