Search Header Logo

York College Week 5 #2 C++ Variables Review

Authored by Mr. Martin

Computers

12th Grade

Used 10+ times

York College Week 5  #2  C++ Variables Review
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

22 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax for declaring a variable in C++?

variable_name: data_type;

variable_name data_type;

data_type variable_name;

variable_name = data_type;

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you initialize a variable in C++?

Using the assignment operator (=) followed by the initial value

Using the declaration operator (:) followed by the initial value.

Using the increment operator (++) followed by the initial value.

Using the multiplication operator (*) followed by the initial value.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between declaring and initializing a variable?

Declaring a variable is creating a variable and specifying its scope, while initializing a variable is assigning a value to the declared variable.

Declaring a variable is creating a variable and specifying its data type, while initializing a variable is assigning a value to the declared variable.

Declaring a variable is creating a variable and specifying its value, while initializing a variable is assigning a data type to the declared variable.

Declaring a variable is assigning a value to the declared variable, while initializing a variable is creating a variable and specifying its data type.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the keyword used to declare a constant in C++?

let

var

constant

const

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Can the value of a constant be changed during program execution?

Yes

Sometimes

It depends

No

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of using constants in C++?

To create variables whose values cannot be changed once they are assigned.

To create variables with dynamic values.

To create variables with random values.

To create variables whose values can be changed once they are assigned.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the scope of a variable in C++?

The scope of a variable in C++ refers to the data type of the variable.

The scope of a variable in C++ refers to the lifetime of the variable.

The scope of a variable in C++ refers to the size of memory allocated for the variable.

The scope of a variable in C++ refers to the region of the program where the variable is visible and can be accessed.

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?