Saturday, May 2, 2015

TT TEST-II Java Programming For #rd Yr

Technical Test - 2


1.What modifiers are allowed for methods in an Interface?
a)abstract, public    b)abstract,private    c)none  
2 .Can there be an abstract class with no abstract methods in it? 
   a)yes    b)no
3. Can we instantiate an abstract class?
     a)yes    b)no
4. Is it possible to override the main method?
a)yes    b)no
       5. Can we create an object for an interface?
a)yes    b)no
       6. Is null a keyword?
a)yes    b)no
       7. out object is member of which class ?
            a)PrintStream    b)System   c)OutStream     d)InStream
       8.next() is a member of which class?
            a)BufferReader    b)DataInputStream   c)Scanner    4)none
       9. How we can access library classes members ________________
     10. class x
             {          public dis() { System.out.println(“RISE@GSK”); }
                         Public static void main(String[]args){
                        new  x().dis();}
             }
            Guess the output
            a)compile time error   b)run time error    c)RISE@GSK    d)none

     11. class MyClass
             {         
                         public  void  main(String[]args){
System.out.println(“RISE@GSK”);
                        }
             }

            a)compile time error   b)run time error    c)RISE@GSK    d)none

     12.      
What is the value of "d" after this line of code has been executed?
double d = Math.round ( 2.5 + Math.random() );
                 a)2      b)3     c)4     d)2.5
13.What is the prototype of the default constructor?
Test( )
Test(void)
public Test( )
public Test(void)
14. You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?
public
private
protected
transient

15.Which will legally declare, construct, and initialize an array?
A.int [] myList = {"1", "2", "3"}; B. int [] myList = (5, 8, 2); C. int myList [] [] = {4,9,7,0};
D. int myList[] = {4, 3, 7};