SCJP Language Fundamentals

Java Programming World, Inc.                                  Since 2005
java programming

    The contents of this page are intended for SCJP 1.4 exam (310-035). The Sun Certified Java Programmers Exam (SCJP) is the internationally recognized. This site includes java certification mock exams, practice tests, Frequently Asked Questions (faq), scjp2 study material and sample code created by a Sun Certified Java Programmer which makes java certification exam preparation very easy.

    Earning a sun certification provides a clear demonstration of the core java scjp skills. This page is devoted to Java programmer certification, the exam which is commonly known as SCJP. The page contains links to several excellent resources for sun certification java.

Resources for java certification SCJP exam. There are mock exams and other useful java links.

    For clearing SCJP tests you need to know the basics of core java. There are three variations in SCJP.
 

CX-310-025 for SCJP 1.2

Exam type            -       Multiple choice and short answer
Total Questions  -       59
Pass score           -       61% i.e. 36 of 69 questions must be answered

CX-310-035 for SCJP 1.4

Exam type            -       Multiple choice and short answer
Total Questions  -       61
Pass score           -       52% i.e. 32 of 61 questions must be answered

CX-310-055 for SCJP 1.5 / SCJP 5.0

Exam type            -       Multiple choice and short answer
Total Questions  -       72
Pass score           -       59% i.e. 43 of 72 questions must be answered

 

    SCJP  5.0  is the latest Entry Level Certification exam provided by SUN Microsystems. SCJP 5.0 is based up on J2SE 5.0. I recommend that u should choose J2SE 1.4 as it has more resources on the web. The fee is around $150. You can buy a Voucher online and take the test at any thompson optometric center (the voucher would be valid for 1 year using which you get 20% discount).

    The recommended scjp books that you need to follow are:

1. A Programmer's Guide to Java Certification
                                                                by Khalid Azim Mughal, Rolf Rasmussen

2. Sun Certified Programmer & Developer for Java 2 Study Guide (Exam 310-035 & 310-027)
                                                                Kathy Sierra and Bert Bates
 

Note: Below are some Useful Programming Resources. Please use <right-click> "Save Link as" for pdf and doc Files.

Java Links

Beginner Java Tutorial

JDBC Tutorial

Java Interview Questions

Sun Certification Material (SCJP)

scjp khalid mughal

A Programmer's Guide to Java Certification - by Khalid Mughal and Rolf Rasmussen - very very good ebook for the exam. This one contains detailed description, and explains IO, Threads, GC etc quite well.

Complete Java2 Certification Guide


This site provides all the information you would need to prepare for Suns Certification exam (SCJP2). It provides study material, sample questions for all the topics covered in the exam, a Certification FAQ, a mock exam, and links to many other related sites. 

 

SCJP Mock Test

 

QUESTION1
             
  
  You have the following code in a file called Test.java
   
    class Base{
       public static void main(String[] args){
       System.out.println("Hello");
       }
    }

    public class Test extends Base{}

   What will happen if you try to compile and run this?


1. It will fail to compile.
2. Runtime error 
3. Compiles and runs with no output.
4. Compiles and runs printing "Hello"

ANS : 4

 This will compile and print "Hello"
 The entry point for a standalone java program is
 the main method of the class that is being run.
 The java runtime system will look for that method
 in class Test and find that it does have such a method.
 It does not matter whether it is defined in the class itself
 or is inherited from a parent class.   


QUESTION2


         What is the result of trying to compile and run the following code.
         public final static void main(String[] args){
         double d = 10.0 / -0;
          if(d == Double.POSITIVE_INFINITY)
           System.out.println("Positive infinity");
           else
           System.out.println("Negative infinity");
         }

1. output Positive infinity
2. output Negative infinity
3. Will fail to compile
4. Runtime exception

ANS : 1

    There is no such thing as a positive or negative zero.
    Hence the result is always positive infinity.



QUESTION3


   What is the result that will be printed out ?
     void aMethod()
     {
     float f = (1 / 4) * 10;
     int i = Math.round(f);
     System.out.println(i);
     }

1.    2
2.    0
3.    3
4.    2.5
5.    25

ANS : 2
   The result of 1/4 will be zero because integer 
   divion is carried out on the operands.
   If you need to obtain a fractional value 
   you need to use either a float or double literal 
   as in 1F / 4F.


QUESTION4
   
   
  Which of the following are valid declarations?

   Note : None of the literals used here 
          contain the character O they are all zeroes.


1. int i     = 0XCAFE;
2. boolean b = 0;
3. char c    = 'A';
4. byte b    = 128;
5. char c    = "A";

ANS : 1,3

   1. is correct as it is a valid hexadecimal number.2. is  wrong
   because you can only assign the values true and false to them
   4 is wrong because 128 is beyond the range of a byte. 5is wrong 
   because "A" is not a char it is a String. 
       
     


QUESTION5


  What is the result of trying to compile and run this program.
    public class Test{
       public static void main(String[] args){
        int[] a = {1};
        Test t = new Test();
        t.increment(a);
        System.out.println(a[a.length - 1]);
       }
       void increment(int[] i){
       i[i.length - 1]++;
       }
    }


1. Compiler error.
2. Compiles and runs printing out 2
3. Compiles and runs printing out 1
4. An ArrayIndexOutOfBounds Exception at runtime

ANS : 2

  You are passing a reference to an array as 
  the argument to the method. The method may not
  modify the passed object reference but it can modify 
  the object itself.  



QUESTION6
  
   What will happen if you try to compile and run this ?  
   public class Test{
      static{ 
       print(10);
       }
     static void print(int x){
       System.out.println(x);
       System.exit(0);
      }
    }
 

1. Compiler error.
2. Will throw a NoSuchMethod error at runtime.
3. It will compile and run printing out "10"
4. It will run with no output.
5. It will run and print "10" and then crash with an error.      

ANS : 3

    This will run, print a message and terminate gracefully.
    The runtime system needs to load the class before it can look
    for the main method. So the static initializer will run first
    and print "10". Immediately after that System.exit(0) will be called
    terminating the program before an error can be thrown. 



QUESTION7
       
      Is this legal?
      long longArr[];
      int intArr[] = { 7 ,8 , 9};
      longArr = intArr;
      

1. Yes
2. No

ANS : 2

   You cannot assign a reference to an array of primitives
   to another unless they contain the same primitive types. 




QUESTION8

   True or False.
   The range of a byte is from  -127 to 128

1. True
2. False

ANS : 2

   Correct answer/s : 2
   The statement is false. The range of an array
   is from  - 128 to 127 
  


QUESTION9

   Identify the valid assignments.


1. float f  = \u0038;
2. long L2 = 2L;
3. float f  = 1.2;
4. char c = '/u004E';
5. byte b = 100;

ANS : 1,2,4,5

    1 is correct because \u0038 is unicode for nbr 8. 
    3 is wrong because 1.2 is a double literal.
    4. is a little sneaky perhaps. The 
       unicode escape character is incorrect


QUESTION10


        What is the result of trying to compile and run the following code.
         public static void main(String[] args){
         double d = 10 / 0;
         if(d == Double.POSITIVE_INFINITY)
           System.out.println("Positive infinity");
         else
           System.out.println("Negative infinity");
         }


1. output Positive infinity
2. output Negative infinity
3. Will fail to compile
4. Runtime exception

ANS : 4

   Division by zero on integer literals will throw
   a runtime error.

Get in touch with me personally at  hemanthjava@gmail.com

OTHER SITES OF MINE

FRESHERS JOBS AND PLACEMENT PAPERS

VTU PROJECTS AND PROGRAMS

Projects

1. Java Graphics Editor

scjp mock exams

These Mock exams will get you started with some simple practice questions. Its a great way to begin your SCJP 1.4 training.

scjp testking

Mock Exam Engine

1. Marcus Green Mock Exam 1

2. Marcus Green Mock Exam 2

3. Marcus Green Mock Exam 3

4. Java Test

5. Mock

6. Java Quiz 1

7. Java Quiz 2

8. Java Certification Mock Exam

Eclipse Tutorials

1. eclipse1.doc : A Simple tutorial showing how to create a project and execute code.

2. eclipse2.doc :  Frequently used Settings an Eclipse user should take care.

3. eclipse3.rtf :  Eclipse keyboard Shortcuts.

Sun Certifications are well recognized in the developers' community. Perhaps one of the reasons why Sun Certifications are so popular is that the exams are generally viewed as fairly challenging.

SCJP: A Sun Certified Java Programmer uses J2SE technologies to demonstrate the programming competence on Java platform.

Bob's Java Programming World, Inc. is independent of Sun Microsystems. All Rights Reserved