Expresii C++

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Cucuiet
C
Cucuiet
Community Contributor
Quizzes Created: 2 | Total Attempts: 2,892
Questions: 9 | Attempts: 1,716

SettingsSettingsSettings
Expresii C++ - Quiz

Clasa a X-a Informatica


Questions and Answers
  • 1. 

     Care din următoarele expresii furnizează rezultatul 1 dacă a şi b sunt ambele pozitive: 

    • A.

      (a > 0) && (a > b)

    • B.

      a*b > 0

    • C.

      (a*b > 0) && (b > 0)

    • D.

      (a > 0) || (b>0)

    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.

    Rate this question:

  • 2. 

     Considerăm că variabila a are valoarea  –13. Cărui tip poate aparţine această variabilă: 

    • A.

      Double

    • B.

      Unsigned int

    • C.

      Long

    • D.

      Char

    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.

    Rate this question:

  • 3. 

     Care din următoarele expresii au valoarea 1 :(alegeti 2 variante) 

    • A.

      (3 < 7) && (2 < 0) || (6 = = 4)

    • B.

      (3 < 7) || (2 < 0) || (6 = = 4)

    • C.

      ! (2 < 0) || (6 = = 4)

    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.

    Rate this question:

  • 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.

    Rate this question:

  • 5. 

    Care este valoarea expresiei  alăturate?ABS(-11.2) + SQRT(TRUNC(16.23))

    • A.

      -9.2

    • B.

      15

    • C.

      15.2

    • D.

      14.2

    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)?  

    • A.

      x*x-4

    • B.

      4-x*x>0

    • C.

      (x-2)*(x+2)>0

    • D.

      ( 2< x ) && ( x< -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.

    Rate this question:

  • 7. 

    Indicați expresia care are valoarea 1 dacă și numai dacă numărul natural memorat în variabila întreagă x are exact două cifre. 

    • A.

      X>9 && x

    • B.

      X>9 || x

    • C.

      x>9 || x

    • D.

      x>10 && x

    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.

    Rate this question:

  • 8. 

    Care este rezultatul evaluarii expresiei de mai jos?10 * 2 / 3 * 3 / 2*5

    • A.

      9

    • B.

      45

    • C.

      10

    • D.

      1.11

    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.

    Rate this question:

  • 9. 

    Stabiliti cae dintre expresiile urmatoare atribuie variabilei reale m valoarea mediei aritmetice anumerelor intregi x si y?

    • A.

      M=(x+y)/2.0

    • B.

      M=x+y/2

    • C.

      M=x/2+y/2

    • D.

      M==(x+y)/2

    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.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Oct 30, 2014
    Quiz Created by
    Cucuiet
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.