C++ Variable Declaration Quiz

PersonalizedDanburite avatar
PersonalizedDanburite
·
·
Download

Start Quiz

Study Flashcards

16 Questions

What is a variable in C++?

A name used to refer to computer storage locations

What is the purpose of a regular variable in C++?

To store a value that can change or vary

How is a constant variable different from a regular variable in C++?

Constant variables have fixed values that cannot be changed

What does the '==' operator represent in C++?

Relational/comparison operator

In C++, what are reserved words?

Words that must be used only for their specified purpose

What are local variables in C++?

Variables that are declared inside a function or block

Where are global variables declared?

Outside all the function blocks

What happens if a global variable is not initialized?

It takes zero by default

Where are local variables stored in memory?

Stack

How long does a local variable exist in a program?

Until the end of the function in which it is declared

Which operator is used for division in C++?

'/'

What does the logical NOT operator '!' do in C++?

Negates the value of an expression

Which data type stores fractional numbers containing 15 decimal digits in C++?

'double'

How do you read input from the user in C++?

Using '<<' operator with 'cin'

What does the assignment operator '+=' do in C++?

Performs addition assignment

In C++, which data type stores true or false values?

'bool'

Test your knowledge about variable declaration in C++. Learn about regular variables, constant variables, and their importance in programming.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Use Quizgecko on...
Browser
Browser