Java J2EE Portal
Enterprise Java Station
J2EE curve
Java News / Articles
Java News / Articles
Complementing Unit Test with Dependency Injection and Mock Objects
India Java User Groups
EJBToJDO
Migrating a J2EE application from EJB to JDO
Processing...
Buy Java, Deals On Software Technology Store
Click here for great deals on computers, laptops, software and books
Test your Java language skills - Quiz 1 PDF Print
Written by Content Team   
Sep 12, 2006 at 11:04 PM
Most professional Java developers tend to get so busy with their specialization that they often lose touch with the basic Java language itself. So if you wish to test your Java skills and check if you still are in touch with the language, here's the first of our mini Java quizzes.

These questions are courtesy of Whizlabs Software and will also help you prepare for the Sun Certified Java Programmer Exam 5.0 (SCJP).

If you are looking for a user contributed database of 100s of Java questions, check out the Java Interview Questions Bank .

Question No. 1: If the complete date/time information is Mon May 23 09:05:28 PM GMT+05:30 2005, what will be printed out by the following program?

class Format2 {

public static void main(String[] args){

Formatter fmt=new Formatter();
Calendar cal=Calendar.getInstance();
fmt.format("%tr %tZ",cal,cal);
System.out.println(fmt);

}

}

A. 09:05:28 PM GMT+05:30
B. 21:05:28 2005
C. Mon 21:05:28 GMT+05:30 2005
D. 21:05:28 GMT+05:30
E. May 23 09:05:28 PM GMT+05:30

Question No. 2: What is the result of compiling and running the following code?

class StringBufferTest{

public static void main(String[] args){

1. StringBuffer result = new StringBuffer();
2. StringBuffer s=null;
3. result.append(s);
4. result.insert(0,"123");
5. System.out.println(result);

}

}

A.Compiler error at line 1
B.Compiler error at line 3
C.Compiler error at line 4
D.NullPointerException
E.StringIndexOutOfBoundsException
F.Prints "123null"

Try your best to solve these before you jump to the next page for answers.




Add This Feed Button

Enter your Email


Java Expert Interviews
RubyOnRailscreatorDavidHeinemeierHansson
Let Java retire from the spotlight of web applications in dignity
ChristopherDuncan
Programmers lose because they are unwilling to learn any skill beyond the technical
TonyMorrisJTiger
Why pick JTiger Java Unit Testing Framework over good old JUnit?
Processing...
Go to top of page  Home |
SiteMap

Copyright 2004 to 2008 Rightrix Solutions. All rights reserved. All product names are trademarks of their respective companies. Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Rightrix Solutions and IndicThreads.com are independent of Sun Microsystems, Inc.

Views expressed at IndicThreads.com reflect the views of the authors alone, and do not necessarily reflect those of IndicThreads.com. IndicThreads.com and it's authors are not responsible for reader comments and opinions.

Enterprise Java J2EE JEE Portal >> IndicThreads.com