Question 1 of 25
Hints left: 3
Q1
In JavaBeans, what is the purpose of the getter method?
Q2
Which file extension is commonly used for JavaBean files?
Q3
What is a JavaBean in Java?
Q4
Which of these is an correct way of defining generic method?
-
A
-
B
-
C
-
D
Q5
Which of these type parameters is used for a generic methods to return and accept any type of object?
Q6
Which of the following cannot be Type parameterized?
Q7
Which of the following keywords are used for lower bounding a wild card?
Q8
What will be the output of the following Java program? import java.util.*; class Output { public static double sumOfList(List<? extends Number> list) { double s = 0.0; for (Number n : list) s += n.doubleValue(); return s; } public static void main(String args[]) { List<Integer> li = Arrays.asList(1, 2, 3); System.out.println(sumOfList(li)); } }
Q9
Which of these types cannot be used to initiate a generic type?
Q10
Which Java package contains the JDBC classes and interfaces?
Q11
What is use of wildcards?
Q12
What will be the output of the following Java code? import java.util.*; public class genericstack <E> { Stack <E> stk = new Stack <E>(); public void push(E obj) { stk.push(obj); } public E pop() { E obj = stk.pop(); return obj; } } class Output { public static void main(String args[]) { genericstack <String> gs = new genericstack<String>(); gs.push("Hello"); System.out.println(gs.pop()); } }
Q13
Which of these type parameters is used for a generic methods to return and accept a number?
Q14
Which of the following allows us to call generic methods as a normal method?
Q15
What is the purpose of the JDBC `DriverManager` class?
Q16
What is JDBC in Java?
Q17
What will be the output of the following Java code? import java.util.*; public class genericstack <E> { Stack <E> stk = new Stack <E>(); public void push(E obj) { stk.push(obj); } public E pop() { E obj = stk.pop(); return obj; } } class Output { public static void main(String args[]) { genericstack <Integer> gs = new genericstack<Integer>(); gs.push(36); System.out.println(gs.pop()); } }
Q18
What will be the output of the following Java program? import java.util.*; public class genericstack <E> { Stack stk = new Stack <E>(); public void push(E obj) { stk.push(obj); } public E pop() { E obj = stk.pop(); return obj; } } class Output { public static void main(String args[]) { genericstack <String> gs = new genericstack(); gs.push("Hello"); System.out.println(gs.pop()); } }
Q19
What will be the output of the following Java program? import java.util.*; public class genericstack <E> { Stack <E> stk = new Stack <E>(); public void push(E obj) { stk.push(obj); } public E pop() { E obj = stk.pop(); return obj; } } class Output { public static void main(String args[]) { genericstack <Integer> gs = new genericstack<Integer>(); gs.push(36); System.out.println(gs.pop()); } }
Q20
What will be the output of the following Java program? import java.util.*; public class genericstack <E> { Stack <E> stk = new Stack <E>(); public void push(E obj) { stk.push(obj); } public E pop() { E obj = stk.pop(); return obj; } } class Output { public static void main(String args[]) { genericstack <Integer> gs = new genericstack<Integer>(); gs.push(36); System.out.println(gs.pop()); } }
Q21
What will be the output of the following Java program? import java.util.*; class Output { public static double sumOfList(List<? extends Number> list) { double s = 0.0; for (Number n : list) s += n.doubleValue(); return s; } public static void main(String args[]) { List<Double> ld = Arrays.asList(1.2, 2.3, 3.5); System.out.println(sumOfList(ld)); } }
Q22
Which of the following is a valid property name for a JavaBean?
Q23
What will be the output of the following Java program? public class BoxDemo { public static <U> void addBox(U u, java.util.List<Box<U>> boxes) { Box<U> box = new Box<>(); box.set(u); boxes.add(box); } public static <U> void outputBoxes(java.util.List<Box<U>> boxes) { int counter = 0; for (Box<U> box: boxes) { U boxContents = box.get(); System.out.println("Box #" + counter + " contains [" + boxContents.toString() + "]"); counter++; } } public static void main(String[] args) { java.util.ArrayList<Box<Integer>> listOfIntegerBoxes = new java.util.ArrayList<>(); BoxDemo.<Integer>addBox(Integer.valueOf(10), listOfIntegerBoxes); BoxDemo.outputBoxes(listOfIntegerBoxes); } }
Q24
What is the role of the `javabeans.Introspector` class in JavaBeans?
Q25
What does the JDBC `Connection` interface represent?