6.5 is a _____ constant

character literal
named literal
numeric literal
string literal

The correct answer is: C. numeric literal.

A numeric literal is a constant that represents a number. It can be an integer, a floating-point number, or a hexadecimal number.

A character literal is a constant that represents a single character. It is enclosed in single quotes (‘).

A named literal is a constant that is given a name. It is declared using the keyword const.

A string literal is a constant that represents a sequence of characters. It is enclosed in double quotes (“).

Here are some examples of each type of literal:

  • Numeric literal: 6.5, 100, 0x1234
  • Character literal: ‘a’, ‘b’, ‘c’
  • Named literal: const int x = 10;
  • String literal: “Hello, world!”

I hope this helps! Let me know if you have any other questions.

Exit mobile version