Java Quiz

Java Programming World, Inc.                                  Since 2005
java programming
 

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. 

 

Java Multiple Choice Questions ( 1 - 20 )

Question 1.
Read this piece of code carefully
if("String".toString() == "String")
	System.out.println("Equal");
else
	System.out.println("Not Equal");

Answers
1. the code will compile an print "Equal".
2. the code will compile an print "Not Equal".
3. the code will cause a compiler error.

Question 2.
Read this piece of code carefully
if("String".trim() == "String")
System.out.println("Equal"); else System.out.println("Not Equal");

Answers
1. the code will compile an print "Equal".
2. the code will compile an print "Not Equal".
3. the code will cause a compiler error

Question 3.
Read the code below. Will be the result of attempting to compile and run the code below.
public class AQuestion { 
	public void method(Object o){ 
		System.out.println("Object Verion"); 
	} 
	public void method(String s){ 
		System.out.println("String Version"); 
	}
	public static void main(String args[]){ 
		AQuestion question = new AQuestion(); 
		question.method(null);	 
	}
}
Answers
1. The code does not compile.
2. The code compiles cleanly and shows "Object Version".
3. The code compiles cleanly and shows "String Version"
4. The code throws an Exception at Runtime.

Question 4.
Read the code below. Will be the result of attempting to compile and run the code below.

public class AQuestion{ 
	public void method(StringBuffer sb){ 
		System.out.println("StringBuffer Verion"); 
	} 
	public void method(String s){ 
		System.out.println("String Version"); 
	}
	public static void main(String args[]){ 
		AQuestion question = new AQuestion(); 
		question.method(null);	 
	}
}

Answers
1. The code does not compile.
2. The code compiles cleanly and shows "StringBuffer Version".
3. The code compiles cleanly and shows "String Version"
4. The code throws an Exception at Runtime.


Question 5.
Read the following code below.

public interface AQuestion{ 
	public abstract void someMethod() throws Exception; 
} 

A Class implementing this interface should
1. Necessarily be an abstract class.
2. Should have the method public abstract void someMethod();
3. Should have the method public void someMethod() which has to throw an exception which is a subclass of java.lang.Exception.
4. Should have the method public void someMethod() which need not throw an Exception.


Question 6.
An Interface can never be private or protected.

Answers
True
False

Question 7.
A Vector class in jdk 1.2

1. is public
2. is final
3. implements java.util.List
4. is serializable
5. has only One constructor

Question 8.
A String Class

1. is final
2. is public
3. is serializable
4. has a constructor which takes a StingBuffer Object as an Argument

Question 9.

public interface AQuestion{ 
	void someMethod(); 
}
The class which implements AQuestion
1. Should have someMethod which must necessarily be public.
2. Should have someMethod which could be "friendly" or public
3. Should have someMethod which should not throw any checked exceptions.
4. Should have someMethod which cannot be sychronized as sychronized is not in the signature of the interface defination

Question 10.
public class AQuestion{ 
	private int i = j; 
	private int j = 10; 
	public static void main(String args[]){ 
		System.out.println((new AQuestion()).i); 
	}
}

Answers
1. Compiler error complaining about access restriction of private variables of AQuestion.
2. Compiler error complaining about forward referencing.
3. No error - The output is 0;
4. No error - The output is 10;

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. JGE                  (2D 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

9. SCJP Mock Exam - 1

10. Sun Certification Dumps

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