Skip to main content

variables-and-constants

// C++ Data Types Quiz

1).Which of the following is a built-in data type in C++?

1) int
2) string
3) list
4) vector

2).What is the size of a `float` data type in C++?

1) 4 bytes
2) 8 bytes
3) 16 bytes
4) 2 bytes

3).Which of the following data types is used to store a single character?

1) char
2) int
3) float
4) string

4).What is the default value of an uninitialized `int` variable in C++?

1) 0
2) undefined
3) null
4) It throws an error.

5).Which of the following is a non-built-in (user-defined) data type in C++?

1) struct
2) int
3) char
4) float

6).Which data type would you use to store large integers in C++?

1) long long int
2) int
3) short
4) char

7).Which of the following is the correct syntax to declare a pointer to an integer in C++?

1) int *p;
2) pointer int p;
3) int p*;
4) pointer *int p;

8).Which of the following data types has the largest range in C++?

1) long long int
2) int
3) float
4) double

9).What is the size of a `bool` data type in C++?

1) 1 byte
2) 4 bytes
3) 8 bytes
4) 2 bytes

10).Which of the following is a valid declaration for a constant variable in C++?

1) const float pi = 3.14;
2) float pi const = 3.14;
3) constant float pi = 3.14;
4) pi = const 3.14;