Placement Paper   Whole Testpaper   Chennai (Latest-2012) -

#### Placement Paper   Whole Testpaper   Chennai (Latest-2012) -

• Posted by  FreshersWorld
7 Jan, 2012

NESS

WRITTEN TEST

1. A container contains 40 litres of milk.From this container 4 litres of milk was taken out and replaced by water. This process was repeated further two times. How much milk is now contained by the container.

A.  26.34 litres            B.  27.36 liters

C.  28 litres                  D.  29.16 litres

2. Tea worth Rs. 126 per kg are mixed with a third variety in the ratio 1: 1 : 2. If the mixture is worth Rs. 153 per kg, the price of the third variety per kg will be

A.  Rs. 169.50             B.  Rs.1700

C.  Rs. 175.50            D.  Rs. 180

3. A milk vendor has 2 cans of milk.The first contains 25% water and the rest milk.The second contains 50% water. How much milk should he mix from each of the containers so as to get 12 litres of milk such that the ratio of water to milk is 3 : 5 ?

A.  4litres, 8 litres        B.  6litres, 6 litres

C.  5litres, 7 litres        D.  7litres, 4 litres

4.         Two vessels A and B contain spirit and water in the ratio 5 : 2 and 7 : 6 respectively. Find the ratio in which these mixture be mixed to obtain a new mixture in vessel C containing spirit and water in the ration 8 : 5 ?

A.  4 : 3           B.  3 : 4

C.  5 : 6           D.  7 : 9

5. A can contains a mixture of two liquids A and B in the ratio 7 : 5. When 9 litres of mixture are drawn off and the can is filled with B, the ratio of A and B becomes 7 : 9. How many litres of liquid A was contained by the can initially?

A.  10              B.  20

C.  21              D.  25

6. A rectangular parking space is marked out by painting three of its sides.If the length of the unpainted side is 9 feet, and the sum of the lengths of the painted sides is 37 feet, then what is the area of the parking space in square feet?

A.  46              B.  81

C.  126            D.  252 litres

7. The length of a rectangulat plot is 20 metres more than its breadth. If the cost of fencing the plot @ Rs. 26.50 per metre is Rs. 5300, what is the length of the plot in metres?

A.  40              B.   50

C.  200            D.  120

8. There are two sections A and B of a class, consisting of 36 and 44 students respectively. If the average weight of sections A is 40 kg and that of section b is 35 kg. Find the average weight of the whole class?

A.  36.25         B.  37.25

C.  38.35         D.  39.25

9 . A batsman makes a score of 87 runs in the 17th inning and thus increases his averages by 3.Find his average after 17th inning?

A.  19              B.  29

C.  39              D.  49

10.  The banker's discount on Rs. 1800 at 12% per annum is equal to the true discount on Rs.1872 for the same time at the same rate. Find the time?

A.  3 months               B.  4 months

C.  5 months                D.  6 months

11. The banker's gain on a bill due due 1 year hence at 12% per annum is Rs. 6. The true discount is

A.  Rs.72         B.  Rs.36

C.  Rs.54         D.  Rs.50

12. A boat can travel with a speed of 13 km / hr in still water. If the speed of the stream is 4 km / hr. find the time taken by the boat to go 68 km downstream?

A.  2 hours      B.  3 hours

C.  4 hours       D.  5 hours

13. The speed of a boat in still water is 15 km/hr and the rate of current is 3 km/hr. The distance travelled downstream in 12 minutes is

A.  1.2 km                   B.  1.8 km

C.  2.4 km                   D.  3.6 km

14. Today is Wednesday what will be the day after 94 days ?

A.  Monday                 B.  Tuesday

C.  Wednesday           D.  Sunday

15.  A clock is set at 5 a.m. The clock loses 16 minutes in 24 hours. What will be the true time when the clock indicates 10 p.m. on 4th day?

A.   9 p.m        B.   10 p.m

C.   11 p.m      D.   12 p.m

16. Find the compound interest on Rs.16,000 at 20% per annum for 9 months, compounded quartely.

A.  Rs. 2552                B.  Rs. 2512

C.  Rs. 2572                D.  Rs. 2592

17. The value of (4.7×13.26 + 4.7×9.43+4.7×77.31) is

A.  0.47           B.  47

C.  470            D.  4700

18. A ladder learning against a wall makes an angle of 60° with the ground. If the length of the ladder is 19 m, find the distance of the foot of the ladder from the wall.

A.   9 m           B.   9.5 m

C.  10.5 m       D.  12 m

19. The value of log343 7 is

A.  1/3             B.  - 3

C.  - 1/3           D.  3

20. In a division sum, the divisor is 10 times the quotient and 5 times the remainder. If the remainder is 46, the divident is

A.  4236          B.  4306

C.  4336          D.  5336

21. find the odd man out 1, 3, 7, 11, 15, 18, 21

A.   3               B.   7

C.   18                         D.   21

22. man started a business investing Rs. 70,000. Rakhi joined him after six months with an amount of Rs.. 1,05,000 and Sagar joined them with Rs. 1.4 lakhs after another six months. The amount of profit earned should be distributed in what ratio among Aman, Rakhi and Sagar respectively, 3 years after Aman started the business?

A.  7 : 6 : 10                B.  12 : 15 : 16

C.  42 : 45 : 56            D.  cannot be determined

23. When a commodity is sold for Rs.34.80, there is a loss of 2%. What is the cost price of the commodity?

A.  Rs. 26.10               B.  Rs.43

C.  Rs. 43.20               D.  Rs. 46.40

24. The ratio between the present ages of P and Q is 5 : 7 respectively. If the difference between Q's present age and P's age afler 6 years is 2, what is the total of P's and Q's present ages ?

A.  46 years                 B.  48 years

C.  52 years                 D.  56 years

25. How many 4-letter words with or without meaning, can be formed out of the letters of the word, 'LOGARITHMS', if repetition of letters is not allowed?

A.  40              B.  400

C.  5040          D.  2520

Directions to Solve(26-30)

Laws of nature are not commands but statements of acts. The use of the word "law" in this context is rather unfortunate. It would be better to speak of uniformities in nature. This would do away with the elementary fallacy that a law implies a law giver. If a piece of matter does not obey a law of nature it is punished. On the contrary, we say that the law has been incorrectly started.

26.  If a piece of matter violates nature's law, it is not punished because

A. it is not binding to obey it

B. there is no superior being to enforce the law of nature

C. it cannot be punished

D. it simply means that the facts have not been correctly stated by law

27.  Laws of nature differ from man-made laws because

A. the former state facts of Nature

B. they must be obeyed

C. they are natural

D. unlike human laws, they are systematic

28. The laws of nature based on observation are

A. conclusion about the nature of the universe.

B. true and unfalsifiable.

C. figments of the observer imagination.

D. subject to change in the light of new facts.

29. The author is not happy with word 'law' because

A. it connotes rigidity and harshness

B. it implies an agency which has made them

C. it does not convey the sense of nature's uniformity

D. it gives rise to false beliefs

Directions to Solve(30-34)

Each question consist of two words which have a certain relationship to each other followed by four pairs of related words, Select the pair which has the same relationship.

30.  WAN:COLOUR

A. corpulent: weight

B. insipid: flavour

C. pallid: complexion

D. enigmatic: puzzle

31.  PORK:PIG

A. rooster:chicken

B. mutton:sheep

C. steer:beef

D. obster:crustacean

32.  AFTER:BEFORE

A. first:second

B. present:past

C. contemporary:historic

D. successor:predecessor

33.  INDIGENT:WEALTHY

A. angry:rich

B. native:affluent

C. gauche:graceful

D. scholarly:erudite

34.  DISTANCE:MILE

A. liquid:litre

B. bushel:corn

C. weight:scale

D. fame:television

Directions to Solve(35-40)

Which of phrases given below each sentence should replace the phrase printed in bold type to make the grammatically correct? If the sentence is correct as it is, mark 'E' as the answer.

35.  The small child does whatever his father was done.

A. has done

B. did

C. does

E. No correction required

36.  You need not come unless you want to.

A. You don't need to come unless you want to

B. You come only when you want to

C. You come unless you don't want to

D. You needn't come until you don't want to

E. No correction required

37.  There are not many men who are so famous that they are frequently referred to by their short names only

A. initials

B. signatures

C. pictures

D. middle names

E. No correction required

38. The man to who I sold my house was a cheat.

A. to whom I sell

B. to who I sell

C. who was sold to

D. to whom I sold

E. No correction required

39.  They were all shocked at his failure in the competition.

A. were shocked at all

D. had been all shocked on

E. No correction required

40.  I need not offer any explanation regarding this incident - my behaviour is speaking itself.

A. will speak to itself

B. speaks for itself

C. has been speaking

E. No correction required

Directions to Solve(41-45)

In the questions below the sentences have been given in Active/Passive voice. From the given alternatives, choose the one which best expresses the given sentence in Passive/Active voice.

41.  You can play with these kittens quite safely.

A. These kittens can played with quite safely.

B. These kittens can play with you quite safely.

C. These kittens can be played with you quite safely.

D. These kittens can be played with quite safely.

42.  A child could not have done this mischief.

A. This mischief could not be done by a child.

B. This mischief could not been done by a child.

C. This mischief could not have been done by a child.

D. This mischief a child could not have been done.

43.  James Watt discovered the energy of steam.

A. The energy of steam discovered James Watt.

B. The energy of steam was discovered by James Watt.

C. James Watt was discovered by the energy of steam.

D. James Watt had discovered energy by the steam.

44.  She makes cakes every Sunday.

A. Every Sunday cakes made by her.

B. Cakes are made by her every Sunday.

C. Cakes make her every Sunday.

D. Cakes were made by her every Sunday.

45.  Could you buy some stamps for me?

A. Stamps should be bought.

B. You are requested to buy some stamps.

C. You are ordered to buy some stamps.

D. Stamps could be boug

Directions to Solve

In the questions below the sentences have been given in Direct/Indirect speech. From the given alternatives, choose the one which best expresses the given sentence in Indirect/Direct speech.

46.  The boy said, "Who dare call you a thief?"

A. The boy enquired who dared call him a thief.

B. The boy asked who called him a thief.

C. The boy told that who dared call him a thief.

D. The boy wondered who dared call a thief.

47.  She exclaimed with sorrow that was a very miserable plight.

A. She said with sorrow, "What a pity it is."

B. She said, "What a mystery it is."

C. She said, "What a miserable sight it is."

D. She said, "What a miserable plight it is."

48.  Dhruv said that he was sick and tired of working for that company.

A. Dhruv said, "I am sick and tired of working for this company."

B. Dhruv said, "He was tired of that company."

C. Dhruv said to me, "I am sick and tired of working for this company."

D. Dhruv said, "I will be tired of working for that company."

49.  "Are you alone, my son?" asked a soft voice close behind me.

A. A soft voice asked that what I was doing there alone.

B. A soft voice said to me are you alone son.

C. A soft voice from my back asked If I was alone.

D.A soft voice behind me asked If I was alone.

50.  She said to him, "Why don't you go today?"

A. She asked him why he did not go that day.

B. She said to him why he don't go that day.

C. She asked him not to go that day.

D. She asked him why he did not go today.

TECHNICAL

(C PROGRAMMING)

1. Identify which of the following are declarations

1 : extern int x;

2 : float square ( float x ) { ... }

3 : double pow(double, double);

A. 1

B. 2

C. 1 and 3

D. 3

2.  What will be the output of the program If the integer is 4bytes long?

#include<stdio.h>

int main()

{

int ***r, **q, *p, i=8;

p = &i;

q = &p;

r = &q;

printf("%d, %d, %d\n", *p, **q, ***r);

return 0;

}

A. 8, 8, 8

B. 4000, 4002, 4004

C. 4000, 4004, 4008

D. 4000, 4008, 40163.

3. What function should be used to free the memory allocated by calloc() ?

A. dealloc();

B. malloc(variable_name, 0)

C. free();

D. memalloc(variable_name, 0)

4. Point out the error in the program

#include<stdio.h>

int main()

{

int a=10;

void f();

a = f();

printf("%d\n", a);

return 0;

}

void f()

{

printf("Hi");

}

A. Error: Not allowed assignment

B. Error: Doesn't print anything

C. No error

D. None of above

5. What does the following declaration mean?

int (*ptr)[10];

A. ptr is array of pointers to 10 integers

B. ptr is a pointer to an array of 10 integers

C. ptr is an array of 10 integers

D. ptr is an pointer to array

6.  Point out the error in the program?

typedef struct data mystruct;

struct data

{

int x;

mystruct *b;

};

A. Error: in structure declaration

C. No Error

D. None of above

7. In the following code what is 'P'?

typedef char *charp;

const charp P;

A. P is a constant

B. P is a character constant

C. P is character type

D. None of above

8. Which of the following is the correct usage of conditional operators used in C?

A. a>b ? c=30 : c=40;

B. a>b ? c=30;

C. max = a>b ? a>c?a:c:b>c?b:c

D. return (a>b)?(a:b)

9. What will be the output of the program ?

#include<stdio.h>

int main()

{

char p[] = "%d\n";

p[1] = 'c';

printf(p, 65);

return 0;

}

A. A

B.a

C. c

D. 65

10. What will be the output of the program (myprog.c) given below if it is executed from the command line?

cmd> myprog one two three

/* myprog.c */

#include<stdio.h>

#include<stdlib.h>

int main(int argc, char **argv)

{

printf("%s\n", *++argv);

return 0;

}

A. myprog

B. one

C. two

D. three

(C++ PROGRAMMING)

11.  The comma operator (,) is primarily used in conjunction with

A. 'for' statement

B. 'if-else' statement

C. 'do-while' statement

D.All of the above

E. None of the above

12.  To execute a C++ program, you first need to translate the source code into object code. This process is called

A. coding

B. compiling

C. sourcing

D. translating

13.  The rules of a programming language are called its _____

A. code

B. guidelines

C. procedures

D. regulations

E. syntax

14.  An array element is accessed using

A. a first-in-first-out approach

B. the dot operator

C. a member name

D. an index number

15.  The program can access the private members of a class

A. directly

B. only through other private members of the class

C. only through other public members of the class

D. None of the above - the program cannot access the private members of a class in any way

16.  The #ifndef directive tests to see whether ________

A. a class has been defined

B. a variable has been given a value

C. a class has no variable definitions

D. any objects of the class have been instantiated

17.  Which of the following statements is false?

A. A function is a block of code that performs a specific task

B. Functions allow programmers to break large and complex problems into small and manageable tasks

C. Functions allow programmers to use existing code to perform common tasks

D. Functions can be called, or invoked, only once in a program

E. Programmer-defined functions can be either value-returning or void

18.  The generic type in a template function

A. must be T

B. can be T

C. cannot be T for functions you create, but may be for C++'s built-in functions

D. cannot be T

19.  When a child class function is called, the compiler looks first for a matching function name in the _____

A. class of the object using the function name

B. immediate ancestor class

C. base class

D. descendant class

20.  A function that is called automatically each time an object is destroyed is a

A. constructor

B. destructor

C. destroyer

D. terminator

21.  If no constructors can specified for a derived class, objects of the derived class will use the constructors in the base class

A. True

B. False

22.  The get() function returns _____

A. a character

B. void

C. a reference to the object that invoked it

D. a copy of the object that invoked it

23.  The most efficient data type for a variable that the number 20000 is the _____ data type

A. Character

B. Double

C. Float

D. Long Integer

E. Short Integer

24.  The number 5.5e3 is a _____ constant

A. character literal

B. named literal

C. numeric literal

D. string literal

25.  The compiler determines the type used in a template function via ___________

A. the name of the function

B. the first variable declared within the function

C. the type of the argument passed to the function

D. the type of the value returned from the function

( JAVA & J2EE)

26.  What will be the output of the program?

public class CommandArgsThree

{

public static void main(String [] args)

{

String [][] argCopy = new String[2][2];

int x;

argCopy[0] = args;

x = argCopy[0].length;

for (int y = 0; y < x; y++)

{

System.out.print(" " + argCopy[0][y]);

}

}

}

and the command-line invocation is

> java CommandArgsThree 1 2 3

A. 0 0

B. 1 2

C. 0 0 0

D. 1 2 3

27.  What will be the output of the program?

public class CommandArgs

{

public static void main(String [] args)

{

String s1 = args[1];

String s2 = args[2];

String s3 = args[3];

String s4 = args[4];

System.out.print(" args[2] = " + s2);

}

}

and the command-line invocation is

> java CommandArgs 1 2 3 4

A. args[2] = 2

B. args[2] = 3

C. args[2] = null

D. An exception is thrown at runtime.

28.       public class F0091

{

public void main( String[] args )

{

System.out.println( "Hello" + args[0] );

}

}

What will be the output of the program, if this code is executed with the command line:

> java F0091 world

A. Hello

B. Hello Foo91

C. Hello world

D. The code does not run.

29.  What will be the output of the program?

public class TestDogs

{

public static void main(String [] args)

{

Dog [ ][ ] theDogs = new Dog[3][ ];

System.out.println(theDogs[2][0].toString());

}

}

class Dog { }

A. null

B. the Dogs

C. Compilation fails

D. An exception is thrown at runtime

30.  What will be the output of the program ?

public class Test

{

public static void main(String [] args)

{

signed int x = 10;

for (int y=0; y<5; y++, x--)

System.out.print(x + ", ");

}

}

A. 10, 9, 8, 7, 6,

B. 9, 8, 7, 6, 5,

C. Compilation fails.

D. An exception is thrown at runtime

31. What will be the output of the program?

public class Test

{

public static void main (String[] args)

{

String foo = args[1];

String bar = args[2];

String baz = args[3];

System.out.println("baz = " + baz); /* Line 8 */

}

}

And the command line invocation:

> java Test red green blue

A. baz =

B. baz = null

C. baz = blue

D. Runtime Exception

32.  What will be the output of the program?

public class Test

{

public static void main (String args[])

{

String str = NULL;

System.out.println(str);

}

}

A. NULL

B. Compile Error

C. Code runs but no output

D. Runtime Exception

33.  What will be the output of the program?

package foo;

import java.util.Vector; /* Line 2 */

private class MyVector extends Vector

{

int i = 1; /* Line 5 */

public MyVector()

{

i = 2;

}

}

public class MyNewVector extends MyVector

{

public MyNewVector ()

{

i = 4; /* Line 15 */

}

public static void main (String args [])

{

MyVector v = new MyNewVector(); /* Line 19 */

}

}

A. Compilation will succeed.

B. Compilation will fail at line 3.

C. Compilation will fail at line 5.

D. Compilation will fail at line 15.

34.  What will be the output of the program?

public class Test

{

private static int[ ] x;

public static void main(String[ ] args)

{

System.out.println(x[0]);

}

}

A. 0

B. null

C. Compile Error

D. NullPointException at runtime

35.  What will be the output of the program?

import java.util.*;

class I

{

public static void main (String[] args)

{

Object i = new ArrayList().iterator();

System.out.print((i instanceof List)+",");

System.out.print((i instanceof Iterator)+",");

System.out.print(i instanceof ListIterator);

}

}

A. Prints: false, false, false

B. Prints: false, false, true

C. Prints: false, true, false

D. Prints: false, true, true

36. What is the value of "d" after this line of code has been executed?

double d = Math.round ( 2.5 + Math.random( ));

A. 2

B. 3

C. 4

D. 2.5

37.  Which of the following would compile without error?

A. int a = Math.abs(-5);

B. int b = Math.abs(5.0);

C. int c = Math.abs(5.5F);

D. int d = Math.abs(5L);

38.  Which of the following are valid calls to Math.max?

1. Math.max(1,4)

2. Math.max(2.3, 5)

3. Math.max(1, 3, 5, 7)

4. Math.max(-1.5, -2.8f)

A. 1, 2 and 4

B. 2, 3 and 4

C. 1, 2 and 3

D. 2, 3 and 4

39.       public class Myfile

{

public static void main (String[] args)

{

String biz = args[1];

String baz = args[2];

String rip = args[3];

System.out.println("Arg is " + rip);

}

}

Select how you would start the program to cause it to print: Arg is 2

A. java Myfile 222

B. java Myfile 1 2 2 3 4

C. java Myfile 1 3 2 2

D.java Myfile 0 1 2 3

40.       void start() {

A a = new A();

B b = new B();

a.s(b);

b = null; /* Line 5 */

a = null;  /* Line 6 */

System.out.println("start completed"); /* Line 7 */

}

When is the B object, created in line 3, eligible for garbage collection?

A. after line 5

B. after line 6

C. after line 7

D. There is no way to be absolutely certain.

41. What will be the output of the program?

class PassA

{

public static void main(String [] args)

{

PassA p = new PassA();

p.start();

}

void start()

{

long [] a1 = {3,4,5};

long [] a2 = fix(a1);

System.out.print(a1[0] + a1[1] + a1[2] + " ");

System.out.println(a2[0] + a2[1] + a2[2]);

}

long [ ] fix(long [ ] a3)

{

a3[1] = 7;

return a3;

}

}

A. 12 15

B. 15 15

C. 3 4 5 3 7 5

D. 3 7 5 3 7 5

42.  What will be the output of the program?

class Test

{

public static void main(String [] args)

{

Test p = new Test();

p.start();

}

void start()

{

boolean b1 = false;

boolean b2 = fix(b1);

System.out.println(b1 + " " + b2);

}

boolean fix(boolean b1)

{

b1 = true;

return b1;

}

}

A. true true

B. false true

C. true false

D. false false

43.  What will be the output of the program?

class PassS

{

public static void main(String [] args)

{

PassS p = new PassS();

p.start();

}

void start()

{

String s1 = "slip";

String s2 = fix(s1);

System.out.println(s1 + " " + s2);

}

String fix(String s1)

{

s1 = s1 + "stream";

System.out.print(s1 + " ");

return "stream";

}

}

A. slip stream

B. slipstream stream

C. stream slip stream

D. slipstream slip stream

44.  What will be the output of the program?

class BitShift

{

public static void main(String [] args)

{

int x = 0x80000000;

System.out.print(x + " and  ");

x = x >>> 31;

System.out.println(x);

}

}

A. -2147483648 and 1

B. 0x80000000 and 0x00000001

C. -2147483648 and -1

D. 1 and -2147483648

45.  What will be the output of the program?

class Equals

{

public static void main(String [] args)

{

int x = 100;

double y = 100.1;

boolean b = (x = y); /* Line 7 */

System.out.println(b);

}

}

A. true

B. false

C. Compilation fails

D. An exception is thrown at runtime

46. What is the name of the method used to start a thread execution?

A. init();

B. start();

C. run();

D. resume();

47.  Which two are valid constructors for Thread?

A. 1 and 3

B. 2 and 4

C. 1 and 2

D. 2 and 5

48.  Which three are methods of the Object class?

1. notify();

2. notifyAll();

3. isInterrupted();

4. synchronized();

5. interrupt();

6. wait(long msecs);

7. sleep(long msecs);

8. yield();

A. 1, 2, 4

B. 2, 4, 5

C. 1, 2, 6

D. 2, 3, 4

49.       class X implements Runnable

{

public static void main(String args[])

{

/* Missing code? */

}

public void run() {}

}

Which of the following line of code is suitable to start a thread ?

C. X run = new X(); Thread t = new Thread(run); t.start();

50.  Which cannot directly cause a thread to stop executing?

A. Calling the SetPriority() method on a Thread object.

B. Calling the wait() method on an object.

C. Calling notify() method on an object.

D. Calling read() method on an InputStream object.

51.       void start() {

A a = new A();

B b = new B();

a.s(b);

b = null; /* Line 5 */

a = null;  /* Line 6 */

System.out.println("start completed"); /* Line 7 */

}

When is the B object, created in line 3, eligible for garbage collection?

A. after line 5

B. after line 6

C. after line 7

D. There is no way to be absolutely certain.

52.  class HappyGarbage01

{

public static void main(String args[])

{

HappyGarbage01 h = new HappyGarbage01();

h.methodA(); /* Line 6 */

}

Object methodA()

{

Object obj1 = new Object();

Object [] obj2 = new Object[1];

obj2[0] = obj1;

obj1 = null;

return obj2[0];

}

}

Where will be the most chance of the garbage collector being invoked?

A. After line 9

B. After line 10

C. After line 11

D. Garbage collector never invoked in methodA()

53.       class Bar { }

class Test

Bar doBar()

{

Bar b = new Bar(); /* Line 6 */

return b; /* Line 7 */

}

public static void main (String args[])

{

Test t = new Test();  /* Line 11 */

Bar newBar = t.doBar();  /* Line 12 */

System.out.println("newBar");

newBar = new Bar(); /* Line 14 */

System.out.println("finishing"); /* Line 15 */

}

}

At what point is the Bar object, created on line 6, eligible for garbage collection?

A. after line 12

B. after line 14

C. after line 7, when doBar() completes

D. after line 15, when main() completes

54.       class Test

private Demo d;

void start()

{

d = new Demo();

this.takeDemo(d); /* Line 7 */

} /* Line 8 */

void takeDemo(Demo demo)

{

demo = null;

demo = new Demo();

}

}

When is the Demo object eligible for garbage collection?

A. After line 7

B. After line 8

C. After the start() method completes

D. When the instance running this code is made eligible for garbage collection.

55.       public class X

{

public static void main(String [] args)

{

X x = new X();

X x2 = m1(x); /* Line 6 */

X x4 = new X();

x2 = x4; /* Line 8 */

doComplexStuff();

}

static X m1(X mx)

{

mx = new X();

return mx;

}

}

After line 8 runs. how many objects are eligible for garbage collection?

A. 0

B. 1

C. 2

D. 3

56.       public class Test2

{

public static int x;

public static int foo(int y)

{

return y * 2;

}

public static void main(String [] args)

{

int z = 5;

assert z > 0; /* Line 11 */

assert z > 2: foo(z); /* Line 12 */

if ( z < 7 )

assert z > 4; /* Line 14 */

switch (z)

{

case 4: System.out.println("4 ");

case 5: System.out.println("5 ");

default: assert z < 10;

}

if ( z < 10 )

assert z > 4: z++; /* Line 22 */

System.out.println(z);

}

}

which line is an example of an inappropriate use of assertions?

A. Line 11

B. Line 12

C. Line 14

D. Line 22

57.       public class Test

{

public void foo()

{

assert false; /* Line 5 */

assert false; /* Line 6 */

}

public void bar()

{

while(true)

{

assert false; /* Line 12 */

}

assert false;  /* Line 14 */

}

}

What causes compilation to fail?

A. Line 5

B. Line 6

C. Line 12

D. Line 14

58.  What will be the output of the program?

public class Test

{

public static void main(String[] args)

{

final StringBuffer a = new StringBuffer();

final StringBuffer b = new StringBuffer();

{

public void run()

{

System.out.print(a.append("A"));

synchronized(b)

{

System.out.print(b.append("B"));

}

}

}.start();

{

public void run()

{

System.out.print(b.append("C"));

synchronized(a)

{

System.out.print(a.append("D"));

}

}

}.start();

}

}

C. CDDACB

D. Indeterminate output

59.  What will be the output of the program?

String s = "hello";

Object o = s;

if( o.equals(s) )

{

System.out.println("A");

}

else

{

System.out.println("B");

}

if( s.equals(o) )

{

System.out.println("C");

}

else

{

System.out.println("D");

}

1. A

2. B

3. C

4. D

A. 1 and 3

B. 2 and 4

C. 3 and 4

D. 1 and 2

60.  What will be the output of the program (in jdk1.6 or above)?

public class BoolTest

{

public static void main(String [] args)

{

Boolean b1 = new Boolean("false");

boolean b2;

b2 = b1.booleanValue();

if (!b2)

{

b2 = true;

System.out.print("x ");

}

if (b1 & b2) /* Line 13 */

{

System.out.print("y ");

}

System.out.println("z");

}

}

A. z

B. x z

C. y z

D. Compilation fails.

61.       class A

{

A( ) { }

}

class B extends A

{ }

Which statement is true?

A. Class B'S constructor is public.

B. Class B'S constructor has no arguments.

C. Class B'S constructor includes a call to this( ).

D. None of these.

62.       interface DoMath

{

}

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. 1 only

B. 2 only

C. 3 and 5

D. 1 and 4

63.  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 3

B. 2 and 4

C. 1 and 5

D. 2 and 6

64.       /* 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. 2 and 5

C. 3 and 4

D. 3 and 4

65.  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. 1, 2 and 4

B. 2, 3 and 5

C. 3, 4 and 5

D. 1, 2 and 3

66.  What will be the output of the program?

public class Foo

public static void main(String[] args)

{

try

{

return;

}

finally

{

System.out.println( "Finally" );

}

}

}

A. Finally

B. Compilation fails.

C. The code runs with no output.

D. An exception is thrown at runtime.

67.  What will be the output of the program?

try

{

int x = 0;

int y = 5 / x;

}

catch (Exception e)

{

System.out.println("Exception");

}

catch (ArithmeticException ae)

{

System.out.println(" Arithmetic Exception");

}

System.out.println("finished");

A. finished

B. Exception

C. Compilation fails.

D. Arithmetic Exception

68.  What will be the output of the program?

public class X

public static void main(String [] args)

{

try

{

System.out.print("A");

}

catch (Exception ex)

{

System.out.print("B");

}

finally

{

System.out.print("C");

}

System.out.print("D");

}

{

throw new Error(); /* Line 22 */

}

}

A. ABCD

B. Compilation fails.

C. C is printed before exiting with an error message.

D. BC is printed before exiting with an error message.

69.  What will be the output of the program?

public class X

public static void main(String [] args)

{

try

{

System.out.print("A");

}

catch (RuntimeException ex) /* Line 10 */

{

System.out.print("B");

}

catch (Exception ex1)

{

System.out.print("C");

}

finally

{

System.out.print("D");

}

System.out.print("E");

}

{

throw new RuntimeException();

}

}

A. BD

B. BCD

C. BDE

D. BCDE

70.  What will be the output of the program?

public class RTExcept

{

public static void throwit ()

{

System.out.print("throwit ");

throw new RuntimeException();

}

public static void main(String [] args)

{

try

{

System.out.print("hello ");

throwit();

}

catch (Exception re )

{

System.out.print("caught ");

}

finally

{

System.out.print("finally ");

}

System.out.println("after ");

}

}

A. hello throwit caught

B. Compilation fails

C. hello throwit Runtime Exception caught after

D. hello throwit caught finally after

71.  What will be the output of the program?

public class Test

public static void aMethod() throws Exception

{

try /* Line 5 */

{

throw new Exception(); /* Line 7 */

}

finally /* Line 9 */

{

System.out.print("finally "); /* Line 11 */

}

}

public static void main(String args[])

{

try

{

aMethod();

}

catch (Exception e) /* Line 20 */

{

System.out.print("exception ");

}

System.out.print("finished"); /* Line 24 */

}

}

A. finally

B. exception finished

C. finally exception finished

D. Compilation fails

72.  What will be the output of the program?

public class X

{

public static void main(String [] args)

{

try

{

System.out.print("A");

}

catch (Exception ex)

{

System.out.print("B");

}

finally

{

System.out.print("C");

}

System.out.print("D");

}

}

A. AC

B. BC

C. ACD

D. ABCD

73.  What will be the output of the program?

public class X

public static void main(String [] args)

{

try

{

System.out.print("A");

}

catch (Exception ex) /* Line 10 */

{

System.out.print("B"); /* Line 12 */

}

finally /* Line 14 */

{

System.out.print("C"); /* Line 16 */

}

System.out.print("D"); /* Line 18 */

}

{

throw new RuntimeException();

}

}

A. AB

B. BC

C. ABC

D.BCD

74.  What will be the output of the program?

public class MyProgram

{

public static void main(String args[])

{

try

{

System.out.print("Hello world ");

}

finally

{

System.out.println("Finally executing ");

}

}

}

A. Nothing. The program will not compile because no exceptions are specified.

B. Nothing. The program will not compile because no catch clauses are specified.

C. Hello world.

D. Hello world Finally executing

75.  What will be the output of the program?

class Exc0 extends Exception { }

class Exc1 extends Exc0 { } /* Line 2 */

public class Test

public static void main(String args[])

{

try

{

throw new Exc1(); /* Line 9 */

}

catch (Exc0 e0) /* Line 11 */

{

System.out.println("Ex0 caught");

}

catch (Exception e)

{

System.out.println("exception caught");

}

}

}

A. Ex0 caught

B. exception caught

C. Compilation fails because of an error at line 2.

D. Compilation fails because of an error at line 9

Ans : A

NESS

WRITTEN TEST

1. A container contains 40 litres of milk.From this container 4 litres of milk was taken out and replaced by water. This process was repeated further two times. How much milk is now contained by the container.

A.  26.34 litres            B.  27.36 liters

C.  28 litres                  D.  29.16 litres

2. Tea worth Rs. 126 per kg are mixed with a third variety in the ratio 1: 1 : 2. If the mixture is worth Rs. 153 per kg, the price of the third variety per kg will be

A.  Rs. 169.50             B.  Rs.1700

C.  Rs. 175.50            D.  Rs. 180

3. A milk vendor has 2 cans of milk.The first contains 25% water and the rest milk.The second contains 50% water. How much milk should he mix from each of the containers so as to get 12 litres of milk such that the ratio of water to milk is 3 : 5 ?

A.  4litres, 8 litres        B.  6litres, 6 litres

C.  5litres, 7 litres        D.  7litres, 4 litres

4.         Two vessels A and B contain spirit and water in the ratio 5 : 2 and 7 : 6 respectively. Find the ratio in which these mixture be mixed to obtain a new mixture in vessel C containing spirit and water in the ration 8 : 5 ?

A.  4 : 3           B.  3 : 4

C.  5 : 6           D.  7 : 9

5. A can contains a mixture of two liquids A and B in the ratio 7 : 5. When 9 litres of mixture are drawn off and the can is filled with B, the ratio of A and B becomes 7 : 9. How many litres of liquid A was contained by the can initially?

A.  10              B.  20

C.  21              D.  25

6. A rectangular parking space is marked out by painting three of its sides.If the length of the unpainted side is 9 feet, and the sum of the lengths of the painted sides is 37 feet, then what is the area of the parking space in square feet?

A.  46              B.  81

C.  126            D.  252 litres

7. The length of a rectangulat plot is 20 metres more than its breadth. If the cost of fencing the plot @ Rs. 26.50 per metre is Rs. 5300, what is the length of the plot in metres?

A.  40              B.   50

C.  200            D.  120

8. There are two sections A and B of a class, consisting of 36 and 44 students respectively. If the average weight of sections A is 40 kg and that of section b is 35 kg. Find the average weight of the whole class?

A.  36.25         B.  37.25

C.  38.35         D.  39.25

9 . A batsman makes a score of 87 runs in the 17th inning and thus increases his averages by 3.Find his average after 17th inning?

A.  19              B.  29

C.  39              D.  49

10.  The banker's discount on Rs. 1800 at 12% per annum is equal to the true discount on Rs.1872 for the same time at the same rate. Find the time?

A.  3 months               B.  4 months

C.  5 months                D.  6 months

11. The banker's gain on a bill due due 1 year hence at 12% per annum is Rs. 6. The true discount is

A.  Rs.72         B.  Rs.36

C.  Rs.54         D.  Rs.50

12. A boat can travel with a speed of 13 km / hr in still water. If the speed of the stream is 4 km / hr. find the time taken by the boat to go 68 km downstream?

A.  2 hours      B.  3 hours

C.  4 hours       D.  5 hours

13. The speed of a boat in still water is 15 km/hr and the rate of current is 3 km/hr. The distance travelled downstream in 12 minutes is

A.  1.2 km                   B.  1.8 km

C.  2.4 km                   D.  3.6 km

14. Today is Wednesday what will be the day after 94 days ?

A.  Monday                 B.  Tuesday

C.  Wednesday           D.  Sunday

15.  A clock is set at 5 a.m. The clock loses 16 minutes in 24 hours. What will be the true time when the clock indicates 10 p.m. on 4th day?

A.   9 p.m        B.   10 p.m

C.   11 p.m      D.   12 p.m

16. Find the compound interest on Rs.16,000 at 20% per annum for 9 months, compounded quartely.

A.  Rs. 2552                B.  Rs. 2512

C.  Rs. 2572                D.  Rs. 2592

17. The value of (4.7×13.26 + 4.7×9.43+4.7×77.31) is

A.  0.47           B.  47

C.  470            D.  4700

18. A ladder learning against a wall makes an angle of 60° with the ground. If the length of the ladder is 19 m, find the distance of the foot of the ladder from the wall.

A.   9 m           B.   9.5 m

C.  10.5 m       D.  12 m

19. The value of log343 7 is

A.  1/3             B.  - 3

C.  - 1/3           D.  3

20. In a division sum, the divisor is 10 times the quotient and 5 times the remainder. If the remainder is 46, the divident is

A.  4236          B.  4306

C.  4336          D.  5336

21. find the odd man out 1, 3, 7, 11, 15, 18, 21

A.   3               B.   7

C.   18                         D.   21

22. man started a business investing Rs. 70,000. Rakhi joined him after six months with an amount of Rs.. 1,05,000 and Sagar joined them with Rs. 1.4 lakhs after another six months. The amount of profit earned should be distributed in what ratio among Aman, Rakhi and Sagar respectively, 3 years after Aman started the business?

A.  7 : 6 : 10                B.  12 : 15 : 16

C.  42 : 45 : 56            D.  cannot be determined

23. When a commodity is sold for Rs.34.80, there is a loss of 2%. What is the cost price of the commodity?

A.  Rs. 26.10               B.  Rs.43

C.  Rs. 43.20               D.  Rs. 46.40

24. The ratio between the present ages of P and Q is 5 : 7 respectively. If the difference between Q's present age and P's age afler 6 years is 2, what is the total of P's and Q's present ages ?

A.  46 years                 B.  48 years

C.  52 years                 D.  56 years

25. How many 4-letter words with or without meaning, can be formed out of the letters of the word, 'LOGARITHMS', if repetition of letters is not allowed?

A.  40              B.  400

C.  5040          D.  2520

Directions to Solve(26-30)

Laws of nature are not commands but statements of acts. The use of the word "law" in this context is rather unfortunate. It would be better to speak of uniformities in nature. This would do away with the elementary fallacy that a law implies a law giver. If a piece of matter does not obey a law of nature it is punished. On the contrary, we say that the law has been incorrectly started.

26.  If a piece of matter violates nature's law, it is not punished because

A. it is not binding to obey it

B. there is no superior being to enforce the law of nature

C. it cannot be punished

D. it simply means that the facts have not been correctly stated by law

27.  Laws of nature differ from man-made laws because

A. the former state facts of Nature

B. they must be obeyed

C. they are natural

D. unlike human laws, they are systematic

28. The laws of nature based on observation are

A. conclusion about the nature of the universe.

B. true and unfalsifiable.

C. figments of the observer imagination.

D. subject to change in the light of new facts.

29. The author is not happy with word 'law' because

A. it connotes rigidity and harshness

B. it implies an agency which has made them

C. it does not convey the sense of nature's uniformity

D. it gives rise to false beliefs

Directions to Solve(30-34)

Each question consist of two words which have a certain relationship to each other followed by four pairs of related words, Select the pair which has the same relationship.

30.  WAN:COLOUR

A. corpulent: weight

B. insipid: flavour

C. pallid: complexion

D. enigmatic: puzzle

31.  PORK:PIG

A. rooster:chicken

B. mutton:sheep

C. steer:beef

D. obster:crustacean

32.  AFTER:BEFORE

A. first:second

B. present:past

C. contemporary:historic

D. successor:predecessor

33.  INDIGENT:WEALTHY

A. angry:rich

B. native:affluent

C. gauche:graceful

D. scholarly:erudite

34.  DISTANCE:MILE

A. liquid:litre

B. bushel:corn

C. weight:scale

D. fame:television

Directions to Solve(35-40)

Which of phrases given below each sentence should replace the phrase printed in bold type to make the grammatically correct? If the sentence is correct as it is, mark 'E' as the answer.

35.  The small child does whatever his father was done.

A. has done

B. did

C. does

E. No correction required

36.  You need not come unless you want to.

A. You don't need to come unless you want to

B. You come only when you want to

C. You come unless you don't want to

D. You needn't come until you don't want to

E. No correction required

37.  There are not many men who are so famous that they are frequently referred to by their short names only

A. initials

B. signatures

C. pictures

D. middle names

E. No correction required

38. The man to who I sold my house was a cheat.

A. to whom I sell

B. to who I sell

C. who was sold to

D. to whom I sold

E. No correction required

39.  They were all shocked at his failure in the competition.

A. were shocked at all

D. had been all shocked on

E. No correction required

40.  I need not offer any explanation regarding this incident - my behaviour is speaking itself.

A. will speak to itself

B. speaks for itself

C. has been speaking

E. No correction required

Directions to Solve(41-45)

In the questions below the sentences have been given in Active/Passive voice. From the given alternatives, choose the one which best expresses the given sentence in Passive/Active voice.

41.  You can play with these kittens quite safely.

A. These kittens can played with quite safely.

B. These kittens can play with you quite safely.

C. These kittens can be played with you quite safely.

D. These kittens can be played with quite safely.

42.  A child could not have done this mischief.

A. This mischief could not be done by a child.

B. This mischief could not been done by a child.

C. This mischief could not have been done by a child.

D. This mischief a child could not have been done.

43.  James Watt discovered the energy of steam.

A. The energy of steam discovered James Watt.

B. The energy of steam was discovered by James Watt.

C. James Watt was discovered by the energy of steam.

D. James Watt had discovered energy by the steam.

44.  She makes cakes every Sunday.

A. Every Sunday cakes made by her.

B. Cakes are made by her every Sunday.

C. Cakes make her every Sunday.

D. Cakes were made by her every Sunday.

45.  Could you buy some stamps for me?

A. Stamps should be bought.

B. You are requested to buy some stamps.

C. You are ordered to buy some stamps.

D. Stamps could be boug

Directions to Solve

In the questions below the sentences have been given in Direct/Indirect speech. From the given alternatives, choose the one which best expresses the given sentence in Indirect/Direct speech.

46.  The boy said, "Who dare call you a thief?"

A. The boy enquired who dared call him a thief.

B. The boy asked who called him a thief.

C. The boy told that who dared call him a thief.

D. The boy wondered who dared call a thief.

47.  She exclaimed with sorrow that was a very miserable plight.

A. She said with sorrow, "What a pity it is."

B. She said, "What a mystery it is."

C. She said, "What a miserable sight it is."

D. She said, "What a miserable plight it is."

48.  Dhruv said that he was sick and tired of working for that company.

A. Dhruv said, "I am sick and tired of working for this company."

B. Dhruv said, "He was tired of that company."

C. Dhruv said to me, "I am sick and tired of working for this company."

D. Dhruv said, "I will be tired of working for that company."

49.  "Are you alone, my son?" asked a soft voice close behind me.

A. A soft voice asked that what I was doing there alone.

B. A soft voice said to me are you alone son.

C. A soft voice from my back asked If I was alone.

D.A soft voice behind me asked If I was alone.

50.  She said to him, "Why don't you go today?"

A. She asked him why he did not go that day.

B. She said to him why he don't go that day.

C. She asked him not to go that day.

D. She asked him why he did not go today.

TECHNICAL

(C PROGRAMMING)

1. Identify which of the following are declarations

1 : extern int x;

2 : float square ( float x ) { ... }

3 : double pow(double, double);

A. 1

B. 2

C. 1 and 3

D. 3

2.  What will be the output of the program If the integer is 4bytes long?

#include<stdio.h>

int main()

{

int ***r, **q, *p, i=8;

p = &i;

q = &p;

r = &q;

printf("%d, %d, %d\n", *p, **q, ***r);

return 0;

}

A. 8, 8, 8

B. 4000, 4002, 4004

C. 4000, 4004, 4008

D. 4000, 4008, 40163.

3. What function should be used to free the memory allocated by calloc() ?

A. dealloc();

B. malloc(variable_name, 0)

C. free();

D. memalloc(variable_name, 0)

4. Point out the error in the program

#include<stdio.h>

int main()

{

int a=10;

void f();

a = f();

printf("%d\n", a);

return 0;

}

void f()

{

printf("Hi");

}

A. Error: Not allowed assignment

B. Error: Doesn't print anything

C. No error

D. None of above

5. What does the following declaration mean?

int (*ptr)[10];

A. ptr is array of pointers to 10 integers

B. ptr is a pointer to an array of 10 integers

C. ptr is an array of 10 integers

D. ptr is an pointer to array

6.  Point out the error in the program?

typedef struct data mystruct;

struct data

{

int x;

mystruct *b;

};

A. Error: in structure declaration

C. No Error

D. None of above

7. In the following code what is 'P'?

typedef char *charp;

const charp P;

A. P is a constant

B. P is a character constant

C. P is character type

D. None of above

8. Which of the following is the correct usage of conditional operators used in C?

A. a>b ? c=30 : c=40;

B. a>b ? c=30;

C. max = a>b ? a>c?a:c:b>c?b:c

D. return (a>b)?(a:b)

9. What will be the output of the program ?

#include<stdio.h>

int main()

{

char p[] = "%d\n";

p[1] = 'c';

printf(p, 65);

return 0;

}

A. A

B.a

C. c

D. 65

10. What will be the output of the program (myprog.c) given below if it is executed from the command line?

cmd> myprog one two three

/* myprog.c */

#include<stdio.h>

#include<stdlib.h>

int main(int argc, char **argv)

{

printf("%s\n", *++argv);

return 0;

}

A. myprog

B. one

C. two

D. three

(C++ PROGRAMMING)

11.  The comma operator (,) is primarily used in conjunction with

A. 'for' statement

B. 'if-else' statement

C. 'do-while' statement

D.All of the above

E. None of the above

12.  To execute a C++ program, you first need to translate the source code into object code. This process is called

A. coding

B. compiling

C. sourcing

D. translating

13.  The rules of a programming language are called its _____

A. code

B. guidelines

C. procedures

D. regulations

E. syntax

14.  An array element is accessed using

A. a first-in-first-out approach

B. the dot operator

C. a member name

D. an index number

15.  The program can access the private members of a class

A. directly

B. only through other private members of the class

C. only through other public members of the class

D. None of the above - the program cannot access the private members of a class in any way

16.  The #ifndef directive tests to see whether ________

A. a class has been defined

B. a variable has been given a value

C. a class has no variable definitions

D. any objects of the class have been instantiated

17.  Which of the following statements is false?

A. A function is a block of code that performs a specific task

B. Functions allow programmers to break large and complex problems into small and manageable tasks

C. Functions allow programmers to use existing code to perform common tasks

D. Functions can be called, or invoked, only once in a program

E. Programmer-defined functions can be either value-returning or void

18.  The generic type in a template function

A. must be T

B. can be T

C. cannot be T for functions you create, but may be for C++'s built-in functions

D. cannot be T

19.  When a child class function is called, the compiler looks first for a matching function name in the _____

A. class of the object using the function name

B. immediate ancestor class

C. base class

D. descendant class

20.  A function that is called automatically each time an object is destroyed is a

A. constructor

B. destructor

C. destroyer

D. terminator

21.  If no constructors can specified for a derived class, objects of the derived class will use the constructors in the base class

A. True

B. False

22.  The get() function returns _____

A. a character

B. void

C. a reference to the object that invoked it

D. a copy of the object that invoked it

23.  The most efficient data type for a variable that the number 20000 is the _____ data type

A. Character

B. Double

C. Float

D. Long Integer

E. Short Integer

24.  The number 5.5e3 is a _____ constant

A. character literal

B. named literal

C. numeric literal

D. string literal

25.  The compiler determines the type used in a template function via ___________

A. the name of the function

B. the first variable declared within the function

C. the type of the argument passed to the function

D. the type of the value returned from the function

( JAVA & J2EE)

26.  What will be the output of the program?

public class CommandArgsThree

{

public static void main(String [] args)

{

String [][] argCopy = new String[2][2];

int x;

argCopy[0] = args;

x = argCopy[0].length;

for (int y = 0; y < x; y++)

{

System.out.print(" " + argCopy[0][y]);

}

}

}

and the command-line invocation is

> java CommandArgsThree 1 2 3

A. 0 0

B. 1 2

C. 0 0 0

D. 1 2 3

27.  What will be the output of the program?

public class CommandArgs

{

public static void main(String [] args)

{

String s1 = args[1];

String s2 = args[2];

String s3 = args[3];

String s4 = args[4];

System.out.print(" args[2] = " + s2);

}

}

and the command-line invocation is

> java CommandArgs 1 2 3 4

A. args[2] = 2

B. args[2] = 3

C. args[2] = null

D. An exception is thrown at runtime.

28.       public class F0091

{

public void main( String[] args )

{

System.out.println( "Hello" + args[0] );

}

}

What will be the output of the program, if this code is executed with the command line:

> java F0091 world

A. Hello

B. Hello Foo91

C. Hello world

D. The code does not run.

29.  What will be the output of the program?

public class TestDogs

{

public static void main(String [] args)

{

Dog [ ][ ] theDogs = new Dog[3][ ];

System.out.println(theDogs[2][0].toString());

}

}

class Dog { }

A. null

B. the Dogs

C. Compilation fails

D. An exception is thrown at runtime

30.  What will be the output of the program ?

public class Test

{

public static void main(String [] args)

{

signed int x = 10;

for (int y=0; y<5; y++, x--)

System.out.print(x + ", ");

}

}

A. 10, 9, 8, 7, 6,

B. 9, 8, 7, 6, 5,

C. Compilation fails.

D. An exception is thrown at runtime

31. What will be the output of the program?

public class Test

{

public static void main (String[] args)

{

String foo = args[1];

String bar = args[2];

String baz = args[3];

System.out.println("baz = " + baz); /* Line 8 */

}

}

And the command line invocation:

> java Test red green blue

A. baz =

B. baz = null

C. baz = blue

D. Runtime Exception

32.  What will be the output of the program?

public class Test

{

public static void main (String args[])

{

String str = NULL;

System.out.println(str);

}

}

A. NULL

B. Compile Error

C. Code runs but no output

D. Runtime Exception

33.  What will be the output of the program?

package foo;

import java.util.Vector; /* Line 2 */

private class MyVector extends Vector

{

int i = 1; /* Line 5 */

public MyVector()

{

i = 2;

}

}

public class MyNewVector extends MyVector

{

public MyNewVector ()

{

i = 4; /* Line 15 */

}

public static void main (String args [])

{

MyVector v = new MyNewVector(); /* Line 19 */

}

}

A. Compilation will succeed.

B. Compilation will fail at line 3.

C. Compilation will fail at line 5.

D. Compilation will fail at line 15.

34.  What will be the output of the program?

public class Test

{

private static int[ ] x;

public static void main(String[ ] args)

{

System.out.println(x[0]);

}

}

A. 0

B. null

C. Compile Error

D. NullPointException at runtime

35.  What will be the output of the program?

import java.util.*;

class I

{

public static void main (String[] args)

{

Object i = new ArrayList().iterator();

System.out.print((i instanceof List)+",");

System.out.print((i instanceof Iterator)+",");

System.out.print(i instanceof ListIterator);

}

}

A. Prints: false, false, false

B. Prints: false, false, true

C. Prints: false, true, false

D. Prints: false, true, true

36. What is the value of "d" after this line of code has been executed?

double d = Math.round ( 2.5 + Math.random( ));

A. 2

B. 3

C. 4

D. 2.5

37.  Which of the following would compile without error?

A. int a = Math.abs(-5);

B. int b = Math.abs(5.0);

C. int c = Math.abs(5.5F);

D. int d = Math.abs(5L);

38.  Which of the following are valid calls to Math.max?

1. Math.max(1,4)

2. Math.max(2.3, 5)

3. Math.max(1, 3, 5, 7)

4. Math.max(-1.5, -2.8f)

A. 1, 2 and 4

B. 2, 3 and 4

C. 1, 2 and 3

D. 2, 3 and 4

39.       public class Myfile

{

public static void main (String[] args)

{

String biz = args[1];

String baz = args[2];

String rip = args[3];

System.out.println("Arg is " + rip);

}

}

Select how you would start the program to cause it to print: Arg is 2

A. java Myfile 222

B. java Myfile 1 2 2 3 4

C. java Myfile 1 3 2 2

D.java Myfile 0 1 2 3

40.       void start() {

A a = new A();

B b = new B();

a.s(b);

b = null; /* Line 5 */

a = null;  /* Line 6 */

System.out.println("start completed"); /* Line 7 */

}

When is the B object, created in line 3, eligible for garbage collection?

A. after line 5

B. after line 6

C. after line 7

D. There is no way to be absolutely certain.

41. What will be the output of the program?

class PassA

{

public static void main(String [] args)

{

PassA p = new PassA();

p.start();

}

void start()

{

long [] a1 = {3,4,5};

long [] a2 = fix(a1);

System.out.print(a1[0] + a1[1] + a1[2] + " ");

System.out.println(a2[0] + a2[1] + a2[2]);

}

long [ ] fix(long [ ] a3)

{

a3[1] = 7;

return a3;

}

}

A. 12 15

B. 15 15

C. 3 4 5 3 7 5

D. 3 7 5 3 7 5

42.  What will be the output of the program?

class Test

{

public static void main(String [] args)

{

Test p = new Test();

p.start();

}

void start()

{

boolean b1 = false;

boolean b2 = fix(b1);

System.out.println(b1 + " " + b2);

}

boolean fix(boolean b1)

{

b1 = true;

return b1;

}

}

A. true true

B. false true

C. true false

D. false false

43.  What will be the output of the program?

class PassS

{

public static void main(String [] args)

{

PassS p = new PassS();

p.start();

}

void start()

{

String s1 = "slip";

String s2 = fix(s1);

System.out.println(s1 + " " + s2);

}

String fix(String s1)

{

s1 = s1 + "stream";

System.out.print(s1 + " ");

return "stream";

}

}

A. slip stream

B. slipstream stream

C. stream slip stream

D. slipstream slip stream

44.  What will be the output of the program?

class BitShift

{

public static void main(String [] args)

{

int x = 0x80000000;

System.out.print(x + " and  ");

x = x >>> 31;

System.out.println(x);

}

}

A. -2147483648 and 1

B. 0x80000000 and 0x00000001

C. -2147483648 and -1

D. 1 and -2147483648

45.  What will be the output of the program?

class Equals

{

public static void main(String [] args)

{

int x = 100;

double y = 100.1;

boolean b = (x = y); /* Line 7 */

System.out.println(b);

}

}

A. true

B. false

C. Compilation fails

D. An exception is thrown at runtime

46. What is the name of the method used to start a thread execution?

A. init();

B. start();

C. run();

D. resume();

47.  Which two are valid constructors for Thread?

A. 1 and 3

B. 2 and 4

C. 1 and 2

D. 2 and 5

48.  Which three are methods of the Object class?

1. notify();

2. notifyAll();

3. isInterrupted();

4. synchronized();

5. interrupt();

6. wait(long msecs);

7. sleep(long msecs);

8. yield();

A. 1, 2, 4

B. 2, 4, 5

C. 1, 2, 6

D. 2, 3, 4

49.       class X implements Runnable

{

public static void main(String args[])

{

/* Missing code? */

}

public void run() {}

}

Which of the following line of code is suitable to start a thread ?

C. X run = new X(); Thread t = new Thread(run); t.start();

50.  Which cannot directly cause a thread to stop executing?

A. Calling the SetPriority() method on a Thread object.

B. Calling the wait() method on an object.

C. Calling notify() method on an object.

D. Calling read() method on an InputStream object.

51.       void start() {

A a = new A();

B b = new B();

a.s(b);

b = null; /* Line 5 */

a = null;  /* Line 6 */

System.out.println("start completed"); /* Line 7 */

}

When is the B object, created in line 3, eligible for garbage collection?

A. after line 5

B. after line 6

C. after line 7

D. There is no way to be absolutely certain.

52.  class HappyGarbage01

{

public static void main(String args[])

{

HappyGarbage01 h = new HappyGarbage01();

h.methodA(); /* Line 6 */

}

Object methodA()

{

Object obj1 = new Object();

Object [] obj2 = new Object[1];

obj2[0] = obj1;

obj1 = null;

return obj2[0];

}

}

Where will be the most chance of the garbage collector being invoked?

A. After line 9

B. After line 10

C. After line 11

D. Garbage collector never invoked in methodA()

53.       class Bar { }

class Test

Bar doBar()

{

Bar b = new Bar(); /* Line 6 */

return b; /* Line 7 */

}

public static void main (String args[])

{

Test t = new Test();  /* Line 11 */

Bar newBar = t.doBar();  /* Line 12 */

System.out.println("newBar");

newBar = new Bar(); /* Line 14 */

System.out.println("finishing"); /* Line 15 */

}

}

At what point is the Bar object, created on line 6, eligible for garbage collection?

A. after line 12

B. after line 14

C. after line 7, when doBar() completes

D. after line 15, when main() completes

54.       class Test

private Demo d;

void start()

{

d = new Demo();

this.takeDemo(d); /* Line 7 */

} /* Line 8 */

void takeDemo(Demo demo)

{

demo = null;

demo = new Demo();

}

}

When is the Demo object eligible for garbage collection?

A. After line 7

B. After line 8

C. After the start() method completes

D. When the instance running this code is made eligible for garbage collection.

55.       public class X

{

public static void main(String [] args)

{

X x = new X();

X x2 = m1(x); /* Line 6 */

X x4 = new X();

x2 = x4; /* Line 8 */

doComplexStuff();

}

static X m1(X mx)

{

mx = new X();

return mx;

}

}

After line 8 runs. how many objects are eligible for garbage collection?

A. 0

B. 1

C. 2

D. 3

56.       public class Test2

{

public static int x;

public static int foo(int y)

{

return y * 2;

}

public static void main(String [] args)

{

int z = 5;

assert z > 0; /* Line 11 */

assert z > 2: foo(z); /* Line 12 */

if ( z < 7 )

assert z > 4; /* Line 14 */

switch (z)

{

case 4: System.out.println("4 ");

case 5: System.out.println("5 ");

default: assert z < 10;

}

if ( z < 10 )

assert z > 4: z++; /* Line 22 */

System.out.println(z);

}

}

which line is an example of an inappropriate use of assertions?

A. Line 11

B. Line 12

C. Line 14

D. Line 22

57.       public class Test

{

public void foo()

{

assert false; /* Line 5 */

assert false; /* Line 6 */

}

public void bar()

{

while(true)

{

assert false; /* Line 12 */

}

assert false;  /* Line 14 */

}

}

What causes compilation to fail?

A. Line 5

B. Line 6

C. Line 12

D. Line 14

58.  What will be the output of the program?

public class Test

{

public static void main(String[] args)

{

final StringBuffer a = new StringBuffer();

final StringBuffer b = new StringBuffer();

{

public void run()

{

System.out.print(a.append("A"));

synchronized(b)

{

System.out.print(b.append("B"));

}

}

}.start();

{

public void run()

{

System.out.print(b.append("C"));

synchronized(a)

{

System.out.print(a.append("D"));

}

}

}.start();

}

}

C. CDDACB

D. Indeterminate output

59.  What will be the output of the program?

String s = "hello";

Object o = s;

if( o.equals(s) )

{

System.out.println("A");

}

else

{

System.out.println("B");

}

if( s.equals(o) )

{

System.out.println("C");

}

else

{

System.out.println("D");

}

1. A

2. B

3. C

4. D

A. 1 and 3

B. 2 and 4

C. 3 and 4

D. 1 and 2

60.  What will be the output of the program (in jdk1.6 or above)?

public class BoolTest

{

public static void main(String [] args)

{

Boolean b1 = new Boolean("false");

boolean b2;

b2 = b1.booleanValue();

if (!b2)

{

b2 = true;

System.out.print("x ");

}

if (b1 & b2) /* Line 13 */

{

System.out.print("y ");

}

System.out.println("z");

}

}

A. z

B. x z

C. y z

D. Compilation fails.

61.       class A

{

A( ) { }

}

class B extends A

{ }

Which statement is true?

A. Class B'S constructor is public.

B. Class B'S constructor has no arguments.

C. Class B'S constructor includes a call to this( ).

D. None of these.

62.       interface DoMath

{

}

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. 1 only

B. 2 only

C. 3 and 5

D. 1 and 4

63.  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 3

B. 2 and 4

C. 1 and 5

D. 2 and 6

64.       /* 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. 2 and 5

C. 3 and 4

D. 3 and 4

65.  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. 1, 2 and 4

B. 2, 3 and 5

C. 3, 4 and 5

D. 1, 2 and 3

66.  What will be the output of the program?

public class Foo

public static void main(String[] args)

{

try

{

return;

}

finally

{

System.out.println( "Finally" );

}

}

}

A. Finally

B. Compilation fails.

C. The code runs with no output.

D. An exception is thrown at runtime.

67.  What will be the output of the program?

try

{

int x = 0;

int y = 5 / x;

}

catch (Exception e)

{

System.out.println("Exception");

}

catch (ArithmeticException ae)

{

System.out.println(" Arithmetic Exception");

}

System.out.println("finished");

A. finished

B. Exception

C. Compilation fails.

D. Arithmetic Exception

68.  What will be the output of the program?

public class X

public static void main(String [] args)

{

try

{

System.out.print("A");

}

catch (Exception ex)

{

System.out.print("B");

}

finally

{

System.out.print("C");

}

System.out.print("D");

}

{

throw new Error(); /* Line 22 */

}

}

A. ABCD

B. Compilation fails.

C. C is printed before exiting with an error message.

D. BC is printed before exiting with an error message.

69.  What will be the output of the program?

public class X

public static void main(String [] args)

{

try

{

System.out.print("A");

}

catch (RuntimeException ex) /* Line 10 */

{

System.out.print("B");

}

catch (Exception ex1)

{

System.out.print("C");

}

finally

{

System.out.print("D");

}

System.out.print("E");

}

{

throw new RuntimeException();

}

}

A. BD

B. BCD

C. BDE

D. BCDE

70.  What will be the output of the program?

public class RTExcept

{

public static void throwit ()

{

System.out.print("throwit ");

throw new RuntimeException();

}

public static void main(String [] args)

{

try

{

System.out.print("hello ");

throwit();

}

catch (Exception re )

{

System.out.print("caught ");

}

finally

{

System.out.print("finally ");

}

System.out.println("after ");

}

}

A. hello throwit caught

B. Compilation fails

C. hello throwit Runtime Exception caught after

D. hello throwit caught finally after

71.  What will be the output of the program?

public class Test

public static void aMethod() throws Exception

{

try /* Line 5 */

{

throw new Exception(); /* Line 7 */

}

finally /* Line 9 */

{

System.out.print("finally "); /* Line 11 */

}

}

public static void main(String args[])

{

try

{

aMethod();

}

catch (Exception e) /* Line 20 */

{

System.out.print("exception ");

}

System.out.print("finished"); /* Line 24 */

}

}

A. finally

B. exception finished

C. finally exception finished

D. Compilation fails

72.  What will be the output of the program?

public class X

{

public static void main(String [] args)

{

try

{

System.out.print("A");

}

catch (Exception ex)

{

System.out.print("B");

}

finally

{

System.out.print("C");

}

System.out.print("D");

}

}

A. AC

B. BC

C. ACD

D. ABCD

73.  What will be the output of the program?

public class X

public static void main(String [] args)

{

try

{

System.out.print("A");

}

catch (Exception ex) /* Line 10 */

{

System.out.print("B"); /* Line 12 */

}

finally /* Line 14 */

{

System.out.print("C"); /* Line 16 */

}

System.out.print("D"); /* Line 18 */

}

{

throw new RuntimeException();

}

}

A. AB

B. BC

C. ABC

D.BCD

74.  What will be the output of the program?

public class MyProgram

{

public static void main(String args[])

{

try

{

System.out.print("Hello world ");

}

finally

{

System.out.println("Finally executing ");

}

}

}

A. Nothing. The program will not compile because no exceptions are specified.

B. Nothing. The program will not compile because no catch clauses are specified.

C. Hello world.

D. Hello world Finally executing

75.  What will be the output of the program?

class Exc0 extends Exception { }

class Exc1 extends Exc0 { } /* Line 2 */

public class Test

public static void main(String args[])

{

try

{

throw new Exc1(); /* Line 9 */

}

catch (Exc0 e0) /* Line 11 */

{

System.out.println("Ex0 caught");

}

catch (Exception e)

{

System.out.println("exception caught");

}

}

}

A. Ex0 caught

B. exception caught

C. Compilation fails because of an error at line 2.

D. Compilation fails because of an error at line 9

Ans : A