scjp MCQ Question and Answer
scjp MCQ Question and Answer
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
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.
43. The GridBagConstraints Class
- Is serializable.
- Is cloneable.
- belongs to the java.awt package
- extends Object
44. Which of the following methods of the java.io.File class throws a checked Exceptions -
- getCanonicalPath()
- getCanonicalFile()
- createTempFile()
- createNewFile()
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.
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
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
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).
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.
50. The class java.lang.Exception
- Is public
- Extends Throwable
- Implements Throwable
- Is serializable