Tuesday

Indus-Logic Placement Paper

What is the output of the following code when compiled and run? Select two correct answers.
public class Question01 {
public static void main(String[] args){
int y=0; //line 1
int x=z=1; //line 2
System.out.println(y+","+x+","+z); //line 3
}
}
A. Prints 0,1,1
B. Error during compilation at line 1
C. Prints 0,0,1
D. Error during compilation at line 3
E. Error during compilation at line 2

Question 2. Select three correct statements.
A. The garbage collection thread cannot outlive the last user thread.
B. The garbage collection can be forced by invoking System.gc().
C. The garbage collection thread is a non-deamon thread.
D. The finalize() method is invoked at most once by the JVM for any given object.
E. The finalize() method may resurrect the object upon which it has been invoked.

What is the output of the following code when compiled and run? Select one correct answer.
import java.io.*;
public class Question05 {
public static void main(String[] args) {
Question05Sub myref = new Question05Sub();
try{
myref.test();
}catch(IOException ioe){}
}
void test() throws IOException{
System.out.println("In Question05");
throw new IOException();
}
}
class Question05Sub extends Question05 {
void test()throws IOException {
System.out.println("In Question05Sub");
}
}
A. Prints:
In Question05Sub
B. Prints:
In Question05
C. Prints:
In Question05
In Question05Sub
D. Prints:
In Question05Sub
In Question05
E. The code does not compile.

Select two correct statements about the code given below?
class A{}
class B extends A implements E{} //line 1
class C extends A{}
class D extends B{}
interface E{}
public class Question07 {
public static void main(String[] args) {
A a = new D(); //line 2
C c = new C(); //line 3
E e = (E)a; //line 4
B b = (B)e; //line 5
}
}
A. The code compiles without error and runs fine.
B. Compilation error on line 1 because interface E is not yet declared (forward-referencing).
C. Compilation error on line 4 because class A does not implement interface E.
D. The cast on line 4 is mandatory.
E. The cast on line 5 is not mandatory.

How many objects are eligible for garbage collection immediately after line 1? Select one correct answer.
public class Question08 {
public static void main(String[] args) {
Question08 q08 = new Question08();
q08.doSomething(); //line 1
Thread.sleep(20000);
}
public void doSomething(){
Object[] objArray = new Object[2];
for(int i=0;i<objArray.length;i++){
objArray[i] = new Object();
}
}
}
A. 0
B. 1
C. 2
D. 3
E. 4

What is the output of the following code when compiled and run? Select one correct answer.
public class Question09 {
public static void main(String[] args) {
try {
int i = (int)(Math.random()*10);
if(i<=5)
System.out.println("i = "+i);
else
throw new Exception("i > 5");
} catch (Exception e){
System.err.println(e.getMessage()+" (i="+i+")");
}
}
}
A. The output cannot be determined.
B. Compilation error.
C. An exception is thrown at runtime.
D. Output is i = 2
E. Output is i > 5 (i=6)

What is the output of the following code when compiled and run? Select one correct answer.
public class Question10 {
public static void main(String[] args) {
new Question10().doSomething();
}
public void doSomething(){
int i=5;
Thread t = new Thread(new Runnable(){
public void run(){
for(int j=0;j<=i;j++){
System.out.print(" "+j);
}
}
});
t.start();
}
}
A. Prints 0 1 2 3 4
B. Compilation error.
C. No output.
D. IllegalThreadStateException is thrown at runtime.
E. Prints 0 1 2 3 4 5

What is the output of the following code when compiled and run? Select one correct answer.
public class Question11 {
public static void main(String[] args) {
StringBuffer buf1 = new StringBuffer("Hello W");
addSomeStuff(buf1);
System.out.println(buf1.toString());
}
public static void addSomeStuff(StringBuffer buf){
StringBuffer b = buf.replace(6,10,"orld");
System.out.println(b.delete(0,1).toString());
}
}
A. Prints
Hello World
Hello World
B. Prints
Hello orld
Hello orld
C. Prints
Hello orld
ello orld
D. Prints
ello orld
ello orld
E. Compilation error.

What is the output of the following code when compiled and run? Select two correct answers. (Note: when an instance of a Vector is printed, its content appear between square brackets [])
import java.util.*;
public class Question13 {
public static void main(String[] args) {
Vector col = new Vector();
col.add(new Integer(1));
col.add(new Integer("2"));
col.add(new Float(3.2d)); //line 1
col.add(col.elementAt(1));
col.setElementAt(col.elementAt(2),0);
System.out.println(col);
}
}
A. Compilation error on line 1.
B. Only line 1 won't compile.
C. The code compiles and runs fine.
D. Prints [3.2, 2, 3.2, 2]
E. Prints [1, 2, 3.2, 2]

Select three correct statements.
A. A static method may override another static method.
B. A static method cannot override a non-static method.
C. A non-static method cannot override a static method.
D. A non-static method may be overloaded by a static method.
E. A synchronized method cannot be overridden.

Inautics Placement Paper

C++ paper:
1.cin is an
a.function
b.object
c.class.
2.i con't remember the ques but the ans is Virtual base class

3.what is the use of scope resolution operator?

4.advantage of inline function?

5.copy constructor is
ans:call by value.

6.ques on vertual destructor?

7.template one ques?

8.one q' on container class?

The order above may be different. There r totally 15 ques its very easy
to ans'r.

C paper:
1.How will u terminate the statement?
ans: ;

2.select the wrong one
a.a+=1;
b.a*=2;
c.a**=1;(ans)
d.a>>=1;

3.
main()
{
int n,i=1;
switch(n)
{
case 1:
some stuff;
case 2:
some stuff;
default:
i=10;
}
printf("i=%d",i);
}
what will be value of i;
ans:non of the above

4.pick ut the wrong one
#typedef some stuff
{
---
};

5.one q's on do loop?

6.pick the odd one
a.malloc
b.calloc
c.new(ans)

7. char *ptr;
p=malloc(20);
How will u de allocate the memory?
a.delete.
b.free.

There r about 20 q's in this section rest i am un able to remember?

UNIX paper:
1.ans:script

2.How will u do version maintaince?
sccs(source code control system)

3.awk $2

4.a program in shell script?
find the o/p.

5.which signal u can't catch?
ans:sigkill

6.core dump is due to ?
ans:segmentation fault.

7.echo "todays date is 'date'";
o/p = ?

8.process synchronisation is done by ?
ans:s'phore

There r totally 15 in this section rest r easy to answer.

IGate Placement Paper

QUESTION PAPER CONSIST OF TWO PARTS
ANALYTICAL SKILLS : 20 QUES, 20 MIN.
C SKILLS : 30 QUES, 30 MINS.

ANALYTICAL :
1. COMPLETE THE DIAGRAM :
FOUR FIG WILL BE GIVEN , YOU HAVE TO DRAW THE FINAL ONE
TRIANGLE FIG :

2. DRAW VENN DIAGRAM RELATING RHOMBUS, QUADRILATERAL & POLYGON

3.IN A GROUP OF 5 PERSONS A,B,C,D,E ONE OF THE PERSON IS ADVOGATE,
ONE IS DOCTOR, ONE BUSINESSS MAN, ONE SHOP KEEPER AND ONE IS PROFESSOR.
THREE OF THEM A,C,AND PROFESSOR PREFER PLAYING CRICKET TO FOOT BALL AND TWO
OF THEM B AND BUSINESSMAN PREFER PLAYING FOOT BALL TO CRICKET. THE SHOP
KEEPER AND B AND A ARE FRIENDS BUT TWO OF THESE
PREFER PLAYING FOOT BALL TO CRICKET. THE ADVOGATE IS C'S BROTHER AND
BOTH PLAY SAME GAME . THE DOCTOR AND E PLAY CRICKET.

(a) WHO IS ADVOGATE ?
A, B, C, D
(b) WHO IS SHOP KEEPER ?
A, B, C, D
(C) WHICH OF THE FOLLOWING GROUP INCLUDE PERSONS WHO LIKE PLAYING CRICKET
BUT DOESN'T INCLUDE PROFESSOR ?
AB,BC,CD, NONE
(d) WHO IS DOCTOR ?
A,B,C,D.

{ SAME MODEL PROBLEM WAS ASKED IN QUES PAPER BUT PROFESSIONS WILL BE DIFFERENT
SUCH AS HORTICULTURIST ,PHYSICST,JOURNALIST,ADVOCATE AND OTHER ONE. INSTEAD OF
FOOTBALL AND CRICKET THEY WILL GIVE TEA AND COFFEE }

4. THEY WILL GIVE SOME CONDITION'S AND ASKED TO FIND OUT FARTHEST CITY IN THE
WEST (EASY ONE )?

5. TRAVELLING SALES MAN PROBLEM .
SOME CONDITION WILL BE GIVEN WE HAVE TO FIND OUT THE ORDER OF STATION THE
SALES MAN MOVES
( THREE QUES'S )

6. +,-,*, /, WILL BE GIVEN DIFFERENT MEANING
EXAMPLE : TAKE + AS * AND SO ON .
THEY WILL GIVE EXPRESSION AND WE HAVE TO FIND THE VALUE OF THAT.

7. 3+5-2 =4
WHICH HAS TO BE INTERCHANGE TO GET THE RESULT ?

8. WE DON'T NO EXACT PROBLEM .
EX : 8A3B5C7D.....
A WIIL BE GIVEN + SIGN.
B WILL BE GIVEN - SIGN.
FIND THE VALUE OF EXPRESSION ?

9. FIND THE TOTAL NUMBER OF SQUARES IN 1/4 OF CHESS BOARD ?

10. 6 FACE OF A CUBE ARE PAINTED IN A MANNER ,NO 2 ADJACENT FACE HAVE SAME
COLOUR. THREE COLURS USED ARE RED BLUE GREEN. CUBE IS CUT IN TO 36 SMALLER
CUBE IN SUCH A MANNER THAT 32 CUBES ARE OF ONE SIZE AND REST OF THEM BIGGER
SIZE AND EACH BIGGER SIDE HAVE NO RED SIDE. FOLLOWING THIS
THREE QUES WILL BE ASKED .
{ IN QUES PAPER COLORS WILL BE DIFFERENT }

11. TWO LADIES ,TWO MEN SIT IN NORTH EAST WEST SOUTH POSITION OF RECTANCULAR
TABLE. USING CLUES IDENTIFY THEIR POSITION ?

12. CLOCK PROBLEM :
(ONE QUES )

13. ALL MEN ARE VERTEBRATE.
SOME MAMMALS ARE MEN.
CONCLUDE.

C SKILLS :
1. find(int x,int y)
{ return ((x<y)?0:(x-y)):}
call find(a,find(a,b)) use to find
(a) maximum of a,b
(b) minimum of a,b
(c) positive difference of a,b
(d) sum of a,b

2. integer needs 2bytes , maximum value of an unsigned integer is
(a) { 2 power 16 } -1
(b) {2 power 15}-1
(c) {2 power16}
(d) {2 power 15}

3.y is of integer type then expression
3*(y-8)/9 and (y-8)/9*3 yields same value if
(a)must yields same value
(b)must yields different value
(c)may or may not yields same value
(d) none of the above

4. 5-2-3*5-2 will give 18 if
(a)- is left associative,* has precedence over -
(b) - is right associative,* has precedence over -
(c) - is right associative,- has precedence over *
(d)- is left associative,- has precedence over *