JavaBeat
Search JavaBeat

Certification Kits
SCJP 1.5 Exam Questions
SCJP 1.6 Exam Questions
SCWCD 1.4 Exam Questions
SCWCD 5.0 Exam Questions
SCBCD 5.0 Exam Questions
SCJP 1.5 Links
scjp 1.4 home
scjp books
scwcd Books
objectives
mock exams
scjp 1.4 mock - 1
scjp 1.4 mock - 2
scjp 1.4 mock - 3
scjp 1.4 mock - 4
scjp 1.4 mock - 5
scjp 1.4 mock - 6
scjp 1.4 mock - 7
scjp 1.4 mock - 8
scjp 1.4 mock - 9
scjp 1.4 mock - 10
scjp 1.4 mock - 11
scjp 1.4 mock - 12
scjp 1.4 mock - 13
scjp 1.4 mock - 14
scjp 1.4 mock - 15
scjp 1.4 mock - 16
scjp 1.4 mock - 17
scjp 1.4 mock - 18
scjp 1.4 mock - 19
scjp 1.4 mock - 20
scjp 1.4 mock - 21
newbie
prometric center
Certification Links
SCJP 1.4
SCJP 1.5
SCJP 1.6
SCWCD 1.4
SCWCD 5.0
SCBCD 5.0
SCEA
SCEA 5.0
JavaBeat
Home
Articles
Tips
Code
QnA
Forums
350 Mock Questions on SCJP 1.5 - JUST Rs.200 or 7 USD
Send us mail to sales@javabeat.net
more details

SCJP 1.4 Mock Exam -1

Q1)What will be the output?


public class Test1{          
   public static void main(String[] args){ 
      int arr[] = new int[3];  
      for(int i = 0;i < arr.length;i++){ 
         System.out.println(arr[i]); 
      } 
   }
}

A1 0 0 0
A2 ArrayIndexoutOfBoundsException
A3 NullPointerException
A4 null null null

Q2)Which of the following are valid array declarations?

A1 int arr[] = new int[];
A2 float arr[10] = new fl
A3 double []arr = new double[10];
A4 None Of the Above.

Q3)What will be the output?


public class Test3{
   public void method(){ 
       System.out.println("Called");
   }
   public static void main(String[] args){
       method();
   }
}

A1 "Called"
A2 Compiler
A3 Runtime
A4 Nothing

Q4)What will be the output?


public class Test4{
     public static void method(){ 
         System.out.println("Called");
     }
     public static void main(String[] args){
         Test4 t4 = null;
         t4.method();
     }
  }

A1 "Called"
A2 Compiler
A3 Runtime Exception
A4 Nothing is printed in screen

Q5)What will be the output?


public class Test5{
    public void Test5(){
       System.out.println("Constructor1");
    }
    public Test5(){ 
       System.out.println("Constructor2");
    }
    public static void main(String[] args){
       Test5 t5 = new Test5();
    }
}

A1 "Constructor1"
A2 "Constructor2"
A3 "Constructor1""Constructor2"
A4 Compiler Errror

Q6)What will be the output?


public class Test6{
    public Test6(){
       this(4);
    }
    public Test6(byte var){
       System.out.println(var);
    }
    public static void main(String[] args){
       Test6 t6 = new Test6();
    }
}

A1 4
A2 4 4
A3 Compiler Error
A4 Compiles and Runs without error

Q7)What will be the output?


public class Test7{
     public Test7(){}
     public Test7(Test7 ref){
         this (ref,"Hai");
     }
     public Test7(Test7 ref,String str){ 
         ref.Test7(str);
         System.out.println("Hi");
     }
     public void Test7(String str){
         System.out.println(str);
     }
     public static void main(String[] args){
         Test7 t = new Test7();
         Test7 t7 = new Test7(t); 
     }
 }

A1 HI
A2 hai
A3 Hai Hi
A4 Hi Hai

Q8)Which of the following are valid Constructors?

A1 public Test8(){}
A2 private void Test8(){}
A3 protected Test8(int k){}
A4 Test8(){}

Q9)Which of the following are valid method declarations?

A1 abstract method(){}
A2 abstrct void method(){}
A3 final void method(){}
A4 int method(){}

Q10)Which of the following are valid top-level class declarations?

A1 class Test10
A2 public class Test10
A3 final class Test10
A4 abstract final class Test10

Q11)transient keywaord can be used with?

A1 method
A2 variable
A3 class
A4 constructor

Q12)which of the following are valid combinations for class declaration?

A1 abstract final class Test12{}
A2 abstract static class Test12{}
A3 final static class Test12{}
A4 public final strictfp class Test12{}

Q13)which of the following are valid constructor signatures?

A1 public void className()
A2 public void className()
A3 private className()
A4 static className()

Q14)Which of the following modifiers can be used with top class declaration?

A1 static
A2 privatr
A3 public
A4 final
A5 abstract

Q15)Which of the following are valid array declarations?

A1 int arr[] = new int[];
A2 int arr[][] = new int [10][10];
A3 float arr[][] = new float[][10];
A4 float arr[] = new float[10];

Q16)What will be the output of the following program?


public class Test1 {
      static{
           System.out.println("Static");
      }
      {
           System.out.println("Instance");
       }
       public void Test1(){
           System.out.println("Constructor");
       }
       public static void main(String[] args) {
          Test1 t = null;
       }
}

A1 Instance Static
A2 Static Instance
A3 Static
A4 Static Instance Constructor

Q17)What will be the output of the following program?


class Sup{
    public Sup(String str){
        System.out.println("Super class");
    }
}
 
public class Test2 extends Sup{
      public Test2(){
            System.out.println("Sub class");
      }
      public static void main(String[] args) {
            Test2 t2 = new Test2();
      }
}

A1 Super class,SubClass
A2 Super class
A3 Sub class
A4 Compiler Error

Q18)What will be the output of the following program?


public class Test3 {
      public static void main(String[] args) {
            System.out.println("Main Method1");
      }
      public static void main(String args){
            System.out.println("Main Method2");
     }
}

A1 Main Method1
A2 Main Method1 Main Method2
A3 Main Method2
A4 Runtime Exception

Q19)What will be the output of the following program?


public class Test4 {
     public static void main(String args) {
           System.out.println("Sample Program");
     }
}

A1 Sample Program
A2 Compiler Error
A3 Runtime Exception
A4 None

Q20)What will be the output of the following program?


class Sup1{
      public Sup1(){
           System.out.println("Hai");
      }
      private Sup1(String str){
          System.out.println(str);
      }
}

public class Test5 extends Sup1{
      private Test5(String str){
           System.out.println(str);
           super();
      }
      public static void main(String[] args) {
          Test5 t5 = new Test5("HI");
      }
}
 

A1 Hai,Hi,Hi
A2 Hai,Hi
A3 Hi,Hi
A4 Compiler Error

Q21)Which of the following are not a wrapper class?

A1 String
A2 Integer
A3 StringBuffer
A4 Boolean

Q22)Select the correct syntax for main method :

A1 public void main(String args[])
A2 public static void main(String args)
A3 public static void Main(String args[])
A4 None of the Above

Q23)Which of the following are not a valid declarations?

A1 float f = 1;
A2 float f = 1.2f;
A3 float f = 1.2;
A4 float f = (float)1.2;

Q24)String s1 = new String("hi");


String s2 = "hi";
System.out.println(s1 ==s2);
System.out.println(s1.equals(s2));

A1 false true
A2 true false
A3 true true
A4 None of the above.

Q25)Integer i = new Integer(0);


Float f = new Float(0);
System.out.println(i==f);
System.out.println(i.equals(f));
 

A1 true false
A2 false true
A3 true true
A4 Compiler error

Answers

350 Mock Questions on SCJP 1.5 - JUST Rs.200 or 7 USD
Send us mail to sales@javabeat.net
more details

Sponsors
Webmaster Hosting Forum
Java Jobs
Latest in DLinks
http://javawave.blogspot.com/2008/04/quartz-job-scheduler-part-ii-example.html
Quartz Job Scheduler -- Part 1 (Setting up development project in Netbeans 6.1 beta)
Flex Messaging with BEA Workshop Studio
SOA and Virtualization: How do They Fit Together?
Introduction to Enterprise Portals - Why they Benefit IT and the Business
BEA WebLogic Operations Control: Application Virtualization for Enterprise Java
Best Practices for Building Production Quality EAR Files
BEA's SOA Reference Architecture - A Foundation for Business Agility
Blueprint for Successful SOA Integration
Guardian - What a tool!

JavaBeat Media (2004-2008), India
javabeat home | About Us
our network : opensource softwares
Copyright © 2007 JavaBeat