Which of the following is a legal identifier in Java?
Anonymous Quiz
52%
_myVariable
16%
2myVariable
18%
my-variable
14%
my variable
Describe the difference between checked and unchecked exceptions in Java.
وصف الفرق بين الاستثناءات المراقبة وغير المراقبة في جافا.
وصف الفرق بين الاستثناءات المراقبة وغير المراقبة في جافا.
In Java, how do you catch multiple types of exceptions in a single catch block?
Anonymous Quiz
32%
By separating exceptions with a semicolon (;)
32%
By separating exceptions with a comma (,)
20%
By using multiple catch blocks for each exception type
16%
By separating exceptions with a pipe (|)
What is the correct way to create an object of a class named `Vehicle` in Java?
Anonymous Quiz
74%
Vehicle myCar = new Vehicle();
15%
class Vehicle myCar = new Vehicle();
2%
new Vehicle myCar = Vehicle();
8%
Vehicle = new myCar();
❤1
How do you initialize an array of 10 integers to zero in Java?
كيف تقوم بتهيئة مصفوفة من 10 أعداد صحيحة إلى صفر في جافا؟
كيف تقوم بتهيئة مصفوفة من 10 أعداد صحيحة إلى صفر في جافا؟
What will be the output of the following Java code snippet?
```java
int x = 10; int y = ++x; System.out.println(y); ```
```java
int x = 10; int y = ++x; System.out.println(y); ```
Anonymous Quiz
12%
10
80%
11
3%
12
5%
None of the above
What is the difference between 'abstract class' and 'interface' in Java?
ما هو الفرق بين 'الفئة المجردة' و'الواجهة' في جافا؟
ما هو الفرق بين 'الفئة المجردة' و'الواجهة' في جافا؟
👍1
In Java, how do you check if an object `obj` is an instance of the class `MyClass`?
Anonymous Quiz
22%
obj instanceof MyClass
31%
MyClass.isInstance(obj)
17%
instanceof(obj, MyClass)
30%
obj.instanceof(MyClass)
👍1
What is an infinite loop, and how can it be caused in Java?
ما هو الحلقة اللانهائية، وكيف يمكن أن تسبب في جافا؟
ما هو الحلقة اللانهائية، وكيف يمكن أن تسبب في جافا؟
Which of these is a valid declaration of a `main` method in Java?
Anonymous Quiz
85%
public static void main(String[] args)
7%
public void main(String[] args)
1%
static public main(String[] args)
6%
public static main(String args[])
❤1
What is the purpose of garbage collection in Java, and how does it work?
ما هو الغرض من جمع القمامة في جافا، وكيف يعمل؟
ما هو الغرض من جمع القمامة في جافا، وكيف يعمل؟
❤1👍1
Which of these keywords is used to define a variable that cannot be modified?
Anonymous Quiz
11%
fixed
54%
final
25%
static
11%
const
Describe the concept of 'method overloading' in Java.
وصف مفهوم 'تحميل الطريقة' في جافا.
وصف مفهوم 'تحميل الطريقة' في جافا.
How do you access the length of an array named `arr` in Java?
Anonymous Quiz
53%
arr.length()
2%
arr.size
40%
arr.length
5%
length(arr)
What is the purpose of a constructor in a Java class?
ما هو الغرض من منشئ في فئة جافا؟
ما هو الغرض من منشئ في فئة جافا؟
Which of the following loops will run indefinitely in Java?
Anonymous Quiz
14%
for (;;) {}
14%
while (true) {}
14%
do {} while (true);
59%
All of the above
Fix the error in the following Java method that is supposed to calculate the factorial of a number:
أصلح الخطأ في الطريقة الجافا التالية المفترض أن تحسب عامل رقم:
public int factorial(int n) {
if (n == 0) {
return 1;
} else {
return n * factorial(n);
}
} أصلح الخطأ في الطريقة الجافا التالية المفترض أن تحسب عامل رقم:
public int factorial(int n) {
if (n == 0) {
return 1;
} else {
return n * factorial(n);
}
}