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: Moncure Conway devoted his life to two great objects freedom of thought, and freedom of the individual.
P : They threaten both kinds of freedom.
Q : But something also has been lost.
R : There are now dangers, somewhat different in form from those of the past ages.
S : In regard to both these objects, something has been gained since his time.
S6: Unless a vigorous and vigilant public opinion can be aroused in defence of them, there will be much less of both a hundred years hence then there is now.
The Proper sequence should be:

A QSPR

B SQRP

C PQRS

D RSPQ

Q2: What will be the output of the program?
#include<stdio.h>
int fun(int(*)());

int main()
{
    fun(main);
    printf("Hi\n");
    return 0;
}
int fun(int (*p)())
{
    printf("Hello ");
    return 0;
}

A Error

B Hi

C Hello Hi

D Infinite loop

Q3: What will be the output of the program?
interface Count 
{
    short counter = 0;
    void countUp();
}
public class TestCount implements Count 
{
    public static void main(String [] args) 
    {
        TestCount t = new TestCount();
        t.countUp();
    }
    public void countUp() 
    {
        for (int x = 6; x>counter; x--, ++counter) /* Line 14 */
        {
            System.out.print(' ' + counter);
        }
    }
}

A 1 2 3 4

B Compilation fails

C 0 1 2

D 1 2 3

E 0 1 2 3

Q4: What will be the output of the program?
class Base
{ 
    Base()
    {
        System.out.print('Base');
    }
} 
public class Alpha extends Base
{ 
    public static void main(String[] args)
    { 
        new Alpha(); /* Line 12 */
        new Base(); /* Line 13 */
    } 
}

A Base

B Compilation fails

C The code runs with no output

D BaseBase

Q5: What will be the output of the program?
import java.util.*;
public class NewTreeSet2 extends NewTreeSet 
{
    public static void main(String [] args) 
    {
        NewTreeSet2 t = new NewTreeSet2();
        t.count();
    }
}
protected class NewTreeSet
{
    void count() 
    {
        for (int x = 0; x < 7; x++,x++ ) 
        {
            System.out.print(' ' + x);
        }
    }
}

A 0 2 4

B Compilation fails at line 2

C 0 2 4 6

D Compilation fails at line 10

Q6: What will be the output of the program?
public class ArrayTest 
{ 
    public static void main(String[ ] args)
    { 
        float f1[ ], f2[ ]; 
        f1 = new float[10]; 
        f2 = f1; 
        System.out.println('f2[0] = ' + f2[0]); 
    } 
}

A
An error at f2 = f1; causes compile to fail.

B It prints the garbage value.

C It prints f2[0] = NaN

D It prints f2[0] = 0.0

Q7: What will be the output of the program?
class Super 
{ 
    public Integer getLength() 
    {
        return new Integer(4); 
    } 
} 

public class Sub extends Super 
{ 
    public Long getLength() 
    {
        return new Long(5); 
    } 

    public static void main(String[] args) 
    { 
        Super sooper = new Super(); 
        Sub sub = new Sub(); 
        System.out.println( 
        sooper.getLength().toString() + ',' + sub.getLength().toString() ); 
    } 
}

A 4, 5

B 4, 4

C 5, 4

D Compilation fails.

Q8:
interface DoMath 
{
    double getArea(int rad); 
}
interface MathPlus 
{
    double getVol(int b, int h); 
}
/* Missing Statements ? */
which two code fragments inserted at end of the program, will allow to compile?
  1. class AllMath extends DoMath { double getArea(int r); }
  2. interface AllMath implements MathPlus { double getVol(int x, int y); }
  3. interface AllMath extends DoMath { float getAvg(int h, int l); }
  4. class AllMath implements MathPlus { double getArea(int rad); }
  5. abstract class AllMath implements DoMath, MathPlus { public double getArea(int rad) { return rad * rad * 3.14; } }

A 3 and 5

B 1 and 4

C 1 only

D 2 only

Q9:
Which two statements are true for any concrete class implementing the java.lang.Runnable interface?
  1. You can extend the Runnable interface as long as you override the public run() method.
  2. The class must contain a method called run() from which all code for that thread will be initiated.
  3. The class must contain an empty public void method named run().
  4. The class must contain a public void method named runnable().
  5. The class definition must include the words implements Threads and contain a method called run().
  6. The mandatory method must be public, with a return type of void, must be called run(), and cannot take any arguments.

A 1 and 5

B 2 and 6

C 1 and 3

D 2 and 4

Q10:
/* Missing statements ? */
public class NewTreeSet extends java.util.TreeSet
{
    public static void main(String [] args) 
    {
        java.util.TreeSet t = new java.util.TreeSet();
        t.clear();
    }
    public void clear() 
    {
        TreeMap m = new TreeMap();
        m.clear();
    }
}
which two statements, added independently at beginning of the program, allow the code to compile?
  1. No statement is required
  2. import java.util.*;
  3. import.java.util.Tree*;
  4. import java.util.TreeSet;
  5. import java.util.TreeMap;

A 1 only

B 3 and 5

C 3 and 4

D 2 and 5