JAVA QUIZ 7

41
Created on By Sirjana GhimireAcharya

JAVA QUIZ 7

1 / 10

1. Which method is used in every Java program?

2 / 10

2.What is the output of following program?

public static void main(String ags[]){
String a=”abc”;
String b=new String(“abc”);
System.out.println(a.equals(b));
System.out.println(a==b);
}

3 / 10

3. Predict the output of the following program.
class Test
{ int count = 0;

void A() throws Exception
{
try
{
count++;

try
{
count++;

try
{
count++;
throw new Exception();

}

catch(Exception ex)
{
count++;
throw new Exception();
}
}

catch(Exception ex)
{
count++;
}
}

catch(Exception ex)
{
count++;
}

}

void display()
{
System.out.println(count);
}

public static void main(String[] args) throws Exception
{
Test obj = new Test();
obj.A();
obj.display();
}
}

4 / 10

4.Which allows the removal of elements from a collection?

5 / 10

5.You can write a Java program that runs on Windows and it will work just the same on Unix and Linux

6 / 10

6.What kind of programming language is Java?

7 / 10

7.What is the name of the process by which two or more strings are joined together?

8 / 10

8. Can a variable be local and static at the same time?

9 / 10

9. Which of the following is smallest integer data type?

10 / 10

10. Which keyword would you use if you wanted a class to use an interface?

Your score is

The average score is 67%

0%