Java Final Exam 2025 Solutions
HTML-код
- Опубликовано: 7 фев 2025
- في الفيديو ده أنا حليت معاك من السؤال رقم 8 للسؤال رقم 12. وضحتلك الفرق بين الـ is a والـ has a relation. كمان وضحتلك شوية أفكار هتفيدك بخصوص الـ super ودي كانت أهم نقطة في الامتحان والدكتور مركز عليها جامد. كمان الفرق بين الـ instance variable والـ static والـ local
دا الامتحان اللي بحل منة :
drive.google.c...
الاسئلة :
8. Inheritance is also known as the:
is-a relationship
has-a relationship
uses-a relationship
knows-a relationship
9. Interfaces can have ______ methods.
any number of
1
2
3
------------
10. Consider the array:
s[0] = 7
s[1] = 0
s[2] = -12
s[3] = 9
s[4] = 10
s[5] = 3
s[6] = 6
The value of s[s[3] - s[6]] is:
3
0
6
9
------------
11. Consider the following code:
Java
class A {
static int range = 9;
A() {
range = 80;
}
}
class B extends A {
int range; // Shadowing the static variable
void setRange(int r) {
range = r;
}
}
public class Test {
public Test() {}
public static void main(String[] args) {
A o1 = new A();
System.out.println(o1.range);
B o2 = new B();
o2.setRange(55);
System.out.println(o2.range);
A o3 = new B();
System.out.println(o3.range);
}
}
What is the output?
55 55
80 55 80
80 55 50 (Incorrect)
80 80 80 (Incorrect)
12. Consider the classes:
Java
class A {
int a;
public A() {
a = 7;
}
}
class B extends A {
int b;
public B() {
b = 8;
}
}
Which statement is false?
Both variables a and b are instance variables.
After the constructor for class B executes, the variable a will have the value 7. After the constructor for class B executes, the variable b will have the value 8.
A reference of type A can be treated as a reference of type B.
شرح فوق العظمة ❤❤❤عاش بجد والله يخويا ❤😊
اخويااا امير ♥️❤️