Untitled

                Never    
Java
       
1. G = 4*(Math.PI^2)*((a^3*Math.sin(x/(x-1)))/(Math.E^(x^2)*Math.sqrt(m1 + m2)))


2. D


3. B


4.
a = -1 // pentru ca integer de -1.75 = -1

x = 0
x % 2 == 0 <=> 0 % 2 == 0 Yes, then continue

x = 1
x % 2 == 0 <=> 1 % 2 == 0 No, then a = a + 2 = -1 + 2 = 1

x = 2
x % 2 == 0 <=> 2 % 2 == 0 Yes, then continue

x = 3
x % 2 == 0 <=> 3 % 2 == 0 No, then a = a + 2 = 1 + 2 = 3

x = 4
x % 2 == 0 <=> 4 % 2 == 0 Yes, then continue

x = 5
x % 2 == 0 <=> 5 % 2 == 0 No, then a = a + 2 = 3 + 2 = 5

x = 6
x % 2 == 0 <=> 6 % 2 == 0 Yes, then continue

x = 7
x % 2 == 0 <=> 7 % 2 == 0 No, then a = a + 2 = 5 + 2 = 7

x = 8
x % 2 == 0 <=> 8 % 2 == 0 Yes, then continue

x = 9
x % 2 == 0 <=> 9 % 2 == 0 No, then a = a + 2 = 7 + 2 = 9

x = 10
x % 2 == 0 <=> 10 % 2 == 0 Yes, then continue

Done; a = 9

Raspuns corect E


5.
t = 0
c = 1

t < 24 <=> 0 < 24 True
t == 2 <=> 0 == 2 False
t *= 2 <=> t = 0 * 2 = 0

t will always be zero because is it multiplied with 0 so the times the body of the cycle is executed is infinity


6. Which is the class name? Hi
Which are the methods name? main, afisareMesaj
Which are the instane and class variable names and constants?
Class variable names: age, tel, address
No constants

Which are the local variable names? contorMesaj


7. 
p      q      r      p || !(q && r)
false  false  false  false || !(false && false) <=> false || !false <=> false || true <=> true

p      q      r      !(p && q || !r)
false  false  false  !(false && false || !false) <=> !(false && false || true) <=> !(false || true) <=> !true <=> false

p      q      r      p || !(q && r)
false  false  true   false || !(false && true) <=> false || !true <=> false || false <=> false

p      q      r      !(p && q || !r)
false  false  true   !(false && false || !true) <=> !(false && false || false) <=> !(false || false) <=> !false <=> true


8.
Cerinta ambigua pentru mine. Presupun ca se cere sa dublez numere pare diferite de 0
int[] data = new int[]{1,3,5,3,4,5,6}
for (int i=0; i < data.length; i++) {
    if (data[i] != 0 && data[i] % 2 == 0) {
        data[i] = data[i] * 2
    }

    System.out.println(data[i]);
}

9.
public class Rectangle {
    private int x_up_left;
    private int y_up_left;
    private int length;
    private int width

    public int get_x_up_left() { return x_up_left; }
    public int get_y_up_left() { return y_up_left; }
    public int get_length() { return length; }
    public int get_width() { return width; }

    public int perimeter() { return length * 2 + width * 2; }
    public int area() { return length * width; }

    public String toString() { return "x_up_left:" + x_up_left + ",y_up_left:" + y_up_left + ",length:" + length + ",width:" + width; }
}

Raw Text