JAVA QUIZ 8

115
Created on By Sirjana GhimireAcharya

JAVA QUIZ 8

1 / 10

1. Which package needs to be imported so that you can accept user input?

2 / 10

2. Which HTML tag can be used to place applets on a webpage?

3 / 10

3. What will be the output of the following code

import java.util.Iterator;

import java.util.Set;

import java.util.TreeSet;

public class ConcurrentSkipListMapTest{

public static void main(String args){

Set set = new TreeSet();

set.add(1);

set.add("2");

set.add(3);

Iterator iterator = set.iterator();

while(iterator. hasNext())

{

System.out.print(iterator.next()+" ");

}

} }

 

4 / 10

4. Iterator returned by Hashtable on key, value and entry are?

5 / 10

5. Which of the following is not an operator in Java?

6 / 10

6.   class Base {}

class Derived extends Base {
public static void main(String args[]){
Base a = new Derived();
System.out.println(a instanceof Derived);
}
}

7 / 10

7. What will be the output of the following code in Java?

class Test
{
boolean[] array = new boolean[3];
int count = 0;

void set(boolean[] arr, int x)
{
arr[x] = true;
count++;
}

void func()
{
if(array[0] && array[++count - 2] | array [count - 1])
count++;

System.out.println("count = " + count);
}

public static void main(String[] args)
{
Test object = new Test();
object.set(object.array, 0);
object.set(object.array, 1);
object.func();
}
}

8 / 10

8. Which Keyword is used If a class has multiple constructors defined,it's possible to call a constructor from another constructor’s body?

9 / 10

9. Which method of the Runnable interface that must be implemented by all threads?

10 / 10

10. Which keyword would you use to break out of a loop?

Your score is

The average score is 53%

0%