Java Certifications
www.javacertifications.com
 home  scjp1.5  scjp1.6  scwcd 1.5  scjp 1.5 questions  scjp 1.6 questions  scwcd 1.5 questions  scjp 1.5 success kit  scjp 1.6 success kit  
  JavaCertifications.net provides java certfication tutorials and mock questions.  


Bookmark and Share |||     Share   
805 scjp 1.6 questions with explanations ||| 788 scjp 1.5 questions with explanations ||| 650 SCWCD 5.0 questions with explanations

Mock Questions

  scjp 1.5

  • Declarations, Initialization & Scoping
  • Method overriding or overloading
  • Inner Classes
  • Flow Control
  • Type Safe Enum
  • Enhanced for loop
  • Assertions
  • Exception
  • API Contents autoboxing & unboxing
  • File
  • Serializable
  • java.text and Locale
  • Regular Expression
  • Collections and Generics
  • Thread and Concurrency

  •   scjp 1.6

  • Declarations, Initialization & Scoping
  • Method overriding or overloading
  • Inner Classes
  • Flow Control
  • Type Safe Enum
  • Enhanced for loop
  • Assertions
  • Exception
  • API Contents autoboxing & unboxing
  • File
  • Serializable
  • java.text and Locale
  • Regular Expression
  • Collections and Generics
  • Thread and Concurrency
  • NavigableMap
  • NavigableSet
  • java.io.Console

  •   scwcd 1.5

  • Servlet Basic
  • The Structure and Deployment of Web Applications
  • The Web Container Model
  • Servlet event listeners
  • Session Management,session listeners
  • Servlet Filter
  • Web Application Security
  • j2ee patterns
  • JSP Directives
  • JSP page life cycle
  • JSP implicit objects
  • JSP include
  • Expression Language (EL)
  • JSTL
  • Building a Custom Tag Library
  • SCJP : Declarations, Initialization and Scoping Mock Exam Practice Questions

    Questions no -1 
    What is the output for the below code ?
    
    public interface TestInf {
     int i =10;
    }
    
    public class Test {
    	public static void main(String... args) {
    		TestInf.i=12;
    		System.out.println(TestInf.i);
    	
    	}
    	
    	
    	
    }
    
    
    options A)Compile with error B)10 C)12 D) Runtime Exception Correct answer is : A Explanations : All the variables declared in interface is Implicitly static and final , therefore can't change the value.
    Questions no -2 
    What is the output for the below code ?
    
    public class Test {
                static { int a = 5; }
                public static void main(String[] args){
                System.out.println(a);
                }
              }
    
    
    options A)Compile with error B)5 C)0 D) Runtime Exception Correct answer is : A Explanations : A variable declared in a static initialiser is not accessible outside its enclosing block.
    Questions no -3 
    What is the output for the below code ?
    
    class A {
      { System.out.print("b1 "); }
      public A() { System.out.print("b2 "); }
    }
    class B extends A {
      static { System.out.print("r1 "); }
      public B() { System.out.print("r2 "); }
      { System.out.print("r3 "); }
      static { System.out.print("r4 "); }
    }
    class C extends B {
      public static void main(String[] args) {
        System.out.print("pre ");
        new C();
        System.out.println("post ");
      }
    }
    
    
    options A)r1 r4 pre b1 b2 r3 r2 post B)r1 r4 pre b1 b2 post C)r1 r4 pre b1 b2 post r3 r2 D)pre r1 r4 b1 b2 r2 r3 post Correct answer is : A Explanations : All static blocks execute first then blocks and constructor. Blocks and constructor executes (super class block then super class constructor, sub class block then sub class constructor). Sequence for static blocks is super class first then sub class. Sequence for blocks is super class first then sub class.
    Questions no -4 
    What is the output for the below code ?
    
    public class Test {
    	
    	public static void main(String... args) throws Exception {
    		Integer i = 34;
    		int l = 34;
    		if(i.equals(l)){
    			System.out.println(true);
    		}else{
    			System.out.println(false);
    		}
    
    	}
    	
    }
    
    
    options A)true B)false C)Compile Error D) Runtime Exception Correct answer is : A Explanations : equals() method for the integer wrappers will only return true if the two primitive types and the two values are equal.
    Questions no -5 
    Which statement is true about outer class?
    
    
    options A)outer class can only declare public , abstract and final B)outer class may be private C)outer class can't be abstract D)outer class can be static Correct answer is : A Explanations : outer class can only declare public , abstract and final.
    Questions no -6 
    
    What is the output for the below code ?
    
    static public class Test {
    	public static void main(String[] args) {
    		  char c = 'a';
    	
    		 switch(c){
    		     case 65:
    		              System.out.println("one");break;
    		     case 'a':
    		              System.out.println("two");break;
    		     case 3:
    		              System.out.println("three");
    		}
    		
    		}
    	
    
    }
    
    
    options A)one B)two C)Compile error - char can't be permitted in switch statement D)Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted. Correct answer is : D Explanations : outer class can only declare public , abstract and final. Illegal modifier for the class Test; only public, abstract & final are permitted
    scjp 1.5 | scjp 1.6 | scwcd 1.5
    Java Certifications
    www.javacertifications.net