Search Header Logo

Identifier, Variable & Constant

Authored by Alvin Muslim Sardar

Computers

11th Grade

Identifier, Variable & Constant
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

7 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is a valid C++ identifier?

  • 2variable

  • variable_name

  • variable-name

  • @variable

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

  • Which of the following is a correct way to declare an integer variable in C++?

int 1number;

integer num;

int number;

num int;

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What keyword is used to define a constant in C++?

constant

const

fixed

static

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How do you initialize a variable in C++?

int num = 10;

int num : 10;

num = int 10;

int = num 10;

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Media Image

What will be the output of the following code snippet?

0

5

value

error

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What will happen if you try to modify a 'const' variable in C++?

The code will compile successfully

The value will be changed

An error will occur

The program will crash

7.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Which of the following correctly represents a floating-point constant in C++?

3.14

3.14f

3.14F

All correct

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?