JAVA QUIZ 6

53
Created on By Sirjana GhimireAcharya

JAVA QUIZ 6

1 / 10

1.What will be the output of the following code in Java?
public class a {
public static void main(String args[]){
final String str1="social";
final String str2="media";
String str3=str1+str2;
String str4="socialmedia";
System.out.println(str3==str4); // Output
}
}

2 / 10

2.Which tool is required on each machine to run a Java program?

3 / 10

3. Which Set class should be most popular in a multi-threading environment, considering performance constraint?

4 / 10

4.Predict the output of following Java program
class T {
int t = 40;
T() {
t = 100;
}
}
class Main {
public static void main(String args[]) {
T t1 = new T();
System.out.println(t1.t);
}
}

5 / 10

5. Which of the following is not a primitive data type?

6 / 10

6.Before you start: if something is written in quotation marks("quote") then it means Java code What is the name for an application that changes a human-readable programming language into a machine-readable language?

7 / 10

7.What will be output of x in following code? "class Test{ public static void main(String[] args) { int x = 1; if (x == 1) { x = x + 1} } }"

8 / 10

8.

class Test extends Exception { }

class Main {
public static void main(String args[]) {
try {
throw new Test();
}
catch(Test t) {
System.out.println("Got the Test Exception");
}
finally {
System.out.println("Inside finally block ");
}
}
}

9 / 10

9.What is the difference between "int" and "INT"?

10 / 10

10.Why we have to use "int" and "String".

Your score is

The average score is 63%

0%

Leave a Reply

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