Search Header Logo

C++ Identifiers and Constants Quiz

Authored by NURUL (PMJ)

Computers

University

Used 3+ times

C++ Identifiers and Constants Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a valid identifier in C++?

100students

Vari@bles

my_school

Playing Football

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the maximum number of characters allowed in an identifier in most programming languages?

31

15

50

100

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT allowed in an identifier name?

Letters

Numbers

Underscore (_)

Spaces

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In C++, what happens when you use an identifier that matches a reserved word?

The program will run as normal

The compiler will treat it as a special variable

It will cause a syntax error

It will be ignored

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax for declaring a constant in C++?

const datatype variable_name;

datatype const variable_name = value;

datatype variable_name;

#define variable_name value

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is an example of a reserved word in C++?

myVariable

int

my_school

student

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following data types can be used to declare a variable in C++?

char

int

float

All of the above

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?