SCJP Garbage collection, Operators and assignments

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 exam

QUESTION : 1
  
  What is the result that will be printed out here ?
       int i =  - 128;
       System.out.println((byte)i << 1);



1.    0
2. -256
3.  127
4. -127
5.   -1 

ANS : 2
   
   Though the value in i is cast to a byte 
   it reverts to an int as the result of the left shift
   which makes the value of i  - 256



QUESTION : 2

   What is the result of the following operation?
     int n = 8;
     n = n & n + 1;
     n<<=n/2;
    
1.  32
2.  12
3.   8
4.  24
5. 128
6.   0

ANS : 5
 
   The arithmetic + operator takes precedence over the 
   bitwise & operator so  8 & 9 = 8  
   Shifting 8 by four bits to the left gives you 128





QUESTION : 3
    
    Observe the code below
 	public class Test {
	int a[] = new int[4];
	  void aMethod()
	  {
	  int b = 0 , index;
	  a[a[b]] = a[b] =  b = 2;
	  index = ??? ;
          System.out.println(a[index]);
	  }
	 }
   What value assigned to the variable index will print a non zero result?

1. 0
2. 1
3. 2
4. 3

ANS : 1

   the operands are evaluated from left to right here 
   so in the expression a[a[b]] the value of b is 0 
   and a[0] also holds the value 0 when the expression
   is evaluated so the array element at index 0 is assigned
   the value 2.




QUESTION : 4

    Will this test evaluate to true?
        Object a = "hello";
        String b = "hello";
        if(a == b)
        System.out.println("equal");
        else
        System.out.println("not equal");
   

1. Yes
2. No

ANS : 1

    It does not matter if the object reference is of type Object
    this will still return true because both of them point to the
    same String object in the string pool. 
    



QUESTION : 5
    
     True or False. 
    The garbage collector is required to makes sure that all objects 
    held by soft references are garbage collected before the VM throws
    an OutOfMemoryError.
        

1. True
2. False


ANS : 1

   If the  VM finds itself unable to allocate memory for
   a new object it is required to kick start the garbage 
   collector and reclaim all objects that are not held
   by strong references  before throwing an OutOfMemoryError.


 
QUESTION : 6


    What will be the value of the variable x here
    int x = 8 | 12  ^ 8;


1.  4
2.  8
3. 12
4.  0

ANS : 3
      


QUESTION : 7

 
        What will be the value of the variable x here
         int x = 8 ^ 5  &  6;


1.  0
2.  4
3.  6
4.  8
5. 12

ANS : 5

     The precedence  of bitwise operators  
     is AND , XOR and OR 
     so 5 AND 6 is evaluated first which gives you 4.
     8 XOR 4 = 12   



QUESTION : 8


  What is the result that will be printed out
   public class Test {
    public static void main(String[] args)
     {
     int a =  -8;
     int b = ~ -33;
     a>>>=b;
     System.out.println(a);
     }
   }

1. 1
2. 8
3. -8
4. 0
5. 16

ANS : 3
 


QUESTION : 9

    Is this legal ?
  
       public class Test {
         public static void main(String[] args)
         {
         char c = 65;
         double d = 10;
         if(c==d)
         System.out.println("equal");
         else
         System.out.println("not equal");
         }
       }

1. No.
2. Yes.

ANS : 2

          

QUESTION : 10
   
       Select the valid assignments


1.int i = (int)16.2d;
2. byte b = (byte)(long)16.2;
3. byte b = 128;
4. float f = 16.2;
5. byte b = (int)16.2; 

ANS : 1,2,5

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