image not found

Oops! That page can't be found.


Directions to Solve

In questions below, each passage consist of six sentences. The first and sixth sentence are given in the begining. The middle four sentences in each have been removed and jumbled up. These are labelled as P, Q, R and S. Find out the proper order for the four sentences.

Q1:
S1: Minnie went shopping one morning.
P : Disappointed She turned around and returned to the parking lot.
Q : She got out and walked to the nearest shop.
R : She drove her car into the parking lot and stopped.
S : It was there that she realised that she'd forgotten her purse at home.
S6: She drove home with an empty basket.
The Proper sequence should be:

A RSQP

B QPRS

C PQRS

D RQSP

Q2: Point out the error in the program

f(int a, int b)
{
    int a;
    a = 20;
    return a;
}

A The function should be defined as int f(int a, int b)

B Missing parenthesis in return statement

C None of above

D Redeclaration of a

Q3: What will be the output of the program?
public class Switch2 
{
    final static short x = 2;
    public static int y = 0;
    public static void main(String [] args) 
    {
        for (int z=0; z < 4; z++) 
        {
            switch (z) 
            {
                case x: System.out.print('0 ');
                default: System.out.print('def ');
                case x-1: System.out.print('1 ');  
                            break;
                case x-2: System.out.print('2 ');
            }
        }
    }
}

A 2 1 0 def 1

B 2 1 0 def 1 def 1

C 2 1 0 def def

D 0 def 1

Q4: What will be the output of the program?
int i = 0, j = 5; 
tp: for (;;) 
    {
        i++;  
        for (;;) 
        {
            if(i > --j) 
            {
                break tp; 
            } 
        } 
        System.out.println('i =' + i + ', j = ' + j);

A i = 3, j = 4

B i = 1, j = 4

C Compilation fails.

D i = 1, j = 0

Q5: What will be the output of the program?
int I = 0;
label:
    if (I < 2) {
    System.out.print('I is ' + I);
    I++;
    continue label;
}

A None of the above

B
 
Compilation fails.

C I is 0

D I is 0 I is 1

Q6: Suppose that you would like to create an instance of a new Map that has an iteration order that is the same as the iteration order of an existing instance of a Map. Which concrete implementation of the Map interface should be used for the new instance?

A LinkedHashMap

B HashMap

C TreeMap

D The answer depends on the implementation of the existing instance.

Q7: Which class does not override the equals() and hashCode() methods, inheriting them directly from class Object?

A java.lang.Double

B java.lang.Character

C java.lang.StringBuffer

D java.lang.String

Q8: Which collection class allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized?

A java.util.LinkedHashSet

B java.util.List

C java.util.ArrayList

D java.util.HashSet

Q9: You need to store elements in a collection that guarantees that no duplicates are stored and all elements can be accessed in natural order. Which interface provides that capability?

A java.util.Collection

B java.util.List

C java.util.Set

D java.util.Map

Q10: Which interface does java.util.Hashtable implement?

A Java.util.Collection

B Java.util.Map

C Java.util.HashTable

D Java.util.List