Java Programming Fundamentals
Test your knowledge of Java programming basics including data types, arrays, JSP, servlets, and EJB concepts.
Questions
Stateful session beans contain
- Home Interface
- Remote Interface
- Bean Class
- All the above
Which file contains the EJB modules of the application?
- .jar
- .war
- .ear
- .zip
What are the call back methods in Session bean?
- ejbCreate()
- ejbPassivate(),
- ejbActivate()
- All the above
JTA stands for
- Java Transaction Array
- Java Transaction API
- Java Translation Array
- Java Translation API
JTS stands for
- Java Transaction Service
- Java Translation Service
- Java Transaction Servlet
- Java Translation Servlet
Which one of the following is a valid declaration of an applet?
- Abstract class MyApplet extends java.applet.Applet {
- Public class MyApplet extends java.applet.Applet {
- Class MyApplet implements Applet {
- Public class MyApplet extends applet implements Runnable {
What are the JSP scripting elements?
- Declaration
- Scriplets
- Expressions
- All the above
What are the different types of JSP tags?
- Presentation Tag
- JSP standard Tag
- Custom tags
- All the above
int j; for(int i=0;i<14;i++) { if(i<10) { j = 2 + i; } System.out.println("j: " + j + " i: " + i); } What is WRONG with the above code?
- Integer "j" is not initialized.
- Nothing.
- You cannot declare integer i inside the for-loop declaration.
- The syntax of the "if" statement is incorrect.
int values[] = {1,2,3,4,5,6,7,8}; for(int i=0;i< X; ++i) System.out.println(values[i]); Referring to the above, what value for X will print all members of array "values"?
- 1
- 7
- 8
- 9
What are the two parts of a value of type double?
- significant digits
- length
- exponent
- Both & b
The following a legal Java statement
- m1 = new TextField("sixty");
- 1a = 6;
- add(m1);
- m1.setText("Hello world);
A function is:
- An entity that receives inputs and outputs
- A way of storing values
- A sequence of characters enclosed by quotes
- A kind of computer
What will happen if you attempt to compile and run the following code? Integer ten=new Integer(10); Long nine=new Long (9); System.out.println(ten + nine); int i=1; System.out.println(i + ten);
- 19 followed by 20
- 19 followed by 11
- Error: Can't convert java lang Integer
- 10 followed by 1
Which method takes the HttpServletRequest and HttpServletResponse objects as its arguments
- jspInit()
- jspDestroy()
- _jspService()
- None of the above
What JSP lifecycle methods can I override?
- jspInit()
- jspDestroy()
- _jspService()
- Both a & b
What does the following line of code mean? Double table[];
- table is a variable to refers to a real number
- table is a variable that refers to two numbers
- It is not legal Java code
- table is a variable that refers to an array
The following is NOT an example of a data type.
- int
- public
- button
- void