Showing posts with label JAVA SOLVED MCQS FOR UGC NET COMPUTER SCIENCE. Show all posts
Showing posts with label JAVA SOLVED MCQS FOR UGC NET COMPUTER SCIENCE. Show all posts

Sunday, 8 November 2015

JAVA MCQS PART 2 FOR UGC NET COMPUTER SCIENCE


                           JAVA MCQS PART 2 FOR UGC NET COMPUTER SCIENCE
      1.       Predict the output:
public class Cdac
{
public static void main(String args[])
{
String s1="sun";
System.out.println(s1.substring(2));
}
}
A.      -1
B.      0
C.      ArrayIndexOutOfBoundsException
D.      StringIndexOutOfBoundsException
Ans.: D

      2.       Which of the following  modifier can be applied to a constructor.
A.      Private
B.      Abstract
C.      public
D.      All of the above
Ans.: c

      3.       Inner classes cannot declare ------------  variables.
A.      Protected
B.      Final
C.      Static
D.      Transient
Ans.: D