C++ Operators

Last Updated :
Discuss
Comments

Question 1

Which operator is having the highest precedence in C++?

  • A

    array subscript

  • B

    static_cast

  • C

    Scope resolution operator

  • D

    dynamic_cast

Question 2

Which operator has the highest precedence?

  • A

    +

  • B

    *

  • C

    ==

  • D

    &&

Question 3

Which statement checks if a number is negative?

  • A

    if (x > 0)

  • B

    if (x < 0)

  • C

    if (x == 0)

  • D

    if (x >= 0)

Question 4

What does the following code output?

int x = 4;

x *= 2 + 3;

cout << x;

  • A

    20

  • B

    14

  • C

    10

  • D

    Compilation Error

Question 5

What does the sizeof operator return?

  • A

    The memory address of a variable

  • B

    The number of variables in a scope

  • C

    The size (in bytes) of a variable or data type

  • D

    The value of the variable

Question 6

Which of the following is the correct associativity of the assignment operator (=)?

  • A

    Left to Right

  • B

    Right to Left

  • C

    Top to Bottom

  • D

    No associativity

Tags:

There are 6 questions to complete.

Take a part in the ongoing discussion