12
Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 Java Programming 2015 Ms. Anuja Vaidya Page 1 Practical No: 1 Enrollment No: Name: Practical Problem 1. Write a program to find out that the given no number is odd or even (pass argument in command line argument) 2. Write a program to print following pattern with character ‘A’ passes as command line argument for n row. A A A A A A A A A A 3. Write a program in which there are three variables whose data type is byte, int and double; the value of int is 260 and value of double is 323.142. Convert the value of int into byte, double into int and double into byte and display all the values after conversion. 4. Write a program to print a following pattern (using nested loop) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 5. Write a program to convert Rupees to Dollar and Dollar to Rupees, where 1 dollar = Rs 60.10. (Take input from user). 6. Write a program that creates string variables called firstname, lastname and myName. Using concatenations, assigns the value of firstname and lastname into myName, and display it on screen. 7. Write a program which accept one string and display all the vowels from that string. 8. Write a Java Program which will read a string and rewrite it in the alphabetical order eg. The word “STRING” should be written a “GINRST”. 9. Write a program that count total number of characters in all of its command line arguments. Objective(s) Clear basic concepts of Java platform, program structure and control statements. Usage of String class and different function. Pre-requisite Object Oriented features like class, object, inheritance, polymorphism Duration for completion 7 hours PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solve industry problems. PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary for software development CO(s) to be achieved CO1: Demonstrate the core concept of core Java along with control flow, exception and perform different operation on arrays. Solution must contain Program and output Sample Calculation where needed. Nature of submission Handwritten References for solving the problem Search on Internet Buyya, R., et. al. Object-oriented Programming with Java: Essentials and Applications, McGraw Hill Schildt, H., The Complete Reference : Java , Eighth Edition, Tata McGraw Hill Sample Testing data NA Post Laboratory questions 1. How can you determine the total number of arguments passed in the command line? Write example of it. 2. If user want to display third word from the given command line argument how user will display? Explain it with example. 3. When ArrayIndexOutOfBoundsException occur? How one can solve this error? Explain

Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Embed Size (px)

Citation preview

Page 1: Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 – Java Programming

2015

Ms. Anuja Vaidya Page 1

Practical No: 1 Enrollment No: Name: Practical Problem 1. Write a program to find out that the given no number is odd or even (pass

argument in command line argument) 2. Write a program to print following pattern with character ‘A’ passes as

command line argument for n row.

A A A A A A A A A

A 3. Write a program in which there are three variables whose data type is byte, int

and double; the value of int is 260 and value of double is 323.142. Convert the value of int into byte, double into int and double into byte and display all the values after conversion.

4. Write a program to print a following pattern (using nested loop)

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

5. Write a program to convert Rupees to Dollar and Dollar to Rupees, where 1 dollar = Rs 60.10. (Take input from user).

6. Write a program that creates string variables called firstname, lastname and myName. Using concatenations, assigns the value of firstname and lastname into myName, and display it on screen.

7. Write a program which accept one string and display all the vowels from that string.

8. Write a Java Program which will read a string and rewrite it in the alphabetical order eg. The word “STRING” should be written a “GINRST”.

9. Write a program that count total number of characters in all of its command line arguments.

Objective(s) Clear basic concepts of Java platform, program structure and control statements.

Usage of String class and different function. Pre-requisite Object Oriented features like class, object, inheritance, polymorphism

Duration for completion 7 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solve industry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary for software development

CO(s) to be achieved CO1: Demonstrate the core concept of core Java along with control flow, exception and perform different operation on arrays.

Solution must contain Program and output Sample Calculation where needed.

Nature of submission Handwritten

References for solving the

problem

Search on Internet Buyya, R., et. al. Object-oriented Programming with Java: Essentials and Applications,

McGraw Hill Schildt, H., The Complete Reference : Java , Eighth Edition, Tata McGraw Hill

Sample Testing data NA

Post Laboratory questions 1. How can you determine the total number of arguments passed in the command line? Write example of it.

2. If user want to display third word from the given command line argument how user will display? Explain it with example.

3. When ArrayIndexOutOfBoundsException occur? How one can solve this error? Explain

Page 2: Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 – Java Programming

2015

Ms. Anuja Vaidya Page 2

it with example.

4. How one can perform computation on the values, if a command line argument contains integer values?

5. What is output for following snippet code? int y = 10; y += y++; y -= -y;

6. What is input and output Stream? Which stream is used to represent keyboard input?

7. Show classification of control flow statement. 8. What is the output of the following segment of code?

Int i = 10; do {

System.out.println("BMIIT"); i++; } while (i< 5);

9. What will be output for following snippet code? String s1 = “Hello”; String s2 = “ world”; String s3 = s1+s2+56+57; System.out.println(s3);

10. Write any two differences between selection and iteration statement. Assessment

Solution achieves the desired objective(s) Viva

Out of Marks 10 5 Secured by the student

Signature and Date

Page 3: Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 – Java Programming

2015

Ms. Anuja Vaidya Page 3

Practical No: 2 Enrollment No: Name: Practical Problem 1. Write a menu driven program using two dimensional arrays to perform matrix

addition, subtraction and multiplication. The program asks the user to input the numbers of rows and columns for matrix A and matrix B. The user then enters the elements of each array.

2. Write a program that read the elements of a one dimensional array and sort elements using bubble sort.

3. Write a program to find out that given number is palindrome or not. (pass argument in command line argument ,and using array)

4. Write a program that identifies and remove duplicate elements in a one dimensional array. The program asks for the size of the array, and after removing elements from the array displays it on the screen.

Objective(s) Concept of one and two dimension array. Clear basic concepts of Java platform, program structure and control

statements. Usage of String class and different function.

Pre-requisite Object Oriented features like class, object, inheritance, polymorphism

Duration for completion 6 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solve industry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary for software development

CO(s) to be achieved CO1: Demonstrate the core concept of core Java along with control flow, exception and perform different operation on arrays.

Solution must contain Program and output Sample Calculation where needed.

Nature of submission Handwritten

References for solving the

problem

Search on Internet Buyya, R., et. al. Object-oriented Programming with Java: Essentials and Applications,

McGraw Hill Schildt, H., The Complete Reference : Java , Eighth Edition, Tata McGraw Hill

Sample Testing data NA

Post Laboratory questions 1. Write one key difference between regular array and jagged array. 2. Consider a scenario where user wants to create one array of three rows,

having three, one and three column respectively. Draw a structure for current scenario.

3. Given the following array definition: int values[5] = { 4, 7, 6, 8, 2 }; What does the following statement display? System.out.println(values[4], (values[2] +values[3]), ++values[1]);

4. How one can know how many elements are there in array? Write it example. 5. Define jagged array? 6. How many elements are there in array after executing following code?

int [] [] intarray = new int[2] []; intarray[0] = new int[10]; intarray[1] = new int[10];

7. If accessing an index that bigger than the size of the array then which exception will be arise? List out other Exception that may be arise while performing operation on arrays.

Assessment

Solution achieves the desired objective(s) Viva

Out of Marks 10 5

Page 4: Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 – Java Programming

2015

Ms. Anuja Vaidya Page 4

Secured by the student

Signature and Date

Page 5: Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 – Java Programming

2015

Ms. Anuja Vaidya Page 5

Practical No: 3 Enrollment No: Name: Practical Problem 1. Write a program that contains a class called “Student” with data members for

storing student number, name, year of study; and methods for accessing them. The program should include a driver class with main () method which creates objects of student class and take user inputs and stores them in objects. The program should display content of objects using public method called display () defined in student class.

2. Write a program that creates two classes one is Employee and another is main method class. Employee class contain emp_code, name, designation and salary fields, and three constructor one is default constructor, second constructor contain three filed emp code, name and designation& if designation is clerk set salary of Rs. 5000 if designation is peon set salary of Rs. 2000 and if manager set salary of Rs. 10000 for others set salary of Rs. 1000 and third constructor contain four fileds emp code, name, designation and salary. Display information of employee using display method.

3. Write a program that define class student, in which put field like student id,name,class name and marks of minimum 5 subjects, and do the following:

a. Insert values for five students through constructor. b. Calculate percentage and grade, if student is fail in any subject then

grade is F and if he/she is pass then criteria for grade is as follows: if per >=70 grade is A , if per >=60 and <70 then grade is B, and if per >=50 and <60 then grade is C, otherwise D.

c. Display student information according to grade wise, whenever you display student information.

4. Write a program that define two class ; one is calculation_area which calculate different areas of shapes like triangle,circle,square,rectangle,etc; using the concept of method overloading and another is main method class in which create the object of calculation_area and using the concept of menu driven call different method of calculation_area.

5. Write a program that create two class one is main method class and another is to represent a bank account that includes the following member: Data Members Owner name Account number Balance amount in the account Methods Members To assign initial values. To deposit an amount. To withdraw an amount after checking balance minimum balance must be Rs.500. To Display the owner name and balance.

Objective(s) Clear the concept of class, object, instance variable and instance method.

Pre-requisite Object Oriented features like class, object, inheritance, polymorphism

Duration for completion 7 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solve industry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary for software development

CO(s) to be achieved CO1: Demonstrate the core concept of core Java along with control flow, exception and perform different operation on arrays. CO2: Construct classes, objects as per the need of problem definition.

Solution must contain Program and output Sample Calculation where needed.

Nature of submission Handwritten

Page 6: Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 – Java Programming

2015

Ms. Anuja Vaidya Page 6

References for solving the

problem

Search on Internet Buyya, R., et. al. Object-oriented Programming with Java: Essentials and Applications,

McGraw Hill Schildt, H., The Complete Reference : Java , Eighth Edition, Tata McGraw Hill

Sample Testing data NA

Post Laboratory questions 1. How one can access member of a class? Explain it with example. 2. What will be the output of following code?

Person p; System.out.println(p.NameOfPerson);

3. Specify the difference between a method and a constructor. 4. How can a nested constructor be called if there is a call to a parameterized

constructor inside a default constructor? Explain it with example. 5. State the two possible ways of passing an argument to a method? 6. Which overloaded method will be invoked if passed with no arguments?

Describe way how compiler differentiates overloaded method. 7. What will be the output of following code?

Class Exam{ static int x=10; static{ System.out.println(“Inside Static Block x = “+x); } public static void main(String args[]) { x= 15; System.out.println(“ Inside main(): x = “+x);} }

8. Write one key difference between class method and instance method. 9. What is the default value stored when default constructor for a String and int

data type is called? Assessment

Solution achieves the desired objective(s) Viva

Out of Marks 10 5 Secured by the student Signature and Date

Page 7: Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 – Java Programming

2015

Ms. Anuja Vaidya Page 7

Practical No: 4 Enrollment No: Name: Practical Problem 1. Create two class one is Family and second is relative, Family class has data

member like name, relation and dob, and Relative class inherit the properties

of Family class and it has data member like mobile no, address and do the

following operation.

a. Create three constructors for base and derived class.

b. Insert data through derived class parameterized constructor.

c. Illustrate the use of this reference and Super.

d. Display all the information through parent class reference variable.

2. Create three class SocialNetwork, Facebook, and Twitter; SocialNetwork class

has data member like username and password; Facebook class inherit the

properties of SocialNetwork class and it has data member like wallpost and

friend_name; Twitter class inherit the properties of SocialNetwork and has

data members like twit_message and follower_name and do the following

operation.

a. Insert data through derived class parameterized constructor.

b. There are more than one user of Facebook and Twitter so use

appropriate technique for creating user.

c. Illustrate the use of this reference.

d. Create one reference variable of SocialNetwork class and with the help

of it display information of Twitter.

3. Write a program to create 4 class, Person,Friends,Family and main method class. In person class data members are name,city,nationality,emailid all are private and methods are insert and display; in Friends class data members are date-of –birth,address,contact no,group; all are public and methods are insert, display and search; in Family class data members are date-of-birth,address,contact no,relation ; all are public and methods are insert,display and search. Friends and Family class inherit properties of Person class. Create a menu driven program and options for menu driven are insert,search,display and exit. Before performing any operation first ask user whether they want to perform operation on Friends or Family and according user choice perform operation which are given. Whenever user insert for search ask them whether they want to search by city or by name and according to that display information. Create array of object for Friends and Family class.

4. Create a package called General.

a. Create one class in it called Person with appropriate properties and

methods.

Create 2nd package called StudentDetail. a. Create a class called Student which derives from Person class with

appropriate properties and method.

b. Create a class called Exam with its additional properties and methods

which is derived from Student class.

Create 3rd package called FacultyDetail. a. Create a class called Faculty which derives from Person class with

Page 8: Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 – Java Programming

2015

Ms. Anuja Vaidya Page 8

appropriate properties and method.

d. Create 4th package called Test. Make a driver class to test Exam and Faculty class by creating the objects of them.

5. Create a class called DataStructure with following details.

Data members: size, index, arrayElements Method: Constructor to set values Display method to display list of elements. Create one interface called ICollectionBehaviour, interface contains following methods void add(int number) void delete() void display(int position) public void clear() Create another class called Stack which is derived from DataStructure class and implements ICollectionBehaviour interface. Method: Create a method to check whether the stack is empty or not, method should private. Create another class called Queue which is derived from DataStructure class and implements ICollectionBehaviour interface. Method: Create a method to check whether the Queue is empty or not, method should private. Create the objects of Stack and Queue class in Tester class and test them.

Objective(s) Clear the concept of class, object, instance variable and instance method. Clear the concept of inheritance, constructor, super and super class and derive

class constructors. Clear the concept of interface and package

Pre-requisite Object Oriented features like class, object, inheritance, polymorphism

Duration for completion 8 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solve industry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary for software development

CO(s) to be achieved CO1: Demonstrate the core concept of core Java along with control flow, exception and perform different operation on arrays. CO2: Construct classes, objects as per the need of problem definition. CO3: Describe and implement the concept of inheritance, overriding functions, packages and interface.

Solution must contain Program and output Sample Calculation where needed.

Nature of submission Handwritten

References for solving the

problem

Search on Internet Buyya, R., et. al. Object-oriented Programming with Java: Essentials and Applications,

McGraw Hill Schildt, H., The Complete Reference : Java , Eighth Edition, Tata McGraw Hill

Sample Testing data NA

Post Laboratory questions 1. Which keyword is used for accessing the base class constructor in derived class constructor? Show one example of it.

Page 9: Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 – Java Programming

2015

Ms. Anuja Vaidya Page 9

2. How to call derived class method using parent class reference variable? Explain it with example.

3. What will be output of following code? class A { public int i; public int j; A() { i = 1; j = 2; } } class B extends A { int a; B() { super(); } } class use { public static void main(String args[]) { B obj = new B(); System.out.println(obj.i + " " + obj.j) }

} 4. How does a compiler determines which overridden method to be called? 5. Give two differences between hierarchical and multilevel inheritance. 6. Find error in following code and correct code.

class A { public A(int x){} } class B extends A { } public class test { public static void main (String args []) { A a = new B(); System.out.println("complete"); } }

7. Which statement must be first statement of the derived class constructor? Can we use this() and super() both in a same constructor? Justify your answer.

8. Can we create non abstract and final method in interface? Justify your answer with example.

9. Is it compulsory to override all the methods of interface in derived class? 10. How Java achieve multiple inheritances? Explain it with example.

Assessment

Solution achieves the desired objective(s) Viva

Out of Marks 10 5 Secured by the student Signature and Date

Page 10: Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 – Java Programming

2015

Ms. Anuja Vaidya Page 10

Practical No: 5 Enrollment No: Name: Practical Problem 1. Write a Java program which throws an exception whenever user enters a

string of five characters. 2. Write a program to create custom exception for bank that contain fields

accountno, and balance throw an exception for the following condition: a. If withdrawing amount is greater than actual amount. b. If balance become less than 500 after withdrawing amount.

3. Write a Java program which will insert data from console and store it into file and count total no of words from the file.

4. Write a program which will read data from one.txt file and copy into two.txt file.

5. Write a program using 28th program which will display data from two.txt in reverse manner.

Objective(s) Clear concept of exceptions & File Handling

Pre-requisite Object Oriented features like class, object, inheritance, polymorphism

Duration for completion 7 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solve industry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary for software development

CO(s) to be achieved CO1: Demonstrate the core concept of core Java along with control flow, exception and perform different operation on arrays. CO2: Construct classes, objects as per the need of problem definition. CO3: Describe and implement the concept of inheritance, overriding functions, packages and interface. CO4: Implement exceptions to handle run-time errors and file handling.

Solution must contain Program and output Sample Calculation where needed.

Nature of submission Handwritten

References for solving the

problem

Search on Internet Buyya, R., et. al. Object-oriented Programming with Java: Essentials and Applications,

McGraw Hill Schildt, H., The Complete Reference : Java , Eighth Edition, Tata McGraw Hill

Sample Testing data NA

Post Laboratory questions 1. Write one difference between throw and throws. 2. Write two advantage of inheritance. 3. What is the use of try block? 4. What are user define exception? Illustrate it with suitable example. 5. What is semantic error? 6. What is Syntax error? 7. Which methods you can user for reading characters data? 8. Which are the two subclasses under Exception class? 9. How finally used under Exception Handling?

Assessment

Solution achieves the desired objective(s) Viva

Out of Marks 10 5 Secured by the student Signature and Date

Page 11: Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 – Java Programming

2015

Ms. Anuja Vaidya Page 11

Practical No: 6 Enrollment No: Name: Practical Problem 1. Write a program to take input from user and ask the user to enter any

character for which the user wants to calculate occurrences of it. Program should check whether the particular character presents in the given statement or not. If yes it should display the occurrences of it, otherwise proper message should be displayed.

(Note: Use the functions of String class only.) 2. Using the Practical Problem 30 ask how many times user wants to check the

occurrences of the characters, according to that consider that character as a key and store it’s respective occurrences as a value in HashMap.

3. Write a program that creates a user-define class called CustomerFeedback containing members such as CutomerId, name, Feedback, type of product.

Assume that five customers have given their feedback for the various products. Prepare a list of customer feedback based on the type of the product. (Note: Use ArrayList to store different type of customer feedback.)

4. Database: Student Fields: id, Student Name, Mobile no, Semester, Sub1Marks, Sub2Marks, Sub3Marks, Sub4Marks, Sub5Marks, Total, Percentage, Grade Create a menu-driven program which asks for the following operations using JDBC.

a. Insert Student Detail. b. Display Students Information. c. Display Student Information by Semester. d. Search Student Information by Grade. e. Update Student Information by id. f. Delete Student Information by mobile no.

Objective(s) To make aware of String class, StringTokenizer class, StringBuffer class and its functionality.

To make aware of collection and generics. To make aware of JDBC database connectivity.

Pre-requisite Object Oriented features like class, object, inheritance, polymorphism

Duration for completion 8 hours

PEO(s) to be achieved PEO2: To provide quality practical skill of tools and technologies to solve industry problems.

PO(s) to be achieved PO6: Ability to use the techniques, skills and modern tools as necessary for software development

CO(s) to be achieved CO1: Demonstrate the core concept of core Java along with control flow, exception and perform different operation on arrays. CO2: Construct classes, objects as per the need of problem definition. CO3: Describe and implement the concept of inheritance, overriding functions, packages and interface. CO4: Implement exceptions to handle run-time errors and file handling. CO5: Understand and use generic Collections and String objects. CO6: Practice database connectivity using JDBC.

Solution must contain Program and output Sample Calculation where needed.

Nature of submission Handwritten

References for solving the

problem

Search on Internet Buyya, R., et. al. Object-oriented Programming with Java: Essentials and Applications,

McGraw Hill Schildt, H., The Complete Reference : Java , Eighth Edition, Tata McGraw Hill

Page 12: Babu Madhav Institute of Information Technology, 5 …utu.ac.in/BMIIT/StudentCorner/sem3/PR_060010301.pdfBabu Madhav Institute of Information Technology, 20155 Years Integrated M.Sc

Babu Madhav Institute of Information Technology, 5 Years Integrated M.Sc. (IT) 060010301 – Java Programming

2015

Ms. Anuja Vaidya Page 12

Sample Testing data NA

Post Laboratory questions 1. How one can compare two strings in Java? 2. Which method of HashMap in above given problem used to retrieve one by one

entry from Map? 3. If a user forgets to import java.lang.* package, is there any possibility of error to be

raised? If yes, then specify an error. 4. Give two key differences between ArrayList and Set. 5. Name the package necessary to import inorder to use collection interface in the

above given problem. 6. How one can join three different strings without using + operator? 7. For the below given program:

//Program written in Java import java.util.*; class demo{ public static void main(String[] args){ List<String> lst=new ArrayList<String>(); String s="Two"; lst.add("One"); lst.add(s); lst.add(s+s); System.out.println(lst.size()); System.out.println(lst.contains(“one”)); System.out.println(lst.contains("TwoTwo")); lst.remove("Two"); System.out.println(lst); System.out.println(lst.size());} }

a. State the purpose of line: List<String> lst=new ArrayList<String>(); and lst.remove("Two");

b. What will be the result if we executes following line of code? Lst.add(4,”Hiii”);

8. What is JDBC? 9. State the purpose of JDBC DriverManager. 10. Which class controls the connection with the data source? 11. List objects name which can be used to execute updates, queries or store procedure. 12. What is the purpose of JDBC Drivers.

Assessment

Solution achieves the desired objective(s) Viva

Out of Marks 10 5 Secured by the student Signature and Date