Test 3

1.

How many constructors in the String class?
 
 
 
 

2.

 String class belongs to __________ package

 
 
 
 

3. Operators are used to perform operations on :

 
 
 
 

4. Unary Operator :

 
 
 
 

5.

Which of the following methods of the “StringBuffer” class is used to find the length of a String?

 
 
 
 

6. ++x is equivalent to :

 
 
 
 

7. Consider the statement

int a=19;

int b=91;

int c;

c=(a>b)? a:b;

System.out.println(c);

What is output?

 
 
 
 

8. Consider the statement

int a=19;

int b=91;

int c;

c=(a>b)? a:b;

System.out.println(c);

What is output?

 
 
 
 

9. What will be the output of the following program?

public class Test

{

public static void main(String A[])

{

int count=1;

While(count<=15)

{

System.out.println(count%3==1?”xx”:”++”);

++count;

}

}

}

 

 
 
 
 

10. What is the value of R after evaluate the following java expression:

int x=3,y=5,z=10;

int R=++z+y-y+z+x++;

 
 
 
 

11. Which of these is not a bitwise operator:

 
 
 
 

12. Which  of these have highest precedence?

 
 
 
 

13. What happen when you attempt to compile and run the following class ?

class test{

test(int a)

{

System.out.println(“OK”);

}}

class exam extends test{

exam(int a)

{

System.out.println(a);

}

public static void main(String K[])

{

exam e=new exam(10);

}

}

 
 
 
 

14. What will be the value of x?

int x=0,y=0,z=0;

x=(++x + y–)*z++;

 
 
 
 
 

15. What happen when program will compile and Run :

abstract class man
{
abstract void show()
{
}
}
public class OK extends man
{
OK()
{
System.out.println(“OK”);
}
public static void main(String S[])
{
OK a = new OK();
}
}

 
 
 
 

16. Select correct portion for this program:

class USA

{

void USA()

{

System.out.println(“USA”);

}

USA(int U)

{

System.out.println(“U”+1);

}

}

 

 
 
 
 

17. What is the output of the following program:

class Test {

int i;

}

public class main

{

public static void main(String P[])

{

Test T = new Test();

System.out.println(T.i);

}

}

 

 
 
 
 

18. What is the Result of compile & Run of the following program:

class USA

{

USA(int K)

{

System.out.println(“USA”);

}

}

public class World extends USA

{

public static void main(String A[])

{

World w = new World();

}

void World()

{

System.out.println(“Wrong”);

}

}

 

 
 
 
 

Leave a Reply

Your email address will not be published. Required fields are marked *