Result for: Deeksha Unawane
Exam Name: Core Java Final
Download Result (PDF)Email: [email protected]
Total Marks: 50.0
Score: 1.0
Percentage: 2.00%
Question Answers
| Sr. No. | Question | Selected Answer | Correct Answer |
|---|---|---|---|
| 1 | Which of these classes is not part of Java’s collection framework? | Array | Maps |
| 2 | Which of these methods deletes all the elements from invoking collection? | clear() | clear() |
| 3 | . What will be the output of the following Java program? import java.util.*; class Array { public static void main(String args[]) { int array[] = new int [5]; for (int i = 5; i > 0; i--) array[5-i] = i; Arrays.fill(array, 1, 4, 8); for (int i = 0; i < 5 ; i++) System.out.print(array[i]); } } | 54881 | 58881 |
| 4 | Which of these method is used to add an element to the start of a LinkedList object? | No answer selected | add() |
| 5 | What will be the output of the following Java code snippet? import java.util.*; class Linkedlist { public static void main(String args[]) { LinkedList obj = new LinkedList(); obj.add("A"); obj.add("B"); obj.add("C"); obj.addFirst("D"); System.out.println(obj); } } | No answer selected | [D, A, B, C] |
| 6 | What will be the output of the following Java program? import java.util.*; class Output { public static void main(String args[]) { TreeSet t = new TreeSet(); t.add("3"); t.add("9"); t.add("1"); t.add("4"); t.add("8"); System.out.println(t); } } | No answer selected | [1, 3, 4, 8, 9] |
| 7 | Which of these are legacy classes? | No answer selected | All of the mentioned |
| 8 | Which of these methods is used to add elements in vector at specific location? | No answer selected | addElement() |
| 9 | What will be the output of the following Java program? import java.util.*; class Maps { public static void main(String args[]) { HashMap obj = new HashMap(); obj.put("A", new Integer(1)); obj.put("B", new Integer(2)); obj.put("C", new Integer(3)); System.out.println(obj); } } | No answer selected | {A=1, B=2, C=3} |
| 10 | What will be the output of the following Java program? import java.util.*; class Array { public static void main(String args[]) { int array[] = new int [5]; for (int i = 5; i > 0; i--) array[5 - i] = i; Arrays.sort(array); for (int i = 0; i < 5; ++i) System.out.print(array[i]);; } } | No answer selected | 12345 |
| 11 | __________ Interface provides the programmatic approach to set the values in database. | No answer selected | java.sql.PreparedStatement |
| 12 | What does setAutoCommit(false) do? | No answer selected | does not commit transaction automatically after each query |
| 13 | Which type of JDBC driver is the fastest one? | No answer selected | Type-4 |
| 14 | What will be the output of the following code snippet that uses Java Database Connectivity (JDBC) to interact with a database? import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class DatabaseConnection { public static void main(String[] args) { try { Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb", "username", "password"); System.out.println("Connected to the database successfully."); } catch (SQLException e) { e.printStackTrace(); } } } | No answer selected | Connected to the database successfully. |
| 15 | Which of these keywords must be used to monitor for exceptions? | No answer selected | try |
| 16 | What will be the output of the following Java program? class exception_handling { public static void main(String args[]) { try { System.out.print("Hello" + " " + 1 / 0); } catch(ArithmeticException e) { System.out.print("World"); } } } | No answer selected | World |
| 17 | What will be the output of the following Java program? class exception_handling { public static void main(String args[]) { try { int a, b; b = 0; a = 5 / b; System.out.print("A"); } catch(ArithmeticException e) { System.out.print("B"); } finally { System.out.print("C"); } } } | No answer selected | BC |
| 18 | Which of the following should be true of the object thrown by a thrown statement? | No answer selected | Should be assignable to Throwable type |
| 19 | What is the output of the following code snippet? try { throw new RuntimeException("Error"); } catch (Exception e) { System.out.println(e.getMessage()); } | No answer selected | Error |
| 20 | Which of the following statement(s) is/are correct about multi-catch statement? | No answer selected | (d) All above |
| 21 | Which of these interface is not a member of java.io package? | No answer selected | ObjectFilter |
| 22 | Which of these is specified by a File object? | No answer selected | none of the mentioned |
| 23 | Which of these is method for testing whether the specified element is a file or a directory? | No answer selected | isFile() |
| 24 | What will be the output of the following Java code? import java.io.*; class files { public static void main(String args[]) { File obj = new File("/java/system"); System.out.print(obj.getName()); } } | No answer selected | system |
| 25 | Which of these data type is returned by every method of OutputStream? | No answer selected | none of the mentioned |
| 26 | Which of these process occur automatically by the java runtime system? | No answer selected | Serialization |
| 27 | Which of these is method of ObjectOutput interface used to write the object to input or output stream as required? | No answer selected | writeObject() |
| 28 | What will be the output of the following Java program? import java.io.*; class serialization { public static void main(String[] args) { try { Myclass object1 = new Myclass("Hello", -7, 2.1e10); FileOutputStream fos = new FileOutputStream("serial"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(object1); oos.flush(); oos.close(); } catch(Exception e) { System.out.println("Serialization" + e); System.exit(0); } try { Myclass object2; FileInputStream fis = new FileInputStream("serial"); ObjectInputStream ois = new ObjectInputStream(fis); object2 = (Myclass)ois.readObject(); ois.close(); System.out.println(object2); } catch (Exception e) { System.out.print("deserialization" + e); System.exit(0); } } } class Myclass implements Serializable { String s; int i; double d; Myclass (String s, int i, double d) { this.d = d; this.i = i; this.s = s; } } | No answer selected | s=Hello; i=-7; d=2.1E10 |
| 29 | Which of these is not a correct statement? | No answer selected | Abstract class can be initiated by new operator |
| 30 | Which of these packages contains abstract keyword? | No answer selected | java.lang |
| 31 | What will be the output of the following Java code? class A { public int i; private int j; } class B extends A { void display() { super.j = super.i + 1; System.out.println(super.i + " " + super.j); } } class inheritance { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } } | No answer selected | Compilation Error |
| 32 | What is an interface in Java? | No answer selected | A contract specifying a set of methods that a class must implement |
| 33 | Which of the following is the correct way of implementing an interface salary by class manager? | No answer selected | class manager implements salary {} |
| 34 | Which of the following is an incorrect statement about packages? | No answer selected | All variables are static and methods are public if interface is defined public |
| 35 | What will be the output of the following Java program? interface calculate { void cal(int item); } class display implements calculate { int x; public void cal(int item) { x = item * item; } } class interfaces { public static void main(String args[]) { display arr = new display(); arr.x = 0; arr.cal(2); System.out.print(arr.x); } } | No answer selected | 4 |
| 36 | Which component of Java is responsible for running the compiled Java bytecode? | No answer selected | JVM |
| 37 | What is the purpose of the PATH environment variable in Java? | No answer selected | To locate the Java compiler |
| 38 | Which data type would be best for storing a person's age in Java? | No answer selected | byte |
| 39 | What is the result of this operation in Java: (int)(7.9)? | No answer selected | 7 |
| 40 | Identify the output of this code: boolean isJavaFun = true; System.out.println(!isJavaFun); | No answer selected | false |
| 41 | What does the following Java code print? int x = 5; int y = x++; System.out.println(y); | No answer selected | 5 |
| 42 | What will be the output of the following Java code? class access { public int x; private int y; void cal(int a, int b) { x = a + 1; y = b; } } public class access_specifier { public static void main(String args[]) { access obj = new access(); obj.cal(2, 3); System.out.println(obj.x + " " + obj.y); } } | No answer selected | Runtime Error |
| 43 | What will be the output of the following Java code? class static_out { static int x; static int y; void add(int a, int b) { x = a + b; y = x + b; } } public class static_use { public static void main(String args[]) { static_out obj1 = new static_out(); static_out obj2 = new static_out(); int a = 2; obj1.add(a, a + 1); obj2.add(5, a); System.out.println(obj1.x + " " + obj2.y); } } | No answer selected | 7 9 |
| 44 | Which of these access specifier must be used for class so that it can be inherited by another subclass? | No answer selected | public |
| 45 | In java,which method is automatically called when an object is created? | No answer selected | constructor() |
| 46 | What will be the output of the following Java code? class increment { public static void main(String args[]) { int g = 3; System.out.print(++g * 8); } } | No answer selected | 32 |
| 47 | . What will be the output of the following Java code? class area { public static void main(String args[]) { double r, pi, a; r = 9.8; pi = 3.14; a = pi * r * r; System.out.println(a); } } | No answer selected | 301.5656 |
| 48 | Which of the following methods is a method of wrapper Integer for obtaining hash code for the invoking object? | No answer selected | int hashCode() |
| 49 | Which of these is a super class of wrappers Long, Character & Integer? | No answer selected | Number |
| 50 | What will be the output of the following Java program? class Output { public static void main(String args[]) { char a[] = {'a', '5', 'A', ' '}; System.out.print(Character.isDigit(a[0]) + " "); System.out.print(Character.isWhitespace(a[3]) + " "); System.out.print(Character.isUpperCase(a[2])); } } | No answer selected | false true true |
Page 1