JAVA QUIZ 13 10 Created on May 13, 2020 By Sirjana GhimireAcharya JAVA QUIZ 13 1 / 10 1.Output of following Java program?public class Test{public static void main(String[] args){int i = 0;for(; i < 10; i++){break;}System.out.println(i);}} 0 1 10 Compilation error 2 / 10 2. What will happen when you compile and run the following code?public class Test{public static void main(String[] args){int i = 0;for(i = 100; i < = 0; i -= 10 ){System.out.print(i + ", ");}}} 100, 90, 80, 70, 60, 50, 40, 20, 10, 0, 100, 90, 80, 70, 60, 50, 40, 20, 10, 90, 80, 70, 60, 50, 40, 20, 10, 0, None of the above 3 / 10 3. What will happen when you compile and run the following code?public class Test{public static void main(String[] args){for(char c = 'a' ; c < 'd'; c++){System.out.print(c);}}} Code will not compile Code will print abc Code will print 012 None of the above 4 / 10 4. What will happen when you compile and run the following code?public class Test{public static void main(String[] args){for(int i = 65; i < 68 ; i++){System.out.print((char)i);}}} Code will not compile 656667 65666768 None of the above 5 / 10 5. What will happen when you compile and run the following code?class One{int i = 1;public int getInt(){return i;}}class Two extends One{int i = 2;public int getInt(){return i;}}public class Test{public static void main(String[] args) {One one = new One();Two two = (Two)one;System.out.println( two.getInt() );}} 1 2 Compilation error Run time error 6 / 10 6. What will happen when you compile and run the following code?class One{public static void print(int i){System.out.println("Parent");}}class Two extends One{public static void print(byte b){System.out.println("Child");}}public class Test{public static void main(String args[]){One one = new Two();one.print(10);}} Parent Child Compilation error Run time error 7 / 10 7. What will happen when you compile and run the following code?class One{public One(int x){System.out.print("int constructor");}public One(long l){System.out.print("long constructor");}}public class Test{public static void main(String[] args){long l = 20l;One one = new One(l);}} int constructor long constructor No output Compilation error 8 / 10 8. A private method defined in the parent class cannot be overridden by child class. True False 9 / 10 9. Will this code compile without error?import java.io.FileNotFoundException;import java.io.IOException;class One{public void someMethod() throws IOException{throw new IOException();}}class Two extends One{public void someMethod() throws FileNotFoundException{throw new FileNotFoundException();}} Yes No 10 / 10 10. Select all method declarations that successfully override the someMethod() defined in the class One?class One{public void someMethod(int i) throws Exception{}}class Two extends One{//method declaration here{}} public void someMethod(int i) throws ArrayIndexOutOfBoundsException public void someMethod(int anotherint) Both are correct Your score is The average score is 47% LinkedIn Facebook Twitter 0% Restart quiz