JAVA QUIZ 11

26
Created on By Sirjana GhimireAcharya

C Language Quiz 11

1 / 10

1. Can we compare string and StringBuffer in Java?

2 / 10

2. What is the output of the following Java code fragment?

public class Example {

public static void main(String [] args)
{
System.out.print("1 ");
synchronized(args)
{
System.out.print("2 ");
try
{
args.wait(); /* Line 11 */
}
catch(InterruptedException e){ }
}
System.out.print("3 ");
}
}

 

3 / 10

3. Which method registers a thread in a thread scheduler?

4 / 10

4.TreeMap -

5 / 10

5. Which Map is synchronized?

6 / 10

6.concurrentSkipListMap permits

7 / 10

7. What is the output of the following Java program?

class demo
{
int a, b, c;
demo(int a, int b, int c)
{
this.a = a;
this.b = b;
}

demo()
{
a = b = c = 0;
}

demo operator+(const demo &obj)
{
demo object;
object.a = this.a + obj.a;
object.b = this.b + obj.b;
object.c = this.c + obj.c;
return object;
}
}

class Test
{
public static void main(String[] args)
{

demo obj1 = new demo(1, 2, 3);
demo obj2 = new demo(1, 2, 3);
demo obj3 = new demo();

obj3 = obj1 + obj2;
System.out.println ("obj3.a = " + obj3.a);
System.out.println ("obj3.b = " + obj3.c);
System.out.println ("obj3.c = " + obj3.c);

}
}

8 / 10

8. What is the use of final keyword in Java?

9 / 10

9. Which of these helps insert elements at a specific position in a collection?

10 / 10

10. Complexity of ArrayList get method

Your score is

The average score is 50%

0%