10CS753: Java & J2EE Objective Type Questions:

advertisement
10CS753: Java & J2EE
Question Bank:
Objective Type Questions:
What is the base class of all classes?
Which package is imported by default?
What are the restrictions imposed on a static method or a static block of code?
Why the main method is declared static?
Which object oriented Concept is achieved by using overloading and overriding?
What is a native method?
Does Java support multiple inheritance?
What is the return type of the main() method?
What is the arguement of main() method?.
How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
Which non-Unicode letter characters may be used as the first character of an identifier?
Can a main() method be overloaded?
Can a main() method be declared final?
Does the order of public and static declaration matter in main() method?
Can a source file contain more than one class declaration?
Can a class be declared as protected?
What is the range of the char type?
What is the range of the short type?
What is the access scope of a protected method?
What is the purpose of declaring a variable as final?
What is the impact of declaring a method as final?
I don't want my class to be inherited by any other class. What should i do?
Can you give few examples of final classes defined in Java API?
How is final different from finally and finalize()?
Can a class be declared as static?
When will you define a method as static?
What is the importance of static variable?
What is an Abstract Class and what is it's purpose?
Can a abstract class be declared final?
What is use of a abstract variable?
Can you create an object of an abstract class?
Can a abstract class be defined without any abstract methods?
Can a method inside a Interface be declared as final?
Can an Interface implement another Interface?
Can an Interface extend another Interface?
Can a class be defined inside an Interface?
Can an Interface be defined inside a class?
What is a Marker Interface?
Can we define private and protected modifiers for variables in interfaces?
What is an abstract method?
What value does read() return when it has reached the end of a file?
Which class is extended by all other classes?
What restrictions are placed on method overloading?
What modifiers can be used with a local inner class?
Are true and false keywords?
What happens when you add a double value to a String?
Descriptive Questions:
1. With a code snippet, explain in detail the different members of a typical Java
class.
2. Write short notes on the following:
a. this parameter in Java
b. constructor in Java
c. Multiple inheritance in Java
3. With an example, explain the concept of multiple constructors in Java and how to
invoke one constructor from another.
4. With relevant examples, explain in detail the concept of “initialize blocks” in Java.
5. With an example, explain in detail the “finalizer” concept in Java.
6. Explain in brief any two of the following:
a. Access levels in Java
b. Nested classes
c. Enum type
7. What is an inner class? Explain with an example.
8. With an example, explain inheritance in Java.
9. What are the different things one is allowed to do in a subclass?
10. Explain in detail the “object finalization” in Java.
11. Explain in detail the concept of “interface” in Java.
12. Explain abstract class concept in Java with an example.
13. Explain in detail the different types of exceptions with examples.
14. Explain the exception handling mechanism in Java with a code snippet.
Please include code to handle multiple exceptions.
15. Write short notes on the following:
i. The throws keyword and its use in Java.
ii. The finally keyword and its use.
16. Explain in detail, with relevant code the user defined exceptions in Java.
17. Write short notes on the following:
i. 5 key differences between an Applet and a standalone Java
application.
ii. Architecture of an Applet.
18. Explain in detail the lifecycle of an Applet.
19. Write the skeleton code for an applet and explai
20. Write short notes on any two of the following:
i. Bytecode
ii. Encapsulation
iii. Inheritance
iv. Polymorphism
21. Explain in detail the primitive data types in Java.
22. Explain the reference data types in Java.
23. With an example, explain the different parts of a typical Java program.
24. Explain in detail the primitive data type conversion in Java.
25. Write short notes on the reference data types in Java.
26. Explain in detail the bitwise and shift operators in Java with examples.
27. Explain how arrays are handled in Java.
28. Explain briefly the control statements in Java.
29. Write a Java program to print out all the command line arguments through
which you can explain all the iteration statements.
30. With a relevant example, explain the following:
i. Labeled break
ii. Labeled continue
31. Explain in detail the different types of exceptions with examples.
32. Explain the exception handling mechanism in Java with a code snippet.
Please include code to handle multiple exceptions.
33. Write short notes on the following:
i. The throws keyword and its use in Java.
ii. The finally keyword and its use.
34. Explain in detail, with relevant code the user defined exceptions in Java.
35. Write short notes on the following:
i. 5 key differences between an Applet and a standalone Java
application.
ii. Architecture of an Applet.
36. Explain in detail the lifecycle of an Applet.
37. Write the skeleton code for an applet and explain the same.
38. Write short notes on the following:
i. Invoking an applet
ii. The differences between a signed and an unsigned applet in terms of
what they are allowed to do.
39. Write a program to implement an Applet which would accept some
parameters and display the same on the screen.
40. Explain the two thread creating mechanisms available in Java with relevant
code snippets.
41. Explain the isAlive() and join() methods with relevant code snippets.
42. Write short notes on the following:
i. Thread priorities in Java
ii. Any 5 most commonly used methods from the Thread class.
43. Explain the thread synchronization mechanism in Java with relevant code
snippets.
44. Explain with a relevant example the wait(), notify() and notifyAll() methods.
45. Explain how one could suspend and resume a thread in Java with relevant
code snippet.
46. Write short notes on the following:
i. The Delegation Event model of handling events in Java.
ii. The Event class citing any 2 most commonly used classes.
47. With relevant source code, explain how to implement the Event Delegation
model for handling keyboard events.
48. Write short notes on the following:
i. Adapter classes and their use.
ii. The use of an Anonymous inner class in implementing an event
handler.
49. Explain in detail the main benefits of the J2EE platform.
50. Explain the different tiers in a typical multi-tiered enterprise application and
the J2EE technologies used in implementing these tiers.
51. Explain any two types of JDBC drivers along with the associated
advantages and disadvantages.
52. Explain the different steps which form the JDBC process with a relevant
code snippet.
53. Write short notes on the following:
i. JDBC url
ii. The getConnection() method
54. Explain the different types of Statement objects with relevant code
snippets.
55. Write short notes on the following:
i. Comparison between CGI and Servlets
ii. Compiling, deploying and invoking a servlet
56. Explain in detail the anatomy of a Java servlet.
57. In the context of Java servlets, write short notes on the following:
i. Deployment descriptor
ii. Using Tomcat for servlet development
58. Explain the working of a typical Java servlet (HTTP) with sample code.
59. Explain any five of the HTTP Request headers with examples and write a
code snippet which reads in these headers in a Java servlet.
60. Explain any five of the HTTP Response headers with examples and write a
code snippet which writes these headers in a Java servlet.
61. With relevant code, explain how cookies are used in a Java servlet.
62. Write short notes on the following:
i. Cookie attributes
ii. Tracking sessions in a Java servlet
63. Explain the different types of JSP tags.
64. Write short notes on the following:
i. Handling variables and objects in a JSP
ii. Defining methods in a JSP program.
65. With a relevant JSP program, explain the different loops used in a JSP
program.
66. What is the primary benefit of Encapsulation?
67. Give some features of Interface?
68. What do you mean by Multithreaded program?
69. Explain the usage of this() with constructors?
70. Define immutable object?
71. What is the purpose of default constructor?
72. Can a constructor be made final?
73. What is NullPointerException?
74. What are the ways in which a thread can enter the waiting state?
75. What is the difference between yielding and sleeping?
66. Explain in detail the user request string and how parameters are
passed
and read in a JSP program.
67. Explain in detail how sessions are tracked in a JSP program.
68. With relevant code, explain the server side program in a Java RMI
application.
69. Write short notes on the following:
i. Pluggable look and feel in Swing
ii. Containers in Swing
70. Write a program to implement an applet using Swing and explain the
same.
71. List the different kinds of buttons implemented in Swing and write a
Swing
application to explain how events are handled for a Radio Button.
72. Write a program to demonstrate the use of a tabbed pane in a Swing
application.
73. Write a program to demonstrate the use of a scroll pane in a Swing
application.
74. Write short notes on the following:
i. EJB Interfaces
ii. Deployment descriptor in the context of EJB
Download