<<= Back Next =>>
You Are On Multi Choice Question Bank SET 1638

81901. class A { protected int method1(int a, int b) { return 0; } } Which is valid in a class that extends class A?





81902. Which one creates an instance of an array?





81903. Which two of the following are legal declarations for nonnested classes and interfaces? final abstract class Test {} public static interface Test {} final public class Test {} protected abstract class Test {} protected interface Test {} abstract public class Test {}





81904. Which of the following class level (nonlocal) variable declarations will not compile?





81905. Which two cause a compiler error? float[ ] f = new float(3); float f2[ ] = new float[ ]; float[ ]f1 = new float[3]; float f3[ ] = new float[3]; float f5[ ] = {1.0f, 2.0f, 2.0f};





81906. Given a method in a protected class, what access modifier do you use to restrict access to that method to only the other members of the same class?






81907. Which is a valid declaration within an interface?





81908. What will be the output of the program? class A { final public int GetResult(int a, int b) { return 0; } } class B extends A { public int GetResult(int a, int b) {return 1; } } public class Test { public static void main(String args[]) { B b = new B(); System.out.println("x = " + b.GetResult(0, 1)); } }





81909. What will be the output of the program? public class Test { public static void main(String args[]) { class Foo { public int i = 3; } Object o = (Object)new Foo(); Foo foo = (Foo)o; System.out.println("i = " + foo.i); } }





81910. What will be the output of the program? public class A { void A() / Line 3 / { System.out.println("Class A"); } public static void main(String[] args) { new A(); } }





81911. What will be the output of the program? class Super { public int i = 0; public Super(String text) / Line 4 / { i = 1; } } class Sub extends Super { public Sub(String text) { i = 2; } public static void main(String args[]) { Sub sub = new Sub("Hello"); System.out.println(sub.i); } }





81912. What will be the output of the program? public class Test { public int aMethod() { static int i = 0; i++; return i; } public static void main(String args[]) { Test test = new Test(); test.aMethod(); int j = test.aMethod(); System.out.println(j); } }





81913. What will be the output of the program? interface Count { short counter = 0; void countUp(); } public class TestCount implements Count { public static void main(String [] args) { TestCount t = new TestCount(); t.countUp(); } public void countUp() { for (int x = 6; x>counter; x--, ++counter) / Line 14 / { System.out.print(" " + counter); } } }






81914. What will be the output of the program? class Base { Base() { System.out.print("Base"); } } public class Alpha extends Base { public static void main(String[] args) { new Alpha(); / Line 12 / new Base(); / Line 13 / } }





81915. What will be the output of the program? import java.util.; public class NewTreeSet2 extends NewTreeSet { public static void main(String [] args) { NewTreeSet2 t = new NewTreeSet2(); t.count(); } } protected class NewTreeSet { void count() { for (int x = 0; x < 7; x++,x++ ) { System.out.print(" " + x); } } }





81916. What will be the output of the program? public class ArrayTest { public static void main(String[ ] args) { float f1[ ], f2[ ]; f1 = new float[10]; f2 = f1; System.out.println("f2[0] = " + f2[0]); } }





81917. What will be the output of the program? class Super { public Integer getLength() { return new Integer(4); } } public class Sub extends Super { public Long getLength() { return new Long(5); } public static void main(String[] args) { Super sooper = new Super(); Sub sub = new Sub(); System.out.println( sooper.getLength().toString() + "," + sub.getLength().toString() ); } }





81918. interface DoMath { double getArea(int rad); } interface MathPlus { double getVol(int b, int h); } / Missing Statements ? / which two code fragments inserted at end of the program, will allow to compile? class AllMath extends DoMath { double getArea(int r); } interface AllMath implements MathPlus { double getVol(int x, int y); } interface AllMath extends DoMath { float getAvg(int h, int l); } class AllMath implements MathPlus { double getArea(int rad); } abstract class AllMath implements DoMath, MathPlus { public double getArea(int rad) { return rad rad 3.14; } }





81919. Which two statements are true for any concrete class implementing the java.lang.Runnable interface? You can extend the Runnable interface as long as you override the public run() method. The class must contain a method called run() from which all code for that thread will be initiated. The class must contain an empty public void method named run(). The class must contain a public void method named runnable(). The class definition must include the words implements Threads and contain a method called run(). The mandatory method must be public, with a return type of void, must be called run(), and cannot take any arguments.





81920. / Missing statements ? / public class NewTreeSet extends java.util.TreeSet { public static void main(String [] args) { java.util.TreeSet t = new java.util.TreeSet(); t.clear(); } public void clear() { TreeMap m = new TreeMap(); m.clear(); } } which two statements, added independently at beginning of the program, allow the code to compile? No statement is required import java.util.; import.java.util.Tree; import java.util.TreeSet; import java.util.TreeMap;





81921. Which three statements are true? The default constructor initialises method variables. The default constructor has the same access as its class. The default constructor invokes the no-arg constructor of the superclass. If a class lacks a no-arg constructor, the compiler always creates a default constructor. The compiler creates a default constructor only when there are no other constructors for the class.





81922. package testpkg.p1; public class ParentUtil { public int x = 420; protected int doStuff() { return x; } } package testpkg.p2; import testpkg.p1.ParentUtil; public class ChildUtil extends ParentUtil { public static void main(String [] args) { new ChildUtil().callStuff(); } void callStuff() { System.out.print("this " + this.doStuff() ); / Line 18 / ParentUtil p = new ParentUtil(); System.out.print(" parent " + p.doStuff() ); / Line 20 / } } which statement is true?





81923. You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?





81924. public class Outer { public void someOuterMethod() { //Line 5 } public class Inner { } public static void main(String[] argv) { Outer ot = new Outer(); //Line 10 } } Which of the following code fragments inserted, will allow to compile?





81925. interface Base { boolean m1 (); byte m2(short s); } which two code fragments will compile? interface Base2 implements Base {} abstract class Class2 extends Base { public boolean m1(){ return true; }} abstract class Class2 implements Base {} abstract class Class2 implements Base { public boolean m1(){ return (7 > 4); }} abstract class Class2 implements Base { protected boolean m1(){ return (5 > 7) }}





81926. Which three form part of correct array declarations? public int a [ ] static int [ ] a public [ ] int a private int a [3] private int [3] a [ ] public final int [ ] a





81927. public class Test { } What is the prototype of the default constructor?





81928. Who propounded the theory of “Economic Drain of India”?





81929. Utility waxes are used for which purpose?





81930. Liquid catalyst is present with which type of impression material?





81931. W:P Ratio of dental stone is





81932. Monophase technique uses





81933. What will be the output of the program? public class Test { public static void aMethod() throws Exception { try / Line 5 / { throw new Exception(); / Line 7 / } finally / Line 9 / { System.out.print("finally "); / Line 11 / } } public static void main(String args[]) { try { aMethod(); } catch (Exception e) / Line 20 / { System.out.print("exception "); } System.out.print("finished"); / Line 24 / } }





81934. What will be the output of the program? public class X { public static void main(String [] args) { try { badMethod(); System.out.print("A"); } catch (Exception ex) { System.out.print("B"); } finally { System.out.print("C"); } System.out.print("D"); } public static void badMethod() {} }





81935. What will be the output of the program? public class X { public static void main(String [] args) { try { badMethod(); / Line 7 / System.out.print("A"); } catch (Exception ex) / Line 10 / { System.out.print("B"); / Line 12 / } finally / Line 14 / { System.out.print("C"); / Line 16 / } System.out.print("D"); / Line 18 / } public static void badMethod() { throw new RuntimeException(); } }





81936. What will be the output of the program? public class MyProgram { public static void main(String args[]) { try { System.out.print("Hello world "); } finally { System.out.println("Finally executing "); } } }





81937. What will be the output of the program? class Exc0 extends Exception { } class Exc1 extends Exc0 { } / Line 2 / public class Test { public static void main(String args[]) { try { throw new Exc1(); / Line 9 / } catch (Exc0 e0) / Line 11 / { System.out.println("Ex0 caught"); } catch (Exception e) { System.out.println("exception caught"); } } }





81938. import java.io.; public class MyProgram { public static void main(String args[]) { FileOutputStream out = null; try { out = new FileOutputStream("test.txt"); out.write(122); } catch(IOException io) { System.out.println("IO Error."); } finally { out.close(); } } } and given that all methods of class FileOutputStream, including close(), throw an IOException, which of these is true?





81939. public class MyProgram { public static void throwit() { throw new RuntimeException(); } public static void main(String args[]) { try { System.out.println("Hello world "); throwit(); System.out.println("Done with try block "); } finally { System.out.println("Finally executing "); } } } which answer most closely indicates the behavior of the program?





81940. public class ExceptionTest { class TestException extends Exception {} public void runTest() throws TestException {} public void test() / Point X / { runTest(); } } At Point X on line 5, which code is necessary to make the code compile?





81941. System.out.print("Start "); try { System.out.print("Hello world"); throw new FileNotFoundException(); } System.out.print(" Catch Here "); / Line 7 / catch(EOFException e) { System.out.print("End of file exception"); } catch(FileNotFoundException e) { System.out.print("File not found"); } and given that EOFException and FileNotFoundException are both subclasses of IOException, and further assuming this block of code is placed into a class, which statement is most true concerning this code?





81942. The best material to cement porcelain laminate veneer is





81943. Which four can be thrown using the throw statement? Error Event Object Throwable Exception RuntimeException





81944. The stages of addition polymerization are all except





81945. What will be the output of the program? public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( "Finally" ); } } }





81946. What will be the output of the program? try { int x = 0; int y = 5 / x; } catch (Exception e) { System.out.println("Exception"); } catch (ArithmeticException ae) { System.out.println(" Arithmetic Exception"); } System.out.println("finished");





81947. What will be the output of the program? public class X { public static void main(String [] args) { try { badMethod(); System.out.print("A"); } catch (RuntimeException ex) / Line 10 / { System.out.print("B"); } catch (Exception ex1) { System.out.print("C"); } finally { System.out.print("D"); } System.out.print("E"); } public static void badMethod() { throw new RuntimeException(); } }





81948. What will be the output of the program? public class RTExcept { public static void throwit () { System.out.print("throwit "); throw new RuntimeException(); } public static void main(String [] args) { try { System.out.print("hello "); throwit(); } catch (Exception re ) { System.out.print("caught "); } finally { System.out.print("finally "); } System.out.println("after "); } }





81949. The major constituent of reversible hydrocolloid impression material is





81950. Cross linking agent in heat cured acrylic resin is:





<<= Back Next =>>
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use
DMCA.com Protection Status Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions