Java Programming Fundamentals

Test your knowledge of Java programming basics including data types, arrays, JSP, servlets, and EJB concepts.

18 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Stateful session beans contain

  1. Home Interface
  2. Remote Interface
  3. Bean Class
  4. All the above
Question 2 Multiple Choice (Single Answer)

Which file contains the EJB modules of the application?

  1. .jar
  2. .war
  3. .ear
  4. .zip
Question 3 Multiple Choice (Single Answer)

What are the call back methods in Session bean?

  1. ejbCreate()
  2. ejbPassivate(),
  3. ejbActivate()
  4. All the above
Question 4 Multiple Choice (Single Answer)

JTA stands for

  1. Java Transaction Array
  2. Java Transaction API
  3. Java Translation Array
  4. Java Translation API
Question 5 Multiple Choice (Single Answer)

JTS stands for

  1. Java Transaction Service
  2. Java Translation Service
  3. Java Transaction Servlet
  4. Java Translation Servlet
Question 6 Multiple Choice (Single Answer)

Which one of the following is a valid declaration of an applet?

  1. Abstract class MyApplet extends java.applet.Applet {
  2. Public class MyApplet extends java.applet.Applet {
  3. Class MyApplet implements Applet {
  4. Public class MyApplet extends applet implements Runnable {
Question 7 Multiple Choice (Single Answer)

What are the JSP scripting elements?

  1. Declaration
  2. Scriplets
  3. Expressions
  4. All the above
Question 8 Multiple Choice (Single Answer)

What are the different types of JSP tags?

  1. Presentation Tag
  2. JSP standard Tag
  3. Custom tags
  4. All the above
Question 9 Multiple Choice (Single Answer)

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?

  1. Integer "j" is not initialized.
  2. Nothing.
  3. You cannot declare integer i inside the for-loop declaration.
  4. The syntax of the "if" statement is incorrect.
Question 10 Multiple Choice (Single Answer)

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. 1
  2. 7
  3. 8
  4. 9
Question 11 Multiple Choice (Single Answer)

What are the two parts of a value of type double?

  1. significant digits
  2. length
  3. exponent
  4. Both & b
Question 12 Multiple Choice (Single Answer)

The following a legal Java statement

  1. m1 = new TextField("sixty");
  2. 1a = 6;
  3. add(m1);
  4. m1.setText("Hello world);
Question 13 Multiple Choice (Single Answer)

A function is:

  1. An entity that receives inputs and outputs
  2. A way of storing values
  3. A sequence of characters enclosed by quotes
  4. A kind of computer
Question 14 Multiple Choice (Single Answer)

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);

  1. 19 followed by 20
  2. 19 followed by 11
  3. Error: Can't convert java lang Integer
  4. 10 followed by 1
Question 15 Multiple Choice (Single Answer)

Which method takes the HttpServletRequest and HttpServletResponse objects as its arguments

  1. jspInit()
  2. jspDestroy()
  3. _jspService()
  4. None of the above
Question 16 Multiple Choice (Single Answer)

What JSP lifecycle methods can I override?

  1. jspInit()
  2. jspDestroy()
  3. _jspService()
  4. Both a & b
Question 17 Multiple Choice (Single Answer)

What does the following line of code mean? Double table[];

  1. table is a variable to refers to a real number
  2. table is a variable that refers to two numbers
  3. It is not legal Java code
  4. table is a variable that refers to an array
Question 18 Multiple Choice (Single Answer)

The following is NOT an example of a data type.

  1. int
  2. public
  3. button
  4. void