14/03/2017--ece-2014--technical Apti

10 Questions | Total Attempts: 46

SettingsSettingsSettings
Please wait...
Programming Quizzes & Trivia

.


Questions and Answers
  • 1. 
    Find the output, if the program is executed. Don't use any white space.class Test {    static{        System.out.print("1");    }    public static void main(String[] args) {        System.out.print("2");    }}
  • 2. 
    Find the output, if the program is executed. Don't use any white space.class Test3 {    static{        System.out.print("1");    }    {        System.out.print("2");    }    public static void main(String[] args) {        System.out.print("3");    }}
  • 3. 
    Find the output, if the program is executed. Don't use any white space.class Test3 {     static {        System.out.print("1");    }     {        System.out.print("2");    }     static {        System.out.print("3");    }     public static void main(String[] args) {        Test3 t = new Test3();    }}
  • 4. 
    Find the output, if the program is executed. Don't use any white space.class Test3 {     static {        System.out.print("1");    }     {        System.out.print("2");    }     static {        System.out.print("3");    }     {        System.out.print("4");    }     public static void main(String[] args) {        Test3 t = new Test3();    }}
  • 5. 
    Class Test3 {     static {        System.out.print("1");    }     {        System.out.print("2");    }     public static void main(String[] args) {        Test3 t = new Test3();        System.out.print("3");    }     {        System.out.print("4");    }     static {        System.out.print("5");    } }
  • 6. 
    Find the output, if the program is executed. Don't use any white space.class Test3 {     public Test3() {        System.out.print("1");    }     static {        System.out.print("2");    }     {        System.out.print("3");    }     public static void main(String[] args) {        System.out.print("4");        Test3 t = new Test3();    } }
  • 7. 
    Find the output, if the program is executed. Don't use any white space.class Test4{    static {        System.out.print("1");    }}class Test3 {    static {        System.out.print("2");    }     public static void main(String[] args) {        System.out.print("3");    } }
  • 8. 
    Find the output, if the program is executed. Don't use any white space.class Test4 {     static int I = 0;     static {        System.out.print(I);    }} class Test3 {     static {        System.out.print("1");    }     public static void main(String[] args) {        System.out.print("2");        Test4.I = 1;    } }
  • 9. 
    Find the output, if the program is executed. Don't use any white space.class Test4 {     static int I = 9;     static {        System.out.print(I);    }     {        System.out.print(I);    }} class Test3 {     static {        System.out.print("1");    }     public static void main(String[] args) {        System.out.print("2");        Test4.I = 1;    } }
  • 10. 
    Find the output, if the program is executed. Don't use any white space.class Test4 {     public Test4() {        I = 5;        System.out.print(I);    }     static int I = 9;     static {        System.out.print(I);    }     {        System.out.print(I);    }} class Test3 {     {        System.out.print(Test4.I);    }     public static void main(String[] args) {        System.out.print("2");        Test4 t1 = new Test4();    } }