Welcome to your Test - 1 Code - 819 Name Email Phone 1. Question: Consider the following code:interface Flyer{ String getName(); }class Bird implements Flyer{ public String name; public Bird(String name){ this.name = name; } public String getName(){ return name; }}class Eagle extends Bird { public Eagle(String name){ super(name); }}public class TestClass { public static void main(String[] args) throws Exception { Flyer f = new Eagle("American Bald Eagle"); //PRINT NAME HERE }}Which of the following lines of code will print the name of the Eagle object?Select 3 option(s): System.out.println(f.name); System.out.println(f.getName()); System.out.println(((Eagle)f).name); System.out.println(((Bird)f).getName()); System.out.println(Eagle.name); System.out.println(Eagle.getName(f));2. Question: Given:public class Book { private String title; private String genre; public Book(String title, String genre){ this.title = title; this.genre = genre; } //accessors not shown}and the following code:List<Book> books = //code to create the list goes hereComparator<Book> c1 = (b1, b2)->b1.getGenre().compareTo(b2.getGenre()); //1books.stream().sorted(c1.thenComparing(Book::getTitle)); //2System.out.println(books);Identify the correct statements.Select 1 option(s): It will print the list that is sorted by genre and then sorted by title within. It will print the list that is sorted by title and then sorted by genre within. It will print the list as it is. Code will fail to compile because of code at //1. Code will fail to compile because of code at //2.3. Question: What will be the result of attempting to compile and run the following class? public class TestClass{ public static void main(String args[ ] ){ int i, j, k; i = j = k = 9; System.out.println(i); }}Select 2 option(s): The code will not compile because unlike in c++, operator '=' cannot be chained i.e. a = b = c = d is invalid. The code will not compile as 'j' is being used before getting initialized. The code will compile correctly and will display '9' when run. The code will not compile as 'j' and 'i' are being used before getting initialized. All the variables will get a value of 9.4. Question: Given the following method code appearing in an application that manages files on a server machine:List<File> dir; //initialize dir somehowpublic <R> List<R> executeFunction(Function<File, R> fun){ List<R> l = new ArrayList<R>(); for(File f : dir){ l.add(fun.apply(f)); } return l;}The caller of this method passes in a Function that takes a java.io.File object and performs whatever operation is need to be done on that file. It is required that the above code must ensure that the caller only reads a file and is not able to overwrite or delete it irrespective of what level of permission the caller has. How can this be done?Select 1 option(s): Change the code inside the for loop as follows: AccessController.doPrivileged(new PrivilegedAction< Void >() { public Void run() { l.add(fun.apply(f)); return null; }} ); Change the code inside the for loop as follows: Permission perm = new java.io.FilePermission(f.getPath(), "read"); PermissionCollection perms = perm.newPermissionCollection(); perms.add(perm); AccessController.doPrivileged(new PrivilegedAction< Void >() { public Void run() { l.add(fun.apply(f)); return null; }},new AccessControlContext( new ProtectionDomain[] { new ProtectionDomain(null, perms) })); Change the code inside the for loop as follows: Permission perm = new java.io.FilePermission(f.getPath(), "read"); AccessController.checkPermission(perm);AccessController.doPrivileged(new PrivilegedAction< Void >() {public Void run() {l.add(fun.apply(f));return null; }} ); No code change is required. Modify the policy file to have only read permission to the given files.5. Question: What exception will be thrown out of the main method when the following program is run? package trywithresources;import java.io.IOException;public class Device implements AutoCloseable{ String header = null; public void open() throws IOException{ header = "OPENED"; System.out.println("Device Opened"); throw new IOException("Unknown"); } public String read() throws IOException{ return ""; } public void close(){ System.out.println("Closing device"); header = null; throw new RuntimeException("rte"); } public static void main(String[] args) throws Exception { try(Device d = new Device()){ throw new Exception("test"); } } }Select 1 option(s): java.lang.Exception java.lang.RuntimeException java.io.IOException The given code will not compile.6. Question: What will the following code print when run? import java.io.Reader;import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;public class MarkTest { public static void main(String[] args) { try (Reader r = new BufferedReader(new FileReader("c:\\temp\\test.txt"))) { if (r.markSupported()) { BufferedReader in = (BufferedReader) r; System.out.print(in.readLine()); in.mark(100); System.out.print(in.readLine()); System.out.print(in.readLine()); in.reset(); System.out.print(in.readLine()); in.reset(); System.out.println(in.readLine()); }else{ System.out.println("Mark Not Supported"); } } catch (IOException e) { e.printStackTrace(); } }}Assume that the file test.txt contains:ABCDESelect 1 option(s) Mark Not Supported ABCB < exception stack trace > ABC < exception stack trace > ABCBB ABCBD7. Question: What changes can be made to the following code so that it will print : Old Rating ANew Rating RList<Character> ratings = Arrays.asList('U', 'R', 'A');ratings.stream() .filter(x->x=='A') //1 .peek(x->System.out.println("Old Rating "+x)) //2 .map(x->x=='A'?'R':x) //3 .peek(x->System.out.println("New Rating "+x)); //4Select 1 option(s): Replace //2 with .forEach(System.out::println) Replace //3 with .map(x->System.out.println('R')); and remove //4 Replace //4 with .forEach(x->System.out.println("New Rating "+x)) No change is necessary.8. Question: Consider the following code:public class SubClass extends SuperClass{ int i, j, k;public SubClass( int m, int n ) { i = m ; j = m ; } //1public SubClass( int m ) { super(m ); } //2} Which of the following constructors MUST exist in SuperClass for SubClass to compile correctly?Select 2 option(s): It is ok even if no explicit constructor is defined in SuperClass public SuperClass(int a, int b) public SuperClass(int a) public SuperClass() only public SuperClass(int a) is required.9. Question: Given://Insert code here public abstract void draw();}//Insert code here public void draw(){ System.out.println("in draw..."); }}Which of the following lines of code can be used to complete the above code?Select2 option(s): class Shape { and class Circle extends Shape { public class Shape { and class Circle extends Shape { abstract Shape { andpublic class Circle extends Shape { public abstract class Shape { and class Circle extends Shape { @Override public abstract class Shape { and class Circle implements Shape { public interface Shape { and class Circle implements Shape { @Override10. Question: Which of the following expressions can be used to implement a Function<Integer, String> ? Select 3 option(s): (a)-> Integer.toHexString(a) a -> Integer::toHexString Integer::toHexString i::toHexString toHexString val -> val + 1 (Integer a)-> Integer.toHexString(a) Integer a-> Integer.toHexString(a)11. Question: What will be the result of attempting to compile and run the following code?public class InitClass{public static void main(String args[ ] ){ InitClass obj = new InitClass(5); }int m;static int i1 = 5; static int i2 ; int j = 100; int x;public InitClass(int m){ System.out.println(i1 + " " + i2 + " " + x + " " + j + " " + m); }{ j = 30; i2 = 40; } // Instance Initializer static { i1++; } // Static Initializer }Select 1 option(s): The code will fail to compile since the instance initializer tries to assign a value to a static member. The code will fail to compile since the member variable x will be uninitialized when it is used. The code will compile without error and will print 6 40 0 30 5 when run. The code will compile without error and will print 5, 0, 0, 100, 5 when run. The code will compile without error and will print 5, 40, 0, 30, 0 when run.12. Question: Given:Stream<Integer> strm1 = Stream.of(2, 3, 5, 7, 11, 13, 17, 19); //1Stream<Integer> strm2 = strm1.filter(i->{ return i>5 && i<15; }); //2strm2.forEach(System.out::print); //3Which of the following options can be used to replace line at //2 and still print the same elements of the stream?Select 1 option(s): Stream< Integer > strm2 = strm1.filter(i>5).filter(i<15); Stream< Integer > strm2 = strm1.parallel().filter(i->i>5).filter(i->i<15).sequential(); Stream< Integer > strm2 = strm1.collect( Collectors.partitioningBy(i->{ return i>5 && i<15; }) ).get("true").stream(); Stream< Integer > strm2 = strm1.map(i-> i>5?i<15?i:null:null);13. Question: Which of the following code fragments correctly loads a service provider that implements api.BloggerService? Select 1 option(s): Iterable< api.BloggerService > bsLoader = ServiceLoader.load(api.BloggerService.class); api.BloggerService bloggerServiceRef = ServiceLoader.load(api.BloggerService.class); api.BloggerService bloggerServiceRef = ServiceLoader< api.BloggerService >.load(api.BloggerService.class); ServiceLoader< api.BloggerService > bsLoader = new ServiceLoader<>(api.BloggerService.class); api.BloggerService bloggerServiceRef = java.util.service.Provider.getProvider(api.BloggerService.class);14. Question: Identify the right declaration for 'box' for the following code.import java.util.*;class Dumper { // declaration for box public void dumpStuff(){ for(List<String> l : box.values()){ System.out.println(l); } }}Select 2 option(s): List< String > box = new ArrayList< String >(); Map< List< String > > box = new TreeMap< List< String > >(); Map< String, List< String > > box = new HashMap< String, List< String > >(); LinkedList< String > box = new LinkedList< String >(); HashMap< ?, List< String > > box = new HashMap< String, List< String > >(); HashMap< ?, List< String > > box = new HashMap< ?, List< String > >();15. Question: What will the following class print when compiled and run?class Holder{ int value = 1;Holder link;public Holder(int val){ this.value = val; }public static void main(String[] args){ final var a = new Holder(5); var b = new Holder(10); a.link = b;b.link = setIt(a, b); System.out.println(a.link.value+" "+b.link.value); }public static Holder setIt(final Holder x, final Holder y){ x.link = y.link;return x;}}Select 1 option(s): It will not compile because 'a' is final. It will not compile because method setIt() cannot change x.link. It will print 5, 10. It will print 10, 10. It will throw an exception when run.16. Question: Consider the following classes :interface I{ }class A implements I{}class B extends A { }class C extends B{ } And the following declarations:A a = new A();B b = new B(); Identify options that will compile and run without error.Select 1 option(s): a = (B)(I)b; b = (B)(I) a; a = (I) b; I i = (C) a;17. Question: Given:ConcurrentMap<String, Object> cache = new ConcurrentHashMap<>();cache.put("111", student1);(Assume that student1 and student2 are references to a valid objects.)Which of the following statements are legal but will NOT modify the Map referenced by cache?Select 1 option(s): cache.put("111", student2); cache.putIfAbsent("111", student2); cache.checkAndPut("111", student2); cache.putIfNotLocked("111", student2);18. Question: What will the following code print when run?public class TestClass{public static Integer wiggler(Integer x){ Integer y = x + 10; x++; System.out.println(x); return y; }public static void main(String[] args){ Integer dataWrapper = new Integer(5); Integer value = wiggler(dataWrapper);System.out.println(dataWrapper+value);}}Select 1 option(s): 5 and 20 6 and 515 6 and 20 6 and 615 It will not compile.19. Question: Which of the following code snippets appearing in a method are valid. Select 1 option(s): for(var x : System.getProperties().entrySet()){ var m = x.getKey();} for(var x : System.getProperties().keySet()){System.out.println(x.length()); } var obj = null; var k = System.out::println; var _ = new ArrayList<>(); 0var _ = 10;20. Question: Which of the following statements are correct regarding the module system of Java. Select 1 option(s): A module can access all public classes of another module. A module can access all public classes of another module if it declares that it requires the other module. A module can access all public classes of another module if those classes are exported by the other module. A module can access public classes of only those packages of another module that the other module exports. A module can access another module if both are in the same folder.21. Question: Given:module foo.filter{ requires api; provides api.Filter with foo.DoNothingFilter;}Assuming that api.Filter is an interface with just a single method List<String> filter(List<String> l), which of the following is a valid implementation of foo.DoNothingFilter class?Select 1 option(s): package foo; impor0t api.*;import java.util.*; public class DoNothingFilter{ public List< String > filter(List< String > l) { return l; }} package foo; import api.*;import java.util.*;public class DoNothingFilter implements Filter{public DoNothingFilter(int a){ }public List< String > filter(List< String > l) { return l; }} package foo;import api.*; import java.util.*;public class DoNothingFilter { public DoNothingFilter(int a){ }public static Filter provider(){ return new Filter(){public List< String > filter(List< String > l) { return l; }}; }} package foo;import api.*; import java.util.*;public class DoNothingFilter implements Filter {public DoNothingFilter(){ } public static Filter provider(){ return new Filter(){public List< String > filter(List< String > l) { return l; }};}}22. Question: What will the following code print?public class BreakTest{public static void main(String[] args){int i = 0, j = 5; lab1 : for( ; ; i++){ for( ; ; --j) if( i >j ) break lab1; }System.out.println(" i = "+i+", j = "+j); }}Select 1 option(s): i = 1, j = -1 i = 1, j = 4 i = 0, j = 4 i = 0, j = -1 It will not compile.23. Question: Given that your module named foo.bar contains the following two source files: src/foo.bar/f/b/Baz1.java and src/foo.bar/f/c/Caz1.java.Which of the following options can be used to compile this module?(Assume that all directory paths are relative to the current directory.)Select 1 option(s): javac --module-source-path src src/*/*.java javac --module-source-path src -d out src/foo.bar/*/*.java javac --module-source-path src -d out src/foo.bar javac --module-source-path src -d out --module foo.bar javac --module-source-path src -module foo.bar24. Question: What will the following code print when compiled and run? int [] [] array = {{0}, {0, 1}, {0, 1, 2}, {0, 1, 2, 3}, {0, 1, 2, 3, 4}};var arr1 = array[4];System.out.println (arr1[4][1]);System.out.println (array[4][1]);Select 1 option(s): 11 1 4 41 It will not compile. It will throw ArrayIndexOutOfBoundsException at run time. It will throw IllegalArgumentException at run time.25. Question: Given that the user account under which the following code is run does not have the permission to access a.java, what will the the following code print when run?import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.nio.file.AccessDeniedException;import java.nio.file.NoSuchFileException;public class IOTest { public static void main(String[] args) { try(BufferedReader bfr = new BufferedReader(new FileReader("c:\\works\\a.java"))){ String line = null; while( (line = bfr.readLine()) != null){ System.out.println(line); } }catch(NoSuchFileException|IOException|AccessDeniedException e){ e.printStackTrace(); } }}Select 1 option(s): It will run without any exception and without any output. It will print a stack trace for AccessDeniedException. It will print a stack trace for IOException. It will print a stack trace for NoSuchFileException. It will not compile because the catch clause is invalid. It will not compile because AccessDeniedException is not a valid exception class in java.nio.file package.26. Question: What will the following code print? AtomicInteger ai = new AtomicInteger();Stream<String> stream = Stream.of("old", "king", "cole", "was", "a", "merry", "old", "soul").parallel();stream.filter( e->{ ai.incrementAndGet(); return e.contains("o");}).allMatch(x->x.indexOf("o")>0); System.out.println("AI = "+ai);Select 1 option(s): Any number between 1 to 8 Any number between 0 to 7 Any number between 1 to 6 8 427. Question: What will the following code fragment print when compiled and run?Statement stmt = null;Connection c = DriverManager.getConnection("jdbc:derby://localhost:1527/sample", "app", "app");try(stmt = c.createStatement();){ ResultSet rs = stmt.executeQuery("select * from STUDENT"); while(rs.next()){ System.out.println(rs.getString(0)); }}catch(SQLException e){ System.out.println("Exception ");}(Assume that items not specified such as import statements and try/catch block are all valid.)Select 1 option(s): It will throw an exception if the first column of the result is not a String. It will throw an exception every time it is run irrespective of what the query returns. It will print the values for the first column of the result and if there is no row in STUDENT table, it will not print anything. It will not compile.28. Question: You are the maintainer of a library packaged as bondanalytics.jar, which is used by several groups in your company. It has the following two packages that are used by other applications:com.abc.bondscom.abc.bonds.analyticsYou want to modularize this jar with least impact to others. What will you do?Select 1 option(s): Split the jar into two modules - one exporting com.abc.bond package and another exporting com.abc.bonds.analytics package. Just add module-info to the jar with export clauses for both the packages. Just add an empty module-info.java to the jar. It cannot be modularized without impacting existing non-modular applications that use it.29. Question: Given:int[][] iaa = { {1, 2}, {3, 4}, { 5, 6} };long count = Stream.of(iaa).flatMapToInt(IntStream::of) .map(i->i+1).filter(i->i%2 != 0).peek(System.out::print).count();System.out.println(count);What will be the output?Select 1 option(s): 3573 2463 3 234567630. Question: Given the following module-info:module book{ requires org.pdf; uses org.pdf.Print;}Which of the following statements are correct?Select 2 option(s): The module that defines Print service must be present on --module-source-path for book module to compile. The module that defines Print service must be present on --module-path for book module to compile. The module that defines Print service must be present on --module-path for book module to execute. At least one module that provides Print service must be present on --module-path for book module to execute. A module that defines Print service may be added later without requiring book module to recompile. An implementation of org.pdf.Print can be added to the book module.31. Question: What is the result of executing the following fragment of code: boolean b1 = false;int i1 = 2;int i2 = 3;if (b1 = i1 == i2){ System.out.println("true");} else{ System.out.println("false");}Select 1 option(s): Compile time error. It will print true It will print false Runtime error. It will print nothing.32. Question: What will the following code print when run? import java.util.function.*;class Employee{ int age; }public class TestClass{ public static void main(String[] args) { Employee e = new Employee(); Supplier<Employee> se = ()->{ e.age = 40; return e; }; //1 e.age = 50;//2 System.out.println(se.get().age); //3 }}Select 1 option(s): It will fail to compile at line marked //1 It will fail to compile at line marked //3 It will print 40. It will print 50. It will throw an exception at run time.33. Question: Consider the following code:package mypack;public class TestOuter{ public static class TestInner { public void sayIt(){ System.out.println("hello"); } } public static void main(String[] args){ //call here }}Which of the following options are correct?Select 2 option(s): An instance of the nested class can be created from any class using: new TestOuter.TestInner(). (Assuming appropriate imports). An instance of the nested class can be created only from classes of package mypack. An instance of the nested class can be created from a class of package mypack using: new TestInner().(Assuming appropriate imports). It will not compile. TestInner.sayIt(); can be inserted in main.34. Question: What will the following code print when compiled and run? var numA = new Integer[]{1, null, 3}; //1var list1 = List.of(numA); //2var list2 = Collections.unmodifiableList(list1); //3numA[1] = 2; //4System.out.println(list1+" "+list2);Select 1 option(s): It will not compile. An exception will be thrown at run time. [1, null, 3] [1, 2, 3] [1, null, 3] [1, null, 3] [1, 2, 3] [1, 2, 3]35. Question: Given: static boolean validateInput(String str){ return INSERT CODE HERE; }Which of the following expressions can be inserted in the above code so that the validateInput method will return true if and only if the input string contains non-whitespace data?Select 1 option(s): !str.isBlank() !str.isEmpty() str.strip() != "" !str.equalsIgnoreBlanks("") str.compareTo("") != 036. Question: A new Java programmer has written the following method that takes an array of ints and sums up all the integers that are less than 100.public void processArray(int[] values){ int sum = 0; int i = 0; try{ while(values[i]<100){ sum = sum +values[i]; i++; } } catch(Exception e){ } System.out.println("sum = "+sum); }Which of the following are best practices to improve this code?Select 2 option(s): Use ArrayIndexOutOfBoundsException for the catch argument. Use ArrayIndexOutOfBoundsException for the catch argument and add code in the catch block to log or print the exception. Add code in the catch block to handle the exception. Use flow control to terminate the loop.37. Question: Consider the following class:public class PortConnector{ public PortConnector(int port) throws IOException{ ...lot of valid code. } ...other valid code.}You want to write another class CleanConnector that extends from PortConnector. Which of the following statements should hold true for CleanConnector class?Select 1 option(s): It is not possible to define CleanConnector that does not throw IOException at instantiation. PortConnector class itself is not valid because you cannot throw any exception from a constructor. CleanConnector's constructor cannot throw any exception other than IOException. CleanConnector's constructor cannot throw any exception other than subclass of IOException. CleanConnector's constructor cannot throw any exception other than superclass of IOException. None of these.38. Question: Which of the following options correctly makes use of java.util.concurrent.Callable? Select 1 option(s): public static class MyTask implements Callable< String >{ public String call(){try { //do something } catch (Exception ex) { ex.printStackTrace(); } return new Future< String >("Data from callable");}} public static class MyTask implements Callable< String >{ public String call() throws Exception {//do something return "Data from callable";}} public static class MyTask extends Callable< String >{public String call(){return "Data from callable"; }} public class MyTask implements Callable{Future result;public void call(){result = new Future< String >("Data from callable");}}39. Question: Consider the following code:import java.io.*;public class Test{ public static void main(String[] args) throws Exception { var fw = new FileWriter("text.txt"); // fw.write("hello"); //1 fw.close(); }}Which of the following statements are correct?Select 1 option(s): It will throw an exception if text.txt does not exist. It will create text.txt file in the filesystem if it does not exist. It will not throw an exception if text.txt does not exist and it will not create a file either because nothing is being written to the file. It will throw an exception if //1 is uncommented and if text.txt does not exist. It will throw an exception if text.txt already exists.40. Question: Consider the following code appearing in the same file:class Data { private int x = 0, y = 0; public Data(int x, int y){this.x = x; this.y = y; }}public class TestClass {public static void main(String[] args) throws Exception { Data d = new Data(1, 1); //add code here }} Which of the following options when applied individually will change the Data object currently referred to by the variable d to contain 2, 2 as values for its data fields?Select 1 option(s): Add the following two statements :d.x = 2; d.y = 2; Add the following statement: d = new Data(2, 2); Add the following two statements: d.x += 1; d.y += 1; Add the following method to Data class:public void setValues(int x, int y){this.x.setInt(x); this.y.setInt(y); }Then add the following statement:d.setValues(2, 2); Add the following method to Data class: public void setValues(int x, int y){ this.x = x; this.y = y; }Then add the following statement:d.setValues(2, 2);41. Question: What will the following code print when run? Deque<Integer> d = new ArrayDeque<>(); d.push(1); d.push(2); d.push(3); System.out.println(d.pollFirst()); System.out.println(d.poll()); System.out.println(d.pollLast());Select 1 option(s): 123 321 Compilation error Exception at run time42. Question: What will the following code print? Map<String, Integer> map1 = new HashMap<>();map1.put("a", 1);map1.put("b", 1);map1.merge("b", 1, (i1, i2)->i1+i2);map1.merge("c", 3, (i1, i2)->i1+i2);System.out.println(map1);Select 1 option(s): {a=1, b=2, c=3} {a=1, b=1, c=3} {a=1, b=2} A NullPointerException will be thrown at run time.43. Question: Given:class Base{ public <T> Collection<T> transform(Collection<T> list) { return new ArrayList<T>(); }}class Derived extends Base{ //public <T> Collection<T> transform(Collection<T> list) { return new HashSet<String>(); }; //1 //public <T> Collection<T> transform(Stream<T> list) { return new HashSet<T>();}; //2 //public <T> List<T> transform(Collection<T> list) { return new ArrayList<T>(); }; //3 //public <X> Collection<X> transform(Collection<X> list) { return new HashSet<X>();}; //4 //public Collection<CharSequence> transform(Collection<CharSequence> list) { return new HashSet<CharSequence>();}; //5}Identify correct statements about the methods defined in Derived assuming they are uncommented one at a time individually.Select 2 option(s): //1 correctly overrides the method in Base //1 will cause compilation failure. //2 correctly overrides the method in Base //3 correctly overrides the method in Base //4 will cause compilation failure. //5 correctly overrides the method in Base //5 correctly overloads the method in Base44. Question: Which of these for statements are valid when present in a method?1. for (var i=5; i=0; i--) { } 2. var j=5; for(int i=0, j+=5; i<j ; i++) { j--; } 3. int i, j; for (j=10; i<j; j--) { i += 2; }4. var i=10; for ( ; i>0 ; i--) { }5. for (int i=0, j=10; i<j; i++, --j) {;}6. for (var i=0, j=10; i<j; i++, --j) {;}Select 1 option(s): 1, 2 3, 4 1, 5 4, 5 5 4, 5, 645. Question: What will the following code fragment print? Path p1 = Paths.get("photos/goa"); Path p2 = Paths.get("/index.html"); Path p3 = p1.relativize(p2); System.out.println(p3);Select 1 option(s): ..\index.html \index.html \photos\index.html \photos\goa\index.html java.lang.IllegalArgumentException will be thrown46. Question: Given:public class CrazyMath { public static void main(String[] args) { int x = 10, y = 20; int dx, dy; try{ dx = x % 5; dy = y/dx; }catch(ArithmeticException ae){ System.out.println("Caught AE"); dx = 2; dy = y/dx; } x = x/dx; y = y/dy; System.out.println(dx+" "+dy); System.out.println(x+" "+y); }}What is the output?Select 1 option(s): Caught AE 2 105 5 Caught AE 2 105 2 2 105 2 It will not compile.47. Question: Given the following code:class TestClass{ public static void main(String args[]){ int time = 100; java.sql.Timestamp ts = new java.sql.Timestamp(time); java.util.Date d = new java.util.Date(); ts = new java.sql.Timestamp(d.getTime()); System.out.println(ts); }}and the following commands:javac TestClass.javajdeps -summary TestClass.javaWhat will be the output?Select 1 option(s): TestClass.class -> java.base TestClass.class -> java.sqlTestClass.class -> java.util TestClass.class -> java.base TestClass.class -> java.base TestClass.class -> java.sql TestClass.class -> java.sql TestClass.class -> java.util Compilation will be successful but the jdeps command will generate an error.48. Question: Your application is packaged in myapp.jar and depends on a jar named datalayer.jar, which in turn depends on mysql-connector-java-8.0.11.jar.You have modularized myapp without waiting for datalayer and mysql driver to be modularized and the following are the contents of myapp's module-info:module abc.myapp{ requires datalayer;}Assming that com.abc.myapp.Main is the main class of your application that you want to execute, which of the following commands will successfully launch your application?Select 3 option(s): java -classpath mysql-connector-java-8.0.11.jar;datalayer.jar;myapp.jar com.abc.myapp.Main java -module-path mysql-connector-java-8.0.11.jar;datalayer.jar;myapp.jar com.abc.myapp.Main java -p mysql-connector-java-8.0.11.jar;datalayer.jar;myapp.jar -m com.abc.myapp.Main java -p mysql-connector-java-8.0.11.jar;datalayer.jar;myapp.jar -m abc.myapp/com.abc.myapp.Main java -cp mysql-connector-java-8.0.11.jar -p datalayer.jar;myapp.jar -m abc.myapp/com.abc.myapp.Main49. Question: Given:interface AmazingInterface{ String value = "amazing"; void amazingMethod(String arg);}abstract class AmazingClass implements AmazingInterface{ static String value = "awesome"; abstract void amazingMethod(String arg1, String arg2);}public class Awesome extends AmazingClass implements AmazingInterface { public void amazingMethod(String arg1){ } public void amazingMethod(String arg1, String arg2){ } public void main(String[] args){ AmazingInterface ai = new Awesome(); //INSERT CODE HERE }} Identify the options that will cause compilation failure.Select 3 option(s): ai.amazingMethod(AmazingInterface.value, AmazingClass.value); ai.amazingMethod(AmazingInterface.value); ((AmazingClass)ai).amazingMethod("x1", value); ai.amazingMethod(value); ai.amazingMethod("x1");50. Question: Given:enum Title{ MR("Mr."), MS1("Ms."), MS2("Ms."); private String title; private Title(String s){ title = s; } }public class TestClass{ public static void main(String[] args) { var ts = new TreeSet<Title>(); ts.add(Title.MS2); ts.add(Title.MR); ts.add(Title.MS1); for(Title t : ts){ System.out.println(t); } }}What will be the output when TestClass is compiled and run?Select 1 option(s): It will print MR, MS1, MS2, but the order is unpredictable. MS2, MR, MS1, MR, MS1, MS2, It will not compile.51. Question: What will the following program print when compiled and run?class Data {private int x = 0;private String y = "Y";public Data(int k){ this.x = k; }public Data(String k){this.y = k; }public void showMe(){ System.out.println(x+y); }}public class TestClass { public static void main(String[] args) throws Exception { new Data(10).showMe(); new Data("Z").showMe(); }}Select 1 option(s): 0Z 10Y 10Y 0Z It will not compile. It will throw an exception at run time.52. Question: Which of the following are benefits of the Java module system? Select 1 option(s): It saves application developers from Jar hell. It improves security and maintainability. It makes it easier to expose implementation details. It eliminates the need of making custom runtime liked applications.Time is Up!