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 ( 11 - 20 )

Question 11.
public class AQuestion{ 
	private int i = giveMeJ(); 
	private int j = 10; 
	private int giveMeJ(){ 
		return j; 
	} 
	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 Compilation error - The output is 0;
4. No Compilation error - The output is 10;

Question 12.
public class AQuestion{ 
	public static void main(String args[]){ 
		System.out.println("Before Try"); 
		try{ 
		} 
		catch(Throwable t){ 
			System.out.println("Inside Catch"); 
		} 
			System.out.println("At the End"); 
		} 
} 

1. Compiler error complaining about the catch block, where no Throwable object can ever be thrown.
2. Compiler error - Throwable Object can not be caught, only Exceptions must be caught.
3. No compiler error. The lines "Before Try" and "At the end" are printed on the screen.


Question 13.

public class AQuestion{ 
	public static void main(String args[]){ 
		System.out.println("Before Try"); 
		try{ 
		} 
		catch(java.io.IOException t){ 
			System.out.println("Inside Catch"); 
		} 
			System.out.println("At the End"); 
	} 
}
1. Compiler error complaining about the catch block where no IOException object can ever be thrown.
2. Compiler error - IOException not found. It must be imported in the first line of the code.
3. No compiler error. The lines "Before Try" and "At the end" are printed on the screen.


Question 14.
The class java.lang.Exception
i. Is public
ii. Extends Throwable
iii. Implements Throwable
iv. Is serializable


Question 15.
Read this piece of code carefully
 

if("String".trim() == "String".trim()) 
	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 16.
Read this piece of code carefully

if( "STRING".toUpperCase() == "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 17.
The following lines of code
byte b = 0;
b += 1;
1. results in b having the value 1.
2. causes a compiler error.
3. will require a cast (byte) before 1.

Question 18.
The following express
char c = -1;
1. will cause a compiler error as the range of character is between 0 and 2^16 - 1. Will request for an explicit cast.
2. will not cause a compiler error and c will have the value -1;
3. c will not represent any ASCII character.
4. c will still be a Unicode character.

Question 19.
Which of the following statements are true?
1. A method can throw an Exception
2. A method can return an Exception

Question 20.
All the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character)
1. are public
2. are serializable
3. are immutatable
4. extend java.lang.Number
5. are final

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