scjp MCQ Questions and Answers

Take Exam

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

41. Which of the following statements are true about setLayout() method in java.awt.ScrollPane

  • Does nothing
  • Throws UnsupportedMethodException when called.
  • It is not overriden in java.awt.ScrollPane.
  • Sets the layout to the specified Layout Manager
Show Answer Report

42. An Outer class which has all its constructors declared as private

  • Cannot be instantiated by any other Outer class.
  • Cannot be extended.
  • Both i and ii.
  • has to be declared final.
Show Answer Report

43. The GridBagConstraints Class

  • Is serializable.
  • Is cloneable.
  • belongs to the java.awt package
  • extends Object
Show Answer Report

44. Which of the following methods of the java.io.File class throws a checked Exceptions -

  • getCanonicalPath()
  • getCanonicalFile()
  • createTempFile()
  • createNewFile()
Show Answer Report

45. Read this piece of code carefully System.out.println("String".substring(0,4));

  • the code will print "Strin" on the screen
  • the code will print "Stri" on the screen
  • the code will cause a compiler error.
Show Answer Report

46. Math.round(Float.MAX_VALUE);

  • Returns Integer.MAX_VALUE.
  • Returns a closest integer to Float.MAX_VALUE;
  • Causes a compilation error.
  • Causes a runtime Exception
Show Answer Report

47. A frame uses BorderLayout Management and has components added to all the regions. One resizing the Frame Some space becomes available. The space is alloted to the regions, in which Order of preference?

  • North , South, West, East and then Center
  • North , West, South, Center and then Center
  • Center, East, West, South and then North
  • West, Center, South, North and then East
Show Answer Report

48. An Anonymous Inner class

  • Does not have a constructor
  • Can implement an interface
  • Can extend a non-final Class
  • Can implement an interface and extend a non-final class (at the same time).
Show Answer Report

49. public XXXX extends something1, something2

  • XXX should be an interface,something1 and something2 need not, for the expression to be legal
  • XXX should be a class, something1 and something2 must be interfaces for the expression to be legal.
  • XXX, something1 and something2 must be interfaces for the expression to be legal.
  • The above statement is alway illegal in Java as multiple inheritance is not supported.
Show Answer Report

50. The class java.lang.Exception

  • Is public
  • Extends Throwable
  • Implements Throwable
  • Is serializable
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test