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: The study of speech disorders due to brain injury suggests that patients can think without having adequate control over their language.
P : But they succeed in playing games of chess.
Q : Some patients, for example fail to find the names of objects presented to them.
R : They can even use the concepts needed for chess playing, though they are unable to express many of the concepts in ordinary language.
S : They even find it difficult to interpret long written notices.
S6: How they manage to do this we do not know.
The Proper sequence should be:

A PSQR

B QSPR

C SRPQ

D RPSQ

Q2: What will be the output of the program?
#include<stdio.h>

int fun(int i)
{
    i++;
    return i;
}

int main()
{
    int fun(int);
    int i=3;
    fun(i=fun(fun(i)));
    printf("%d\n", i);
    return 0;
}

A Garbage value

B 5

C 4

D Error

Q3:
Which three statements are true?
  1. The default constructor initialises method variables.
  2. The default constructor has the same access as its class.
  3. The default constructor invokes the no-arg constructor of the superclass.
  4. If a class lacks a no-arg constructor, the compiler always creates a default constructor.
  5. The compiler creates a default constructor only when there are no other constructors for the class.

A 2, 3 and 5

B 1, 2 and 3

C 3, 4 and 5

D 1, 2 and 4

Q4:

package testpkg.p1;
public class ParentUtil 
{
    public int x = 420;
    protected int doStuff() { return x; }
}

package testpkg.p2;
import testpkg.p1.ParentUtil;
public class ChildUtil extends ParentUtil 
{
    public static void main(String [] args) 
    {
        new ChildUtil().callStuff();
    }
    void callStuff() 
    {
        System.out.print('this ' + this.doStuff() ); /* Line 18 */
        ParentUtil p = new ParentUtil();
        System.out.print(' parent ' + p.doStuff() ); /* Line 20 */
    }
}
which statement is true?

A If line 18 is removed, the code will compile and run.

B If line 20 is removed, the code will compile and run.

C The code compiles and runs, with output this 420 parent 420.

D An exception is thrown at runtime.

Q5:
public void foo( boolean a, boolean b)
{ 
    if( a ) 
    {
        System.out.println('A'); /* Line 5 */
    } 
    else if(a && b) /* Line 7 */
    { 
        System.out.println( 'A && B'); 
    } 
    else /* Line 11 */
    { 
        if ( !b ) 
        {
            System.out.println( 'notB') ;
        } 
        else 
        {
            System.out.println( 'ELSE' ) ; 
        } 
    } 
}

A
If a is true and b is false then the output is 'notB'

B If a is true and b is true then the output is 'A && B'

C If a is false and b is false then the output is 'ELSE'

D If a is false and b is true then the output is 'ELSE'

Q6:
switch(x) 
{ 
    default:  
        System.out.println('Hello'); 
}
Which two are acceptable types for x?
  1. byte
  2. long
  3. char
  4. float
  5. Short
  6. Long

A 4 and 6

B 1 and 3

C 2 and 4

D 3 and 5

Q7:
public void test(int x) 
{ 
    int odd = 1; 
    if(odd) /* Line 4 */
    {
        System.out.println('odd'); 
    } 
    else 
    {
        System.out.println('even'); 
    } 
}
Which statement is true?

A Compilation fails.

B "odd" will always be output.

C "even" will always be output.

D "odd" will be output for odd values of x, and "even" for even values.

Q8:
public void test(int x) 
{ 
    int odd = 1; 
    if(odd) /* Line 4 */
    {
        System.out.println('odd'); 
    } 
    else 
    {
        System.out.println('even'); 
    } 
}
Which statement is true?

A "odd" will always be output.

B "odd" will be output for odd values of x, and "even" for even values.

C "even" will always be output.

D Compilation fails.

Q9:
public class While 
{
    public void loop() 
    {
        int x= 0;
        while ( 1 ) /* Line 6 */
        {
            System.out.print('x plus one is ' + (x + 1)); /* Line 8 */
        }
    }
}
Which statement is true?

A There are syntax errors on lines 1 and 6.

B There is a syntax error on line 1.

C There are syntax errors on lines 1, 6, and 8.

D There is a syntax error on line 6.

Q10: What will be the output of the program?
int i = 1, j = -1; 
switch (i) 
{
    case 0, 1: j = 1; /* Line 4 */
    case 2: j = 2; 
    default: j = 0; 
} 
System.out.println('j = ' + j); 

A Compilation fails.

B j = -1

C j = 1

D j = 0