scjp MCQ Questions and Answers
The SCJP MCQ questions with answers are designed to help learners strengthen their understanding of Java programming concepts. These programming questions and answers cover key areas such as classes, inheritance, polymorphism, and exception handling. Practicing these MCQs enhances your coding logic and prepares you for certification exams like Sun Certified Java Programmer (SCJP) as well as placement tests conducted by companies like TCS, Infosys, and Wipro. Each question includes detailed explanations to help you grasp Java fundamentals effectively. Start practicing these Java MCQ questions with solutions to improve your performance in competitive exams and technical interviews.
scjp MCQ
Showing 10 of
52 questions
1. Read this piece of code carefully if("String".toString() == "String") System.out.println("Equal"); else System.out.println("Not Equal");
- 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.
2. Read this piece of code carefully if("String".toString() == "String") System.out.println("Equal"); else System.out.println("Not Equal");
- 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.
3. Read this piece of code carefully
- 1. the code will compile an print
- 2. the code will compile an print
- 3. the code will cause a compiler error.
4. Read the code below. Will be the result of attempting to compile and run the code below.
- 1. The code does not compile.
- 2. The code compiles cleanly and shows
- 3. The code compiles cleanly and shows
- 4. The code throws an Exception at Runtime.
5. Read the code below. Will be the result of attempting to compile and run the code below.
- 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.
6. Read the following code below.
- 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.
8. A Vector class in jdk 1.2
- is public
- is final
- implements java.util.List
- is serializable
9. A String Class
- is final
- is public
- is serializable
- has a constructor which takes a StingBuffer Object as an Argument
10. Answer the question
- Should have someMethod which must necessarily be public.
- Should have someMethod which could be "friendly" or public
- Should have someMethod which should not throw any checked exceptions.
- Should have someMethod which cannot be sychronized as sychronized is not in the signature of the interface defination