How Well Do You Know Data Types in C++?

Akela
3403
How Well Do You Know Data Types in C++?
Each variable has a certain type, which defines the values it can take and how many bytes it should occupy in the memory. How well do you know data types in C++? Find out by answering the quiz questions!

What data types don't exist?

Integer-valued

Digit-imaged

Symbol

What's the difference between char and string?

Char is a symbol data type and string is a class for working with rows

Char occupies 16 bytes of memory, and string - 64

Char is a symbol data type and string – row one

A programmer needs to declare a variable indicating the result of division will be written. Which is the best data type to choose?

Double allows writing decimal fractions as a number, while int – only integral numbers, and string writes rows

char

int

double

What values does a variable with bool type take?

1 or 0

true or false

yes or no

The type of variable "number' is unsigned int. Can it take value -35?

Unsigned int takes values in the range from 0 to 65535

Yes

No

What is enum?

Numeric data type

Enumerated data type

Not a data type

With what set of values are the void type limited?

From 0 to infinity

The set of values is infinite

The set of values is empty

What type of variabe occupies the most memory?

Double is a type for values with double precision, that’s why it occupies twice as much memory than float, i.e. 8 bytes.

double

float

int

How do you declare and set the value of a variable?

A programmer entered a variable char a = '4' and int b = 4. Is it right that a=b?

Yes

No

What code fragment is right?

The constant value should be set when declaring and it cannot be changed.

What symbol can be placed in the char line variable to make the cursor shift to a new row when using it?

'\t' - is a symbol of horizontal tabulation.

'\n'

'\t'

This is impossible

How do you place a single quotation mark in variable char q?

'''

'\''

' ' '

A programmer set two variables: int a = 10 and int b=3. When will the result be a/b if the result is written in variable float c?

When dividing two integer values the result is rounded.

3,33

4

3

The difference between long and long int?

long – a symbol type, long int – integer-valued one

long – an objective type, long int - integer-valued one

No difference

You know the subject at the initial level

You still have to learn many things about data types in C++! Make sure to study this subject since gained knowledge will help you to avoid mistakes related to false statement about the variable type in the future. Good luck! Share the quiz with friends and find out if they know data types!

You know the subject at the intermediate level

You know the basics related to data types and most often you can declare a variable right but you lack some knowledge. Read articles and practice on problems since this subject is important: the program performance can depend on the type of one variable. Good luck! Share the quiz with friends and find out if they know data types!

You know the subject well!

You can tell the difference between data types with no problem, you easily select the necessary type for a variable, use constants with ease where it is necessary. Congrats! It's time to take on more complicated subjects and master programming further.  Share the quiz with friends and find out if they know data types!

What data types don't exist?
1 / 15
What's the difference between char and string?
2 / 15
A programmer needs to declare a variable indicating the result of division will be written. Which is the best data type to choose?
3 / 15
What values does a variable with bool type take?
4 / 15
The type of variable "number' is unsigned int. Can it take value -35?
5 / 15
What is enum?
6 / 15
With what set of values are the void type limited?
7 / 15
What type of variabe occupies the most memory?
8 / 15
How do you declare and set the value of a variable?
9 / 15
A programmer entered a variable char a = '4' and int b = 4. Is it right that a=b?
10 / 15
What code fragment is right?
11 / 15
What symbol can be placed in the char line variable to make the cursor shift to a new row when using it?
12 / 15
How do you place a single quotation mark in variable char q?
13 / 15
A programmer set two variables: int a = 10 and int b=3. When will the result be a/b if the result is written in variable float c?
14 / 15
The difference between long and long int?
15 / 15

Calculating results...

Useful and short ads help us create new content every day.