ar
Feedback
Top Java Quiz Questions ☕️

Top Java Quiz Questions ☕️

الذهاب إلى القناة على Telegram

🎓🔥💾 If you want to acquire a solid foundation in Java and/or your goal is to prepare for the exam, this channel is definitely for you. 🤳Feel free to contact us - @topProQ If you are interested in Python https://t.me/topPythonQuizQuestions

إظهار المزيد
2 880
المشتركون
-224 ساعات
+127 أيام
+2930 أيام
أرشيف المشاركات
What is the result of code execution?
Anonymous voting

Code snippet:
import java.util.Arrays;
public class Main {
  public static void main(String []args){
  int[] random = { 6, -4, 100, 12, 0, -10 };
  int x = 12;
  int y = Arrays.binarySearch(random, x);
  System.out.println(y);
 }
}

What is the result of the code?
Anonymous voting

Code snippet:
2: String s1 = "java";
3: StringBuilder s2 = new StringBuilder("java");
4: if (s1 == s2)
5: System.out.print("1");
6: if (s1.equals(s2))
7: System.out.print("2");

What is the result of the code?
Anonymous voting

Code snippet:
7: StringBuilder sb = new StringBuilder();
8: sb.append("aaa").insert(1, "bb").insert(4, "ccc");
9: System.out.println(sb);

What is the output of the application above?
Anonymous voting

Code snippet:
1: public class CompareValues {
2: public static void main(String[] args) {
3: int x = 0;
4: while(x++ < 10) {}
5: String message = x > 10 ? "Greater than" : false;
6: System.out.println(message+","+x);
7: }
8: }

Which of the following are output by this code?
Anonymous voting

Code snippet:
3: String s = "Hello";
4: String t = new String(s);
5: if ("Hello".equals(s)) System.out.print("one ");
6: if (t == s) System.out.print("two ");
7: if (t.equals(s)) System.out.print("three ");
8: if ("Hello" == s) System.out.print("four ");
9: if ("Hello" == t) System.out.print("five");

What is output by the code above?
Anonymous voting

Code snippet:
1: public class Fish {
2: public static void main(String[] args) {
3: int numFish = 4;
4: String fishType = "tuna";
5: String anotherFish = numFish + 1;
6: System.out.println(anotherFish + " " + fishType);
7: System.out.println(numFish + " " + 1);
8: } }

What does the code above output?
Anonymous voting

Code snippet:
1: public class Salmon {
2: int count;
3: public void Salmon() {
4: count = 4;
5: }
6: public static void main(String[] args) {
7: Salmon s = new Salmon();
8: System.out.println(s.count);
9: } }

Given the class above, which of the following calls print out Blue Jay?
Anonymous voting

Code snippet:
public class BirdDisplay {
 public static void main(String[] name) {
 System.out.println(name[1]);
} }

Which of the following are valid Java identifiers?
Anonymous voting

Given the classes above, what is the maximum number of imports that can be removed and have the code still compile?
Anonymous voting

Code snippet
package aquarium; public class Water { }
package aquarium;
import java.lang.*;
import java.lang.System;
import aquarium.Water;
import aquarium.*;
public class Tank {
 public void print(Water water) {
 System.out.println(water); } }