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
Mock Exam - 4
Q1 public class Test1{
    static void method(Object obj){
        System.out.println("Object");
    }
    static void method(String str){
        System.out.println("String");
    }
    public static void main(String args[]){
        method(null);
    }
}

What will be the output?

 

A1 String
A2 Object
A3 null
A4 Compiler Error

Q2 public class Test2{
    static void method(StringBuffer obj){
        System.out.println("StringBuffer");
    }
    static void method(String str){
        System.out.println("String");
    }
    public static void main(String args[]){
        method(null);
    }
}

What will be the output?

 

A1 String
A2 Object
A3 null
A4 Compiler Error

Q3 class Test{}
public class Test3{
   static void method(Object obj){
       System.out.println("StringBuffer");
   }
   static void method(String str){
       System.out.println("String");
   }
   static void method(Test t){
       System.out.println("Test");
   }
   public static void main(String args[]){
       method(null);
   }
}

What will be the output?
A1 String
A2 Object
A3 Test
A4 Compiler Error

Q4 public class Test4{
    public static void main(String args[]){
        I i1 = new A();
        I i2 = new B();
        A a = new A();
        System.out.println(i1 instanceof I);
        System.out.println(i2 instanceof B);
        System.out.println(a instanceof I);
    }
}
interface I{}
class A implements I{}
class B implements I{}

What will be the output?
A1 true true true
A2 true false true
A3 true false false
A4 Compiler Error

Q5 public class Test5{
    public static void main(String args[]){
        System.out.println(I.k);
    }
}
interface I{
    int k;
}

What will be the output?
A1 true true true
A2 true false true
A3 true false false
A4 Compiler Error

Q6 public class Test6 implements I{
    int k = 1;
    public static void main(String args[]){
        System.out.println(k);
    }
}
interface I{
    int k = 0;
}

What will be the output?
A1 0
A2 1
A3 null
A4 Compiler Error

Q7 public class Test7 implements I{
    int k = 1;
    static{
        k = k * 2;
    }
    {
        k = k * 2;
    }
    public static void main(String args[]){
        Test7 t1 = new Test7();
        Test7 t2 = new Test7();
        System.out.println(t1.k);
        System.out.println(t2.k);
        System.out.println(k);
    }
}

What will be the output?
A1 0
A2 1
A3 null
A4 Compiler Error

Q8 public class Test8{
    static int k = 1;
    static{
       k = k * 2;
    }
    {
       k = k * 2;
    }
    public static void main(String args[]){
       System.out.println(k);
    }
}

What will be the output?
A1 1
A2 2
A3 4
A4 Compiler Error

Q9 public class Test9{
    static int k = 1;

    {
        k = k * 2;
    }
    public static void main(String args[]){
        System.out.println(k);
    }
}

What will be the output?

 
A1 1
A2 2
A3 4
A4 Compiler Error

Q10 public class Test10{
    final static int k;
    static{
        k = 0;
    }
    public static void main(String args[]){
        System.out.println(k);
    }
}

What will be the output?
A1 0
A2 1
A3 null
A4 Compiler Error
Answers
1 String
2 Compiler Error
3 Compiler Error
4 true true true
5 true true true
6 Compiler Error
7 Compiler Error
8 2
9 1
10 0
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