1.
Care din următoarele expresii furnizează rezultatul 1 dacă a şi b sunt ambele pozitive:
Correct Answer
C. (a*b > 0) && (b > 0)
Explanation
The expression (a*b > 0) && (b > 0) will provide the result 1 if both a and b are positive. This is because the first part of the expression, (a*b > 0), checks if the product of a and b is greater than 0, which means both numbers have the same sign (either both positive or both negative). The second part of the expression, (b > 0), checks if b is also positive. Therefore, this expression ensures that both a and b are positive, resulting in the answer 1.
2.
Considerăm că variabila a are valoarea –13. Cărui tip poate aparţine această variabilă:
Correct Answer
C. Long
Explanation
The variable "a" can be of type "long" because it can store negative values, such as -13, and "long" is capable of storing larger ranges of numbers, including negative values.
3.
Care din următoarele expresii au valoarea 1 :(alegeti 2 variante)
Correct Answer(s)
B. (3 < 7) || (2 < 0) || (6 = = 4)
C. ! (2 < 0) || (6 = = 4)
Explanation
The correct answer is "(3 < 7) || (2 < 0) || (6 = = 4), ! (2 < 0) || (6 = = 4)". In the first expression, (3 < 7) is true, (2 < 0) is false, and (6 = = 4) is false. The second expression, (3 < 7) is true, (2 < 0) is false, and (6 = = 4) is false. The third expression, (2 < 0) is false, and (6 = = 4) is false. Therefore, the first two expressions evaluate to true because of the "||" operator, and the third expression evaluates to false because of the "!" operator.
4.
Dacă a, b, c, d sunt variabile de tip int, ce valoare are expresia :E = a/b/c – d, dacăa=36, b=6, c=6, d=4?
Correct Answer(s)
-3
Explanation
The given expression calculates the value of E by first dividing a by b, then dividing the result by c, and finally subtracting d from it. In this case, a=36, b=6, c=6, and d=4. So, the expression evaluates to (36/6/6) - 4 = 1 - 4 = -3. Therefore, the value of E is -3.
5.
Care este valoarea expresiei alăturate?ABS(-11.2) + SQRT(TRUNC(16.23))
Correct Answer
C. 15.2
6.
Care dintre următoarele expresii are valoarea 1 dacă şi numai dacă numărul real memorat în variabila x se află în intervalul (-2,2)?
Correct Answer
B. 4-x*x>0
Explanation
The expression "4-x*x>0" has a value of 1 if and only if the real number stored in variable x is within the interval (-2,2). This expression represents the condition that the square of x subtracted from 4 is greater than 0, which means that x must be either less than -2 or greater than 2 in order for the expression to be true. Therefore, if x is within the interval (-2,2), the expression will be false and have a value of 0.
7.
Indicați expresia care are valoarea 1 dacă și numai dacă numărul natural memorat în variabila întreagă x are exact două cifre.
Correct Answer
A. X>9 && x
Explanation
The expression "x>9 && x" has a value of 1 if and only if the natural number stored in the integer variable x has exactly two digits. This is because the expression "x>9" checks if x is greater than 9, which ensures that x has at least two digits. The "&&" operator then checks if x is also less than 100, ensuring that x has exactly two digits and not more. Therefore, the expression "x>9 && x" evaluates to true only when x has exactly two digits.
8.
Care este rezultatul evaluarii expresiei de mai jos?10 * 2 / 3 * 3 / 2*5
Correct Answer
B. 45
Explanation
The expression can be simplified using the order of operations (PEMDAS/BODMAS). First, we perform the multiplication and division from left to right. 10 * 2 = 20, 20 / 3 = 6.6667, 6.6667 * 3 = 20, and 20 / 2 = 10. Then, we perform the remaining multiplication from left to right. 10 * 5 = 50. Therefore, the result of the expression is 50.
9.
Stabiliti cae dintre expresiile urmatoare atribuie variabilei reale m valoarea mediei aritmetice anumerelor intregi x si y?
Correct Answer
A. M=(x+y)/2.0
Explanation
The correct answer is m=(x+y)/2.0. This expression assigns the variable m the value of the arithmetic mean of the integers x and y. The use of the decimal point after the 2 ensures that the division is done as a floating-point operation, resulting in a more precise average value.