|
SYS-CON.TV Webcasts
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Top Links You Must Click On
General Java Java Certification
Java Certification
By: Naveen Gabrani
Oct. 6, 2004 12:00 AM
Related Links: Have you looked at the certificate that your neighbor has so proudly displayed in his or her office? Have you ever wondered if getting certified in Java is worth the time and effort? This article argues the case for certification and provides information on how to prepare for the SCJP exam. In today's tough job market, a certification from an established vendor like Sun can act as one more selling point in your résumé. All else being equal, most employers will prefer a certified candidate. Certification alone does not guarantee a job. But it acts as a reassurance to a prospective employer that the candidate at least understands the basics of Java. The certification is especially useful if you are a new graduate or if you're looking for your first job in Java. Perhaps even more useful than getting the certificate is the learning involved in preparing for the exam. The certification enforces discipline. Most people are too busy with their jobs to have time to stay up-to-date on the latest technologies. Preparing for certification helps bring focus and discipline, and lets you update your skills on a specific technology. The certification exams from Sun are industry standard and well recognized in the industry. Sun offers seven Java-related certification exams:
A quick overview of each of these exams is provided in the following. Scheduling the SCJP Exam
The exam objectives define the course contents for the exam. The topics include declarations and access control, flow control, assertions and exception handling, garbage collection, language fundamentals, operators and assignments, overloading, overriding and object orientation, threads, fundamental classes, and collections. The exam covers some of the facets of Java that are sometimes unknown even to a seasoned Java programmer. So some exam-specific preparation is required even for experienced Java programmers. Sample Questions Answer: B and F. A constructor must have the same name as the class. The name of the class is Test. Since Java is case sensitive, test is different than Test, hence option A is not valid. The constructor must not return any value, so option C is incorrect. A constructor cannot be declared abstract or final. Hence D and E are incorrect answers. Since taking a void argument is illegal in Java, G is also illegal. Question 2 (Flow control)
1. public class example {
2. public static void main(String args[]) {
3. int x = 0;
4. if(x > 0) x = 1;
5.
6. switch(x) {
7. case 1: System.out.println(1);
8. case 0: System.out.println(0);
9. case 2: System.out.println(2);
10. break;
11. case 3: System.out.println(3);
12. default: System.out.println(4);
13. break;
14. }
15. }
16. }
A. 0 Answer: A and C. The main method initialized x to 0. The if condition at line 4 returns false, so x remains zero at the beginning of the switch statement. The value of x matches with case 0. Hence 0 gets printed. Since there is no break statement after this, 2 also get printed. The break statement after case 2 leads to the control coming out of the switch statement. Hence 0 and 2 are the only numbers that get printed. Question 3 (Assertions and exception handling)
1. public class example {
2. public static void main(String args[]) {
3. for(int i = 1; i < 4; i++)
4. for(int j = 1; j < 4; j++)
5. if(i < j)
6. assert i!=j : i;
7. }
8. }
A. The class compiles and runs, but does not print anything. Answer: A. The if condition returns true, if i is less than j. The assert statement performs a check whether i is equal to j. Since i will never be equal to j, the assert statement will always return true. Hence the AssertionError does not get generated. So B, C, and D are incorrect. Question 4 (Garbage collection)
1. void method X() {
2. String r = new String("abc");
3. String s = new String("abc");
4. r = r+1;
5. r = null;
6. s = s + r;
7. }
A. Before statement labeled 4 Answer: D. After statement 3, r and s are pointing to two different memory locations both containing "abc". After statement 4, the memory location to which r was pointing is available for garbage collection. After statement 6, s now points to a different location. The memory block that s was pointing to that contained "abc" is now available for garbage collection. Question 5 (Language fundamentals) A. number_1 Answer: A, B, and C. In Java, each character of an identifier can be either a digit, letter, underscore, or a currency symbol. The first character cannot be a digit. Since - is not a valid character in an identifier name, D is incorrect. Question 6 (Language fundamentals)
1. class test {
2. public static void main(String args[]) {
3. if(args.length > 0)
4. System.out.println(args.length);
5. }
6. }
A. The program compiles and runs but does not print anything. Answer: A. The above program is a legal Java file. No arguments are passed to the program, as the command line just says java test. test here is the name of the class. The args array does not contain any elements. Since args.length is zero, the program does not print anything. Question 7 What happens when the following program is compiled and run? Select the one correct answer.
1. public class example {
2. int i[] = {0};
3. public static void main(String args[]) {
4. int i[] = {1};
5. change_i(i);
6. System.out.println(i[0]);
7. }
8. public static void change_i(int i[]) {
9. i[0] = 2;
10. i[0] *= 2;
11. }
12. }
A. The program does not compile. Answer: E. The example is a legal Java class so A is incorrect. When array is passed as an argument, Java treats it as a call by reference. When the method change_i updates i[0], the first element of the array is directly getting modified. This element is set to 4 in change_i. This change in the value of i[0] is available in the main method also. Hence 4 gets printed. Question 8 (Operators and assignments)
1. public class test {
2. public static void main(String args[]) {
3. char c;
4. int i;
5. c = 'A';
6. i = c;
7. c = i + 1;
8. c++;
9. }
10. }
A. The line labeled 5 Answer: C. "A" is a character. So assigning "A" to c in statement 5 is perfectly valid. Assigning a character to integer is also valid and does not require a cast. Thus the statement labeled 6 does not generate a compilation error. It's not possible to assign an integer to a character without a cast. Hence the statement 7 generates a compilation error. Question 9 (Objects) A. A static method may be invoked before even a single instance of the class is constructed. Answer: A, B, and C. A and B are correct statements about the behavior of static methods. The abstract modifier may appear before a method or a class, but not before a variable, so C is also correct. A final modifier may appear before a method, a variable or before a class. Hence D is incorrect. A synchronized modifier cannot come before a variable so E is also incorrect. Question 10 (Collections) A. HashMap Answer: C and D. Collection and SortedMap are examples of interfaces in the collection framework. HashMap. ArrayMap and TreeMap are examples of general purpose implementations for some of the collection interfaces. Question 11 (Fundamental classes)
1. public class test {
2. public static void main(String args[]) {
3. int i;
4. float f = 2.3f;
5. double d = 2.7;
6. i = ((int)Math.ceil(f)) * ((int)Math.round(d));
7.
8. System.out.println(i);
9. }
10. }
A. 4 Answer: E. The method ceil returns the smallest double value equal to a mathematical integer that is not less than the argument. Hence ceil(2.3f) returns 3. The round method round returns the integer closest to the argument. Hence round(2.7) returns 3. Multiplying the two numbers returns 9. Resources for Preparing for SCJP
The three standard books on Java certification are: Any one of these will be sufficient for you to prepare for the exam. Besides the numerous free mock exams available on the Web, there are a few commercial exam simulators also available. Some of the main ones are:
SIDEBAR Other Java Certifications SIDEBAR 2 Retaking the Exam SIDEBAR 3 After Clearing the Exam Reader Feedback: Page 1 of 1
Your Feedback Enterprise Open Source Magazine Latest Stories . . .
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||