060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents ›...

22
060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 1 Unit-1 String and Collections Short Answer Questions 1. Name the packageused for making use of StringTokenizer class. 2. State any two ways to create object of String class. 3. String s=new String(); What will be the result of given code? 4. Write a step to create a string from a given character array. 5. If a user wants to perform string comparison ignoring case, Name the method that will provide solution to user. 6. How we can copy one String object in another one? 7. A user is interested in comparing a specific region from a string with another specific region of string, which method will provide solution for the specified problem? 8. Assume that a user wants to determine whether the given sting begin or end with a specified string, which method should a user use inorder to get the solution? 9. Write any one difference between Array and Collection. 10. What are the two ways to iterate the elements of a collection? 11. How ArrayList differs from HashMap? 12. List any two interfaces of Java collections framework. 13. Distinguish two points between Enumeration and Iterator interface. 14. What is map interface in Java? 15. State two differences between Map and HashMap. 16. 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());} } 1. State the purpose of line: List<String> lst=new ArrayList<String>(); and lst.remove("Two"); 2. What will be the result if we executes following line of code? Lst.add(4,”Hiii”); Long Answer Questions 1. “String is an immutable object”: Justify the statement. 2. How does String class differ from the StringBuffer class? Discuss it with suitable examples. 3. Analyse the impact of String class in the usage of memory when a value of same variable is modified three times. 4. Create a scenario where string concatenation is done with float datatype. 5. Explain append() and insert() method of String class with suitable example. 6. How to do string concatenation with other data type? Discuss it with suitable example. 7. Explain equal() and == with suitable example. 8. How one can check whether two string object is referring to same reference or not? 9. Explain any four String constructors with proper prototype and example. 10. Compare and contrast delete() and deleteCharAt() method. 11. Explain replace() and trim() method of String class with suitable example.

Transcript of 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents ›...

Page 1: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 1

Unit-1String and Collections

Short Answer Questions1. Name the packageused for making use of StringTokenizer class.2. State any two ways to create object of String class.3. String s=new String(); What will be the result of given code?4. Write a step to create a string from a given character array.5. If a user wants to perform string comparison ignoring case, Name the method that will provide solution to user.6. How we can copy one String object in another one?7. A user is interested in comparing a specific region from a string with another specific region of string, whichmethod will provide solution for the specified problem?8. Assume that a user wants to determine whether the given sting begin or end with a specified string, whichmethod should a user use inorder to get the solution?9. Write any one difference between Array and Collection.10. What are the two ways to iterate the elements of a collection?11. How ArrayList differs from HashMap?12. List any two interfaces of Java collections framework.13. Distinguish two points between Enumeration and Iterator interface.14. What is map interface in Java?15. State two differences between Map and HashMap.16. For the below given program://Program written in Javaimport 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());}}1. State the purpose of line:List<String> lst=new ArrayList<String>();andlst.remove("Two");2. What will be the result if we executes following line of code?Lst.add(4,”Hiii”);

Long Answer Questions1. “String is an immutable object”: Justify the statement.2. How does String class differ from the StringBuffer class? Discuss it with suitable examples.3. Analyse the impact of String class in the usage of memory when a value of same variable is modified three times.4. Create a scenario where string concatenation is done with float datatype.5. Explain append() and insert() method of String class with suitable example.6. How to do string concatenation with other data type? Discuss it with suitable example.7. Explain equal() and == with suitable example.8. How one can check whether two string object is referring to same reference or not?9. Explain any four String constructors with proper prototype and example.10. Compare and contrast delete() and deleteCharAt() method.11. Explain replace() and trim() method of String class with suitable example.

Page 2: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 2

12. How to set character value within StringBuffer? Explain it with suitable example.13. Validate the significance of ‘Collections’ in creating dynamic data structurs.14. What are collections? How do they help in creating dynamic data structures?15. Explain any four basic interfaces of Java collections framework.16. Validate the significance of StringBuffer class.17. What makes Enumeration different from Iterator interface?18. Explain at least five StringBuffer class methods using syntax and proper example.19. Explain any five methods of List interface with proper syntax and example.20. How one can store any detail in key value type of data? Explain with example.21. Explain StringTokenizer class with its all methods with proper syntax.Select an appropriate option from given choices1. Given: String test = "a1b2c3"; String[] tokens = test.split("\\d"); for(String s: tokens) System.out.print(s + " ");What is the result?A. b cB. 1 2 3C. a1b2c3D. a1 b2 c32. Consider the following codepublic String mystery(String s){ String s1 = s.substring(0,1);String s2 = s.substring(1, s.length() - 1);String s3 = s.substring(s.length() - 1);if (s.length() <= 3)return s3 + s2 + s1;elsereturn s1 + mystery(s2) + s3;}What is the output ofSystem.out.println(mystery("DELIVER"));A. DELIVERB. DEVILERC. REVILEDD. RELIVEDE. DLEIEVR3. Consider the following code and give output of it.if("String".toString() == "String")System.out.println("Equal");else System.out.println("Not Equal");A. Print “Equal”.B. Print “Not Equal”.C. Compiler error.D. Runtime error.4. Consider the following codepublic void twist(String[] w){ String temp = w[0].substring(0, 1);w[0] = w[1].substring(0, 1) + w[0].substring(1);w[1] = temp + w[1].substring(1);}

What is the output of the following code segment?Public static void main(String args[])

Page 3: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 3

{String[] words = {"HOW", "NEAT"};twist(words):System.out.println(words[0] + " " + words[1]);}A. NOW HEATB. Syntax ErrorC. HOW NEATD. Runtime Error5. Consider the following code and give output of it.if("String".trim() == "String")System.out.println("Equal");else System.out.println("Not Equal");A. Print “Equal”.B. Print “Not Equal”.C. Compiler errorD. Runtime error6. What is the output of the following code?String barb = "BARBARA";scramble(barb);System.out.println(barb);The method scramble is defined as follows:public String scramble(String str){ if (str.length() >= 2){ int n = str.length() / 2;str = scramble(str.substring(n)) + str.substring(0, n);}return str;}A. Syntax ErrorB. BARBARAC. ARBABARD. BARABAR7. Consider the following code and give output of it.public class M {public static void main(String[] args) {if("String ".trim() == "String")System.out.println("Equal");else System.out.println("Not Equal");}}A. Print “Equal”.B. Print “Not EqualC. Compilation errorD. Runtime error8. A String ClassA. is finalB. is public

Page 4: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 4

C. is SerializableD. has a constructor which takes a StringBuffer Object as an argument9. Read this piece of code carefully and give output of it.if( "STRING".toUpperCase() == "STRING")System.out.println("Equal");elseSystem.out.println("Not Equal");A. the code will compile an print “Equal”.B. the code will compile an print “Not Equal”.C. the code will cause a compiler errorD. the code will cause a runtime error10. The syntax to declare a string is as follow:A. String string_name;B. String string nameC. String string class;D. String String_class;11. It refers to an object in Java, which has a sequence of characters.A. ArrayB. StringC. VectorD. None of these12. String are always specified inA. bracesB. double quotesC. single quotesD. square brackets ([])13. String class is more commonly used toA. display errorsB. display messagesC. display programsD. none of these14. Consider the following code snippetString river = new String(“Columbia”);System.out.println(river.length());What is printed?A. 6B. 8C. 7D. 915. String class is more commonly used to displayA. characterB. textC. messages

Page 5: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 5

D. objectState whether below given statements are ‘True’ or ‘False’1. Every string user create is actually an object of type String.2. Objects of type String are unchallengeable.3. Java supports “+” operator to concatenate strings.4. To create an empty string we can write “String s=new String()”.5. Following code will create string with the initialization of “abc”.char c[ ] = {‘a’,’b’,’c’};String s=new String(c);6. Following code will display “cd”.char c[ ] = {‘a’,’b’,’c’,’d’,’e’,’f’};String s=new String(c,2,3);System.out.println(s);7. In equals() method the comparison is case sensitive.8. Suppose executing the following code, assigning “B” value to string will result in stringA being changed to “B”as well.String stringA=”A”;String string=”stringA”;StringB=”B”;9. The startsWith() method determines whether a given string begins with a specified string.10. Suppose we have the following code, so stringA.equals(stringB) returns the same result as stringA==string.String stringA=”A”;String string=stringA;11. StringBuffer class is not thread-safe because when multiple threads access the same class instance, it is notproperly synchronized.12. Whenever user create String object from an array, the String will be unchanged if user modify the contents ofthe array after creating the string.13. When using Iterator class to go through each member inside a collection, it is legal to add extra member intothe collection at the same time.14. The == operator compares two object references to see where they refer to the same instance.15. When using Iterator class to go through each member in the collection, there is no way to move backward toget the previous member.16. Vector class provides a way to dynamically increase the size if required.17. Only object value can be used as a key for Hashtable.18. When adding primitive types into a collection, the Java runtime regardless of the version of Java automaticallyconverts the primitive type to appropriate object type.19. Comparable interface must be implemented by any object that need to be stored in a collection.20. I t is legal to add different types of object into the collection without generic type presents.Fill in the blanks with an appropriate answer1. In Java Programming Language, String is an ---------------------.2. String can be created using ------------------ class.3. String object in Java is a ----------------------- object which means every time a new instance of String will becreated.4. The method --------------------- in string class is used to get the length of the String.5. Operator ------------------- or method -------------------- can be used to concatenate two string together.6. To compare two strings for equality --------------------- method is used.7. To extract a single character from a string ------------------ method is used.8. To extract more than one character from a string ------------------ method is used.9. To determine whether the string ends with a specified string --------------- is used.10. To perform comparison that ignores case difference, --------------------- is used.11. -------------------- class is used to split the given string into pieces using delimiters enabling the retrieval of partof the string for further processing.12. If you want to convert all the characters in a String object into character array ------------------ is used.13. To searches for the first occurrence of a character or substring --------------- method is used.14. ---------------- class represent growable and writeable character sequences.15. The ------------------ package contains the collections framework, legacy collection classes, event model, date andtime facilities, internationalization, and miscellaneous utility classes.

Page 6: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 6

16. An ---------------- is an object that has methods to traverse through the collection classes.17. The ------------------ class represents a last-in-first-out collection of objects.18. If developers try to modify the collection when iterating the whole collections, the system will throw ---------------------.19. Adding primitive types to collections will result converting the primitive types to their ------------------ class.20. If the object in a collection needs to be sorted, it can implement ------------------ interface.Unit-2

Multithreaded ProgrammingShort Answer Questions1. Which are the 2 different ways to support multithreading environment in Java?2. What are the two ways to create a thread?3. How one can create another thread within main function?4. List any 4 methods available in runnable interface.5. What is the purpose of using isAlive() method?6. In which class isAlive() method is available?7. Which methods are used for inter thread communication?8. What is the mechanism defined by Java for the resources to be used by only one thread at a time?9. What is the procedure to own the monitor by many threads?10. What is the unit for 1000 in the following statement ob.sleep(1000);?11. What is the data type for the parameter of the sleep() method?12. What is the values for the following level?Max Priority, min-priority,normal-priority13. Which is the default thread at the time of starting the program?14. Which priority thread can prompt the lower priority thread?15. How many threads at a time can access a monitor?16. What are all the states associated with the thread?17. Which method waits for the thread to die?18. Garbage collector thread belongs to which priority?19. What is mean by time slicing or time sharing?20. What is mean by daemon thread in Java runtime, what is its role?Long Answer Questions1. Describe synchronization in respect to multithreading in detail.2. Can two threads call two different synchronized instance methods of an object? Justify the answer.3. Explain two ways of using thread with an appropriate example.4. What is the difference between Thread.start() and Thread.run() method?5. Why do we need run() and start() method both? Can we achieve with it only run method? Why?6. Can we synchronize the constructor of a Java class? Justify the answer.7. What is thread local class? How can it be used?8. Analyze the preventive measures to be taken for preventing deadlock.9. When invalidMonitorStateException is thrown? Why?10. Compare and contrast sleep(),suspend() and wait()?11. What happens when we make static method as synchronized?12. Can a thread call non-synchronized instance method of an object when a synchronized method is beingexecuted? Justify the answer.13. Identify the role of thread pool.14. Can we synchronize the run method? If yes then what will be the behaviour? Justify the answer.15. Explain different ways of creating a thread with suitable example? Which one would you prefer and why?16. Briefly explain high level state of Threads.17. Compare and contrastyield () and sleep ().18. Explain thread priority.Select an appropriate option from given choices1. What is the name of the method used to start a thread execution?A. Init();

Page 7: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 7

B. Start();C. Run();D. Resume();2. Which two are valid constructors for threads?A. Thread(Runnable r, String name);B. Thread();C. Thread(int Priority);D. Thread(Runnable r,ThreadGroup g);E. Thread(Runnable r,int Priority);3. Which are the three methods of the object class?1. Notify();2. notifyAll();3. isInturrupted();4. Synchronized();5. Interrupt();6. Wait(long millisecond);7. Sleep(long milisecond);8. Yield();A. 1,2,3B. 2,4,5C. 1,2,6D. 2,3,44. Class x implements Runnable{ Public static void main(String args[]){ /*missing code*/}Public void run() {}}Which of the following line code is suitable to start a thread?A. Thread t = new Thread(x);B. Thread t = new Thread(x).start();C. X run= new x();Thread t= new Thread(run); t.strat();D. Thread t= new Thread(); t.run();5. Which cannot directly cause a thread to stop executing?A. Calling the setPriority() method on a thread object.B. Calling wait() method on an object.C. Calling notify() method on an objectD. Calling read() method on an Inputstream object.6. Which two of the following methods are defined in class thread?Strat();Wait();Notify();Run();Terminate();A. 1 and 4B. 2 and 3C. 3 and 4D. 2 and 47. Which of the following will directly stop execution of tread?A. Wait()B. Notify();C. notifyAll();D. exit synchronized code

Page 8: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 8

8. Which method must be defined by a class implementing the Java.lang.Runnable?A. Void run()B. Public void run()C. Public void start()D. Void run(int priority)9. Which will contain the body of the thread?A. Run();B. Strart();C. Stop();D. Main();10. Which method registers a thread in a thread scheduler?A. Run();B. Construct();C. Start();D. Register();11. Which class or interface defines the wait(), notify(), and notifyAll() methods?A. ObjectB. ThreadC. RunnableD. Class12. What will be the output of the program?Class MyThread extends Thread{ Public static void main(String [] args){ MyThread t = new MyThread();t.start();System.out.println(“one. ”);t.start();System.out.println(“Two. ”);}Public void run(){ System.out.println(“Thread ”);}}State whether below given statements are ‘True’ or ‘False’1. The suspend()method is used to terminate a thread2. The run() method should necessary exists in classes created as subclass of thread3. When two threads are waiting on each other and can't proceed the program is said to be in a deadlock4. The word synchronized can be used with only a method.5. The suspend()method is used to terminate a thread?6. The run() method should necessary exists in classes created as subclass of thread?7. When two threads are waiting on each other and can't proceed the program is said to be in a deadlock?8. Garbage Collector belongs to high priority.9. Sleep() method waits for the thread to die.10. Run method is the default thread at a time of starting the program.11. Threads of equal priority are time-sliced automatically in round robin fashion.12. A thread cannot be preempted by a higher priority thread.13. When Java program starts up, one thread begins running immediately. This is usually run() method of yourprogram.14. Java’s multithreading system is built upon the Runnable interface.15. To create or implement threading concept in your Java program you need to either implement runnableinterface or extend Thread class.16. To override run method in program is optional while extending Thread class to create thread.17. The isAlive() method returns false if the thread upon which it’s called is still running.18. More than one thread can own a monitor at a given time.19. Deadlock situation occurs when only thread in a right way.

Page 9: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 9

Fill in the blanks with an appropriate answer1. Thread priorities are in the range between ___________ and ____________.2. By default every thread is given priority ______________.3. Thread can create by implementing ______________.4. To create thread class we need to implement ___________ method.5. __________ method will make your thread in running state.6. Thread priorities are ___________ that specifies the relative priority of one thread to another.7. Threads of equal priority are _______________ in round robin fashion.8. A thread can be preempted by a _______________.9. Java’s multi threading system is built upon the ____________ class.10. Thread begins running immediately by _____________ of your program.11. ___________ method determine if thread is still running or not.12. ___________ method suspend a thread for a period of time.13. ___________ wait for a thread to terminate.14. Sleep method may throw an _____________ exception.15. After the new thread is created, it will not start running until you call its ___________ method.16. The extending class must override the ________ method.17. The ___________ method returns true if the thread upon which it is called is still running.18. ___________ Method waits until the thread on which it is called terminates.Unit – 3

Event handling and AWTShort Answer Questionss:1. What is Delegation event model?2. One benefit of Delegation event model.3. How one can differentiate event and event source?4. Write a signature of Event Source registration method.5. What is unicasting the event?6. What is multicasting the event?7. Which exception is thrown by unicasting event?8. Define the signature of Event source unregister method.9. State 2 major requirements for Event Listener.10. Which package is used for delegation event model in AWT?11. List any 4 event classes supported by AWT.12. What is root class for all events in Java?13. In which package root class for all events resides?14. Which are the two different methods of EventObject class?15. What is super class for all AWT events?16. In which package super class for all AWT events reside?17. State different event class from awt.event package.18. List the event listener interface of AWT.19. State any two methods of ComponentListener interface.20. List methods of WindowListener interface21. Which class resides at top level of AWT hierarchy?22. State two different constructor to create Frame in AWT.23. Which are the two different methods to set the window size in AWT?24. What is use of repaint()?25. What is use of update()?26. What is use of init()?27. What is use of paint()?28. List any 10 different methods of Graphics class.29. List 3 different constructor of color class.30. List any 5 methods of color class.31. List 5 different methods of Font class with brief description.

Page 10: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 10

32. Which method is used to identify the available font family name?Long Answer Questionss1. Explain delegation event model with proper example.2. Which are the three different component of delegation event model? Explain each component in detail.3. What is adapter class? Explain it using MouseAdapter and WindowAdapter.4. How can we create new frame window? How can we set the dimension of the frame window as well as how canwe hide and show frame window and set window title?5. Explain ActionEvent class in detail with its constants,constructors and methods.6. Explain AdjustmentEvent class in detail with its constants,constructors and methods.7. Explain ComponentEvent class in detail with its constants,constructors and methods.8. Explain ContainerEvent class in detail with its constants,constructors and methods.9. Explain ItemEvent class in detail with its constants,constructors and methods.10. Explain MouseEvent class in detail with its constants,constructors and methods.11. Draw the diagram for Java event. And explain Semantic events and low level events.12. List the different event listener interfaces with methods.13. Write a program that will cover all methods from MouseListener and MouseMotionListener.14. What do you mean by adapter classes? Explain it with proper example (code)15. Explain ActionEvent with Proper example.16. Explain KeyEvent with proper example that include all methods of KeyListener.17. What do you mean by Adapter class? List different adapter classes available for different listener in Java.AWT.18. Draw window fundamentals figure. And explain each class.19. Explain MouseEvent class in detail with Frame in applet.20. Explain Graphics class with frame in applet using 10 different methods of Graphics class.21. Explain color class with its constructor and methods and also with example that draw 2 different shapes onapplet with 2 different color.22. Explain use of Font class and explain each method of Font class with brief description.

Select an appropriate option from given choices1. Which event object is generated when a component is activated?A. Action EventB. Adjustment EventC. Text EventD. Item Event2. Which event object is generated when a scrollbar is used?A. Adjustment EventB. Action EventC. Container EventD. Component Event3. Which event object is generated when a text field is modified?A. Text EventB. Low level EventsC. Focus EventD. Key Event4. Which event objects is generated when any components are added or removed from container?A. Container EventB. Component EventC. Focus EventD. Text Event5. Which event objects is generated when component is resized or moved?A. Component EventB. Container EventC. Window EventD. Mouse Event6. Which event objects is generated when component receives focus for input?A. Focus EventB. Component EventC. Key EventD. Mouse Event7. Which event objects is generated when key on keyboard is pressed or released?

Page 11: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 11

A. Key EventB. Mouse EventC. Input eventD. Component Event8. Which event objects is generated when a window activity like maximizing or close occur?A. Window EventB. Container EventC. Mouse EventD. Key Event9. Which event objects is generated when a mouse is used?A. Mouse EventB. Click EventC. Key EventD. Action Event10. Which event objects is generated when component painted?A. Paint EventB. Repaint EventC. Update eventD. Action Event11. An object delegates the task of handling an event to whom?A. Event ListenerB. Event SourceC. EventD. Class12. Listener can be register with which method?A. AddTypeListener();B. RegisterTypeListener();C. AddListener();D. AddTypeListenerInterface();13. Which method is used to remove listener?A. RemoveTypeListener();B. UnregisterTypeListener();C. UnregisterListener();D. RemoveListener();14. Which event class is not a part of symmentic event?A. Action EventB. Item EventC. Text EventD. Key Event15. Which event class is not a part of low level event classes?A. Component EventB. Focus EventC. Mouse EventD. Window Event16. Using which class we can create frame window?A. WindowB. FrameC. ContainerD. Component17. Which method is used to set visibility of frame window?A. setVisbility();B. setVisible(Boolean setFlag);C. setVisible(String setFlag);D. setVisible();18. Which interface is used to close frame window?A. Window ListenerB. Container ListenerC. Component ListenerD. Window Event19. Which method of window listener is used to close frame window?

Page 12: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 12

A. WindowClosed()B. WindowClosing()C. WindowClose()D. Close()20. Which method is used to set title of frame window?A. setTitle(String Title);B. setTitle();C. Title(String Title);D. setWindowTitle(String title);State whether below given statements are ‘True’ or ‘False’1. Applet’s getParameter() method is used to get parameters value.2. All applets are subclass of Applet class.3. All Applet must import Java.event and Java.AWT.4. Applet keyword is used to run applet program from cmd.5. init(),start(),paint(),stop() and destroy() are the method of applet life cycle.6. drawstring() method is used to draw string on applet.7. Graphic is class that is used to deal with graphics for applet.8. Every color is created from an RGB value.9. The checkBoxGroup class is a subclass of the component class.10. TextBox and TextArea are the subclass of Component class.11. setEdit() method is used to set a text component to read only state.12. getState() method allows you to tell if a checkbox is checked or not.13. setLabel() is used to set label on Button component.14. Component event object is generated when component receives focus for input.15. If a frame uses its default layout manager and does not contain any panels, then all the components within theframe are the same height and width.16. New TextArea(10,20) constructor creates a TextArea with 10 rows and 20 columns.17. setLabelText() method is used to set the text of Label Object.18. getChild() method is used to access a component’s immediate container.19. Graphics context is encapsulated by Graphics class.20. Color supplies three methods that let you convert between RGB andHSB.Fill in the blanks with an appropriate answer1. ___________ method is used to centering the text.2. ___________ method is used to set the title of frame window.3. To handle mouse click event ___________ interface we need to implement in our class.4. To draw line ___________ method is used.5. ___________ adapter class is used to handle close event of Frame window.6. To handle button click event ___________ interface we need to implement.7. __________ and __________ are methods of MouseMotionListener interface.8. An object delegates the task of handling an event to ___________.9. To create frame window we need to extends ___________ class.10. To create Applet we need to extends ____________ class.11. To handle key event ________________ interface is used.12. __________ and _________ method is used to get the current position of cursor.13. __________ method is part of ActionListener interface.14. __________ class is used to create color for different object.15. __________ method is used to set new font.16. __________ method allows you to tell if a checkbox is checked or not.17. __________ method is used to set a text component to read only state.18. To use the concept of AWTEvent ___________ package we need to import.19. To use Graphics class functionality __________ package we need to import.20. To create paint brush in applet __________ method is used.

Unit – 4Controls, Layout, Managers and Menus

Short Answer Questionss

Page 13: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 13

1. State 7 different controls supported by AWT.2. Which method is used to add component in to a window?3. Which method is used to remove any one component from a window?4. Which method is used to remove all components from a window?5. List 3 different types of constructors of Label class.6. Define three different alignment constant of Label class.7. Which method is used to set and get the alignment of the text of any Label?8. State different constructors of Button class.9. Which listener is used to handle action event generated by button?10. Which 2 different method is used get a current source button’s label?11. List five different constructor of Check Boxes class with proper signature.12. Which method is used to check whether check box is selected or not?13. Which method is used to get label of selected check box?14. What is difference between check boxes and checkboxgroup?15. Which method is used to determine which checkbox in a group is currently selected?16. What is difference between checkbox control and choice control?17. Define use of Choice class or choice control?18. Which method is used to add a selection to the list with proper signature?19. Which method is used to determine that which item is currently selected from choice control?20. Which method is used to obtain the number of items in the list? Write with proper signature.21. Which method is used to set the currently selected item in choice control? Write with proper signature.22. What is use of List class or List control?23. Define three different constructor of List class with proper signature.24. Which method is used to add a selection to the list? Write with proper signature.25. Which method is used to get the multiple selections from list? Write with proper signature.26. Which method is used to get the name of currently selected item from its index value?27. Which event is generated by Lists?28. What is use of scrollbar class or scrollbar method?29. Define three different constructor of scrollbar class with proper signature.30. Which 2 different constant is used to set the style for scroll bar?31. Which method is used to retrieve minimum and maximum value of scrollbar?32. Which event is generated by scrollbar control?33. Which method is used to handle an event generated by control?34. Define use of TextField control.35. Define four different types of constructor if TextField class with proper signature.36. Which method is used to set the text in textfield and to obtain the text from the text field? Write with propersignature.37. Which method is used to obtain currently selected text from the the TextField? Write with proper signature.38. State difference between TextField and TextArea class.39. State five different constructor of TextArea class with proper signature.40. Which object has a layout manager associated with it?41. Which method is used to set the layout manager? Write with proper signature.42. State different layouts of layout manager.43. What is difference between MenuBar, Menu and MenuItem.44. State 3 different constructor of Menu class with proper signature.45. State 3 different constructor of MenuItem class.46. Define use of dialog box in AWT.47. State 2 different constructor of Dialog class with proper signature.48. State 2 different type of dialog.49. What is difference between Modal dialog and Modeless dialog.Long Answer Questionss1. What is use of Label? Which class is used to create Label in AWT? List 3 different types of constructors of Labelclass. Explain it with example which set and get the text of Label.2. What is use of Push Button? Which class is used to create a push button? Explain concept of push button withuse of 2 different constructors and also get the current source button name from 4 different buttons created byyour program.3. What is use of check box control? Which class is used to create check box control? Explain it with properexample in which display the selection of user.

Page 14: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 14

4. What is use of check box group? Which class is used to create check box group control? Explain in with properexample.5. What is use of Choice control? Which class is used to create choice control? List different types of constructorsand 5 different methods with proper signature. Explain it with example.6. What is use of list control? Which class is used to create list control? List different types of constructors and 5different methods with proper signature. Explain with proper signature.7. What is use of Scroll bar control? Which class is used to create Scroll bar control? Which event is generated byevent? List different types of constructors and 5 different methods with proper signature. Explain it with properexample.8. What is use of TextField control? Which class is used to create text field control? List different types ofconstructors and 5 different methods with proper signature. Which method is used to define textfield aspassword character? Explain it with proper example.9. What is use of Text area control? Which class is used to create text area control? List different types ofconstructors and 5 different methods with proper signature. Explain with proper example.10. What is use of layout manager? Which method is used to set the layout of window in AWT? Which differentlayouts are supported in AWT? Explain any one of them in detail with example.11. What is use of flowlayout? Which class is used to create flowlayout? List different constant used to set theflowlayout. Explain it with example in which you have to add 6 different components in a window with use ofFlowlayout.12. What is use of border layout? Which class is used to create border layout? List different constructors of thesame. Explain it with example in which you have to add 6 different components in a window with use of borderlayout.13. What is use of insets layout? Which class is used to create insets layout? List different constructors of the same.Explain it with example in which you have to add 4 different components in a window with use of insets layout.14. What is use of grid layout? Which class is used to create grid layout? List different constructors of the same.Explain it with example which creates a 4 by 4 grid and fills it in with 15 buttons each labeled with its indexvalue.15. What is use of card layout? Which class is used to create card layout? List different constructors and methodswith proper signature of the same. Explain it with example which creates a two-level card deck that allows theuser to select an operating system. Window based operating systems are displayed in one card. Other os will bein the other card.16. What is use of gridbag layout? List any 6 methods of the same class with proper signature and with briefdescription. Explain with example which includes 6 methods you have described above.17. What is use of menu and menu bar? Which class is used to create menu and menubar? List different constructorand any five methods of the same with proper signature and brief signature and also explain with examplewhich includes five methods that is described above.18. What is use of menu item? How one can add menu items in menu? Explain it with proper example.19. How one can create checkable menu item? Which class is used to create checkable menu item? Explain withexample.20. What is use of dialog box? Which are the two different types of dialog are there and give difference betweenthem? Explain it with proper example.Select an appropriate option from given choices1. Which of the following control is not supported in AWT?A. Push buttonB. ChoiceC. ListD. Drop down list2. Which method is used to add component to your container?A. add();B. addComponent();C. addComponent(Component obj);D. add(Component obj);3. Which method is used to remove any specific component to your container?A. remove()B. removeComponent()C. removeComponent(Component obj)D. remove(Component obj)4. The various controls supported by AWT are

Page 15: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 15

A. Labels, push buttonsB. Checkboxes, choice, listC. Scroll bars, text area, text fieldD. All of these5. The concept of the menu bar can be implemented by using three Java classes—A. MenuBarB. MenuC. MenuItemD. All of these6. The most commonly used layout managers areA. FlowLayoutB. BorderLayoutC. GridLayoutD. CardLayoutE. All of these7. AWT meansA. Abstract Window ToolkitB. Abstract Window ToollayoutC. Abstract Withdraw ToolsD. Abstract Window Title8. A checkbox is a control that consists of aA. Combination of a small boxB. A labelC. Combination of a large box and a labelD. Both a & b9. The AWT container is an instance of the ___________ class which holds various components and other containersA. GraphicsB. ContainerC. EventobjD. None of these10. The general form to set a specific type of layout manager isA. void setLayout(LayoutManager lm)B. Void setLayout(LayoutManager lm)C. void setLayout(layoutManager lm)D. Void setLayout(Layoutmanager lm)11. Java packages such as ________________ support the Event handling mechanism.A. Java.utilB. Java.AWTC. Java.AWT.eventD. All of these12. Positions the components into five regions:east, west, north, south, centerA. BorderLayoutB. CardLayoutC. GridLayoutD. FlowLayout13. Arranges the components as a deck of cards such that only one component is visible at a timeA. BorderLayoutB. CardLayoutC. GridLayoutD. FlowLayout14. Arranges the components horizontallyA. BorderLayoutB. CardLayoutC. GridLayoutD. FlowLayout15. Arranges the componemnts into gridA. BorderLayoutB. CardLayoutC. GridLayoutD. FlowLayout

Page 16: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 16

16. __________ creates a dropdown list of textual entriesA. ChoiceB. CheckboxC. TextboxD. TextComponent17. The Component class and MenuComponent class are the ___________ which represent the GUI components.A. SubclassesB. SuperclassesC. Both a & bD. None of these18. The AWT classes can be roughly categorized into the following groups:A. GUI ComponentsB. LayoutsC. Graphics ToolsD. Event HandlersE. All of these19. A menu bar representsA. A list of menus which can be added to the top of a top-level windowB. A list of menus which can be deleted to the top of a top-level windowC. A list of menus which can be added to the bottom of a bottom-level windowD. None of these20. The two types of menus which are given as followsA. Pop-up menusB. Regular menusC. Both a & bD. Both a & bState whether below given statements are ‘True’ or ‘False’1. setLayout() method is used to set the layout of a container.2. getPreferredSize() method is used to returns the preferred size of a component.3. Grid layout is used to organize the components of a container in a tabular form.4. Grid layout is a default layout for an applet, a frame and a panel.5. Add() method is used to add component to a container.6. To remove all components from the container remove(component obj) method is used.7. Labels are passive control that does not support any user interaction.8. getLabel() method is used to get the text of the label.9. Void setAlignment(String alignment) method is used to set the alignment of text on label.10. Click event will get generate when button is clicked by user.11. getActionCommand() method will return the name of respective component.12. CheckBox class is used to create drop down list in Java.13. CheckBoxGroup class is used to create radio button control in Java14. setLabel(string str) method is used to set the label of any checkbox control.15. getState() method is used to check whether checkbox is selected or not.16. List class is used to create a list in which we can select only one item.17. getSelectedItem() method is used to get the item from list or choice control.18. ItemListener interface need to be implemented by choice and list control.19. setEchoChar(char ch) is used to set text as password.20. setEditable(Boolean edit) is used to set textfield as editable.

Unit – 5Swing

Short Answer Questionss1. When swing comes in to the picture?2. State key features of swing.3. Differentiate Model and View of MVC.4. Which package we should import to use swing control?5. Define terms of MVC architecture.6. Swing class is derived from which class?

Page 17: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 17

7. List five different component of swing.8. Which package we should import to handle an event generated by swing control?9. State different top level containers.10. Swing components are derived from which package?11. To close JFrame in swing which function is used?12. To implement the event handling mechanism which packages we need to import?13. Which class is used to create label with icon?14. Define use of toggle button?15. Which method is used to check the state of toggle button (i.e whether its in on mode or off) ?16. Which class is used to insert image in Lable?Long Answer Questionss1. When Swing comes into the picture? How swing is more powerful than applet?2. State drawback of AWT over swing. State features of swing.3. Explain MVC architecture? Explain it with practical example.4. What is difference between components and container? How we can achieve concept of container andcomponent in swing? Which classes are used for the same?5. How we can create swing application? Explain one program using one of these methods.6. Explain event handling in swing with appropriate example.7. How one can create swing applet? Explain with example.8. Exaplain JLabel component in swing using ImageIcon. Explain all methods of JLabel and ImageIcon with briefdescription and with proper signature.9. Develop one program that will cover all the methods of JLabel and ImageIcon control.10. Explain JTextField component in swing with brief description of all methods of the same class. Also develop oneprogram that will cover all methods and constructors of JTextField class.11. Explain JButton component in swing with brief description of all methods of the same class. Also develop oneprogram that will cover all methods, constructors and event handling of JButton class.12. Explain JToggleButton component in swing with brief description of all methods of the same class. Also developone program that will cover all methods, constructors and event handling of JToggelButton class.13. Explain JCheckBox component in swing with brief description of all methods of the same class. Also develop oneprogram that will cover all methods, constructors and event handling of JCheckBox class.14. Explain JRadioButton component in swing with brief description of all methods of the same class. Also developone program that will cover all methods, constructors and event handling of JRadioButton class.15. Explain JTabbedPane component in swing with brief description of all methods of the same class. Also developone program that will cover all methods and constructors of JTabbedPane class.16. Explain JScrollPane component in swing with brief description of all methods of the same class. Also develop oneprogram that will cover all methods and constructors of JScrollPane class.17. Explain JList component in swing with brief description of all methods of the same class. Also develop oneprogram that will cover all methods, event handling and constructors of JList class.18. Explain JComboBox component in swing with brief description of all methods of the same class. Also developone program that will cover all methods, event handling and constructors of JComboBox class.19. Explain Tree component in swing with brief description of all methods of the same class. Also develop oneprogram that will cover all methods, event handling and constructors of Tree class.20. Explain JTable component in swing with brief description of all methods of the same class. Also develop oneprogram that will cover all methods and constructors of JTable class.Select an appropriate option from given choices1. MVC stands forA. Model View ControllerB. Mode View ControllerC. Model View ControlD. Model Viewer Controller2. Swing introduced in __________A. 1997B. 1996C. 1995D. 19943. Swing components are derived from the

Page 18: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 18

A. JComponentB. ComponentC. ContainerD. None of these4. Following are the Top Level containersA. JAppletB. JFrameC. JDialogD. JWindow5. To set close operation on Frame which function is usedA. setDefaultCloseOperation()B. setDefaultClose()C. setFrameCloseOperation()D. none of these6. To create swing applet we need to extend which class?A. JAppletB. AppletC. SwingAppletD. None of these7. How many constructors are there in JLabel class?A. 1B. 2C. 3D. 48. Which class is used to create icon in Label?A. IconB. ImageIconC. ImageD. None of these9. How many constructors are there in JTextField class?A. 1B. 2C. 3D. 410. Set command for particular button which function is used?A. ActionCommand(String command)B. getActionCommand()C. setActionCommand(String str)D. none of theseState whether below given statements are ‘True’ or ‘False’1. MVC stands for Model View Controller.2. We can create JLabel in 4 different ways.3. We can create JButton in 4 different ways.4. To set the current action command when particular button is pressed setActionCommand().5. ImageIcon class is used to create icon for Label.6. JButton component has a 2 different states: push and release.7. Immediate super class for JCheckBox class is JToggleButton.8. isSelected() method is used to check wether togglebutton is in pressed state or release state.9. JRadioButton generates action events.10. JScrollPane manages a set of components by linking them with tabs.11. JTabbedPane uses theSingleSelectionModelmodel.12. JTabbedPane have 4 different types of constructors.13. To create swing applet we need to extend Applet class14. Swing introduced in 199815. To set close operation on Frame setDefaultCloseOperation function is used16. JComopnent class derived form Container and component.17. You can selectively prevent a field from being saved through the use of the Transient keyword.18. JList is based on three different models.

Page 19: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 19

19. JList components generate ListSelectionEvent.20. There are three different types of property in Java bean.Fill in the blanks with an appropriate answer1. MVC stands for ____________.2. To set the current action command when particular button is pressed _____________ method is used.3. _______________ class is used to create icon for Label.4. _______________ component has a 2 different states: push and release.5. Immediate super class for JCheckBox class is ________________.6. ________________ method is used to check whether togglebutton is in pressed state or release state.7. JRadioButton generates___________________.8. _________________ a set of components by linking them with tabs.9. _________________ the SingleSelectionModelmodel.10. To create swing applet we need to extend __________ class11. Swing introduced in __________.12. To set close operation on Frame ______________ function is used.13. JComopnent class derived form _________ and ____________ class.14. JList is based on _________ different models.15. You can selectively prevent a field from being saved through the use of the ________________ keyword.16. JList components generate ______________ event.17. There are __________ different types of property in Java bean.18. ________________ exception is thrown by Constrained Property.19. A Bean that has a ___________________ property generates an event when an attempt is made to change its value.

20. A Bean that has a __________________ property generates an event when the property is changed.Unit 6

Network ProgrammingShort Answer Questions1. In which layer of OSI model TCP/IP protocol is available?2. What is protocol?3. Differentiate TCP/IP and Datagrams.4. What is the port no for FTP?5. What is the port no for Telnet?6. What is the port no for HTTP?7. What identifies each computer on Internet?8. Give any 2 differences between IPV4 and IPV6.9. INet6Address belongs to which package?10. The InetAddress used for what?11. What is the difference between URL instance and URLConnection instance?12. What is socket in Java Networking?13. What information is needed to create a TCP socket?14. What are the two important TCP Socket classes?15. When MalformedURLException and UnknownException throws?16. What is the difference between the file and RandomAccessFile classes?17. What interface must an object implements before it can be written to a stream as an object?Long Answer Questions1. Explain TCP/IP Client Socket with appropriate example.2. Explaint InetAddress with proper example.3. List the instance method of InetAddress class with brief description.4. What is socket and explain its instance methods with suitable example.5. Explain what is URL using example.6. Explain four different Components of URL.7. Explain different types of constructor of URL class.8. What is the difference between URL and URLConnection?9. What is the difference between URLConnection and HttpURLConnection?10. Explain any Eight different methods of URLConnection class.11. Write a program using URL and URLConnection to establish connection to any site and get the information of the

Page 20: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 20

same site.12. What is the use of HttpURLConnection class? Explain any five instant methods of the same class.13. What is the difference between URL and URI?14. Explain TCP/IP Server socket.15. What is Datagram? Explain in detail.16. Explain DatagramSocket in detail with its constructor and methods.17. Explain DatagramPacket . define its different Constructors.18. Explain Datagram with appropriate example.19. Explain IP,TCP and UDP in detail.Select an appropriate option from given choices1. TCP stands forA. Transaction control ProtocolB. Transmission Control ProtocolC. Transmission Circuit ProtocolD. Transaction Circuit Protocol2. IP stands forA. InetAddress ProtocolB. Internet ProtocolC. Inet4Address ProtocolD. Inet6Address Protocol3. UDP stands forA. User Datagram ProtocolB. User Direct ProtocolC. User Datasocket ProtocolD. User Default Protocol4. Which of the following is required to communicate between two computers?A. Communication softwareB. ProtocolC. Communication Hardware.D. All of above.5. Which of the following services use TCP?A. DHCPB. SMTPC. HTTPD. TFTPE. FTPA. 1 and 2B. 2,3 and 5C. 1,2 and 4D. 1,3 and 46. The name of internet address isA. IP AddressB. UDPC. Domain NameD. Address7. The InetAddress class is used to encapsulateA. IP AddressB. Domain NameC. Internet AddressD. A and B

Page 21: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 21

8. URL stands forA. Universal Resource LocatorB. Uniform Resource LocatorC. Uniform Redirect LocationD. Universal Resource Library9. What is protocol in given URL http://www.google.comA. HTTPB. WWWC. .ComD. Google10. What is the port no of HTTPA. 21B. 23C. 119D. 8011. What is the port no FTP?A. 23B. 21C. 43D. 7912. URL throws which exception?A. MalformedURLExceptionB. InterruptedExceptionC. NullPointerExceptionD. ArrayIndexOutOfBoundException13. URL’s method OpenConnection() throws which Exception?A. MalformedURLExceptionB. InterruptedExceptionC. NullPointerExceptionD. IOExceptionState whether below given statements are ‘True’ or ‘False’1. UDP is a protocol that sends independent packets of data, called datagrams, from one computer to another withguarantees about arrival and sequencing.2. The TCP and UDP protocols use domains to map incoming data to a particular process running on a computer.3. Port is represented by a positive (16-bit) integer value.4. Every computer on the Internet is identifi ed by a unique, 6-byte IP address .5. Sockets provide an interface for programming networks at the transport layer.6. A socket is an endpoint of a three-way communication link between three programs running on the network.7. The two key classes from the Java.net package used in creation of server and client programs are: ServerSocketand ClientSocket8. A server program creates a specific type of socket that is used to listen for client requests.9. UDP stands for Universal datagram Protocol10. Datagram communication through the following classes DatagramPacket and DatagramSocket.11. URI stands for Universal Resource Identifier.12. IP stands for Internation Protocol.13. Port for HTTP is 90.14. URLConnection can open secure connection.15. OpenConnection() method is from URL class.16. Is TCP Connection Less Protocol.17. TCP stands for Transaction Control Protocol.18. UDP is more reliable than TCP protocol.19. The same port number can be reused many times when binding with sockets simultaneously

Page 22: 060010503-Advanced Java 2014 - UTUutu.ac.in › dcst › download › documents › QBMSCIT060010503.pdf060010503-Advanced Java 2014 Ms. Anuja Vaidya Page 6 16. An ----- is an object

060010503-Advanced Java 2014

Ms. Anuja Vaidya Page 22

20. In order to create a client socket connecting to a particular server, the IP address must be given to the clientsocket, otherwise, it cannot connect to the server21. Sockets provide an interface for programming networks at the transport layer.22. Call Socket.close() method will close the TCP server that socket connects to.Fill in the blanks with an appropriate answer1. ______ is a connection-oriented and reliable protocol, ______ is a less reliable protocol.2. The TCP and UDP protocols use ______ to map incoming data to a particular process running on a computer.3. Datagrams are normally sent by ______ protocol.4. Java uses ______ class representing a server and ______ class representing the client that uses TCP protocol.5. ______ is used to wait for accepting client connection requests.6. Class ______ is used to create a packet of data for UDP protocol.7. If something goes wrong related to the network, ______ will be thrown when dealing with TCP/UDP programmingin Java.8. The main purpose of URL encoding is to maintain the ______ between various platforms.9. Based on the URL encoding mechanism, “www.test.com/test me&test you” becomes ______.10. ______ method is used to instantiate a URLConnection instance.11. URL stands for ____________.12. UDP stands for ____________.13. TCP/IP stands for ____________.14. Http is on _________ port.