scjp MCQ Questions and Answers

Practice Mode
Showing 10 of 52 questions
Q41
Which of the following statements are true about setLayout() method in java.awt.ScrollPane
  • A Does nothing
  • B Throws UnsupportedMethodException when called.
  • C It is not overriden in java.awt.ScrollPane.
  • D Sets the layout to the specified Layout Manager
Answer: Option A
Q42
An Outer class which has all its constructors declared as private
  • A Cannot be instantiated by any other Outer class.
  • B Cannot be extended.
  • C Both i and ii.
  • D has to be declared final.
Answer: Option C
Q43
The GridBagConstraints Class
  • A Is serializable.
  • B Is cloneable.
  • C belongs to the java.awt package
  • D extends Object
Answer: Option
Q44
Which of the following methods of the java.io.File class throws a checked Exceptions -
  • A getCanonicalPath()
  • B getCanonicalFile()
  • C createTempFile()
  • D createNewFile()
Answer: Option
Q45
Read this piece of code carefully System.out.println("String".substring(0,4));
  • A the code will print "Strin" on the screen
  • B the code will print "Stri" on the screen
  • C the code will cause a compiler error.
Answer: Option B
Q46
Math.round(Float.MAX_VALUE);
  • A Returns Integer.MAX_VALUE.
  • B Returns a closest integer to Float.MAX_VALUE;
  • C Causes a compilation error.
  • D Causes a runtime Exception
Answer: Option A
Q47
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?
  • A North , South, West, East and then Center
  • B North , West, South, Center and then Center
  • C Center, East, West, South and then North
  • D West, Center, South, North and then East
Answer: Option A
Q48
An Anonymous Inner class
  • A Does not have a constructor
  • B Can implement an interface
  • C Can extend a non-final Class
  • D Can implement an interface and extend a non-final class (at the same time).
Answer: Option
Q49
public XXXX extends something1, something2
  • A XXX should be an interface,something1 and something2 need not, for the expression to be legal
  • B XXX should be a class, something1 and something2 must be interfaces for the expression to be legal.
  • C XXX, something1 and something2 must be interfaces for the expression to be legal.
  • D The above statement is alway illegal in Java as multiple inheritance is not supported.
Answer: Option C
Q50
The class java.lang.Exception
  • A Is public
  • B Extends Throwable
  • C Implements Throwable
  • D Is serializable
Answer: Option
Questions and Answers for Competitive Exams Various Entrance Test