ExamVeda
Login
Home
31
Which of these instance cannot be created?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
32
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));
    }
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
33
Which of these data type cannot be type parameterized?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
34
What are generic methods?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
35
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());
    }
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
36
Which of these Exception handlers cannot be type parameterized?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
37
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 <String> gs = new genericstack<String>();
        gs.push("Hello");
        System.out.print(gs.pop() + " ");
        genericstack <Integer> gs = new genericstack<Integer>();
        gs.push(36);
        System.out.println(gs.pop());
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
38
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.print(gs.pop() + " ");
        genericstack <Integer> gs = new genericstack<Integer>();
        gs.push(36);
        System.out.println(gs.pop());
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
39
Which of these keywords is used to upper bound a wildcard?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
40
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 <String> gs = new genericstack<String>();
        gs.push("Hello");
        System.out.print(gs.pop() + " ");
        genericstack <Integer> gs = new genericstack<Integer>();
        gs.push(36);
        System.out.println(gs.pop());
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board