wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CSNP-04103 C++ Chapter 7 - 2 - Data Types

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which one is the oldest way to define constants?

a)

#define PI 3.14159265359

b)

const float PI = 3.14159265359;

2.

Which one of these instructions does a text replacement during compilation replacing the variable with the value assigned to it?.

a)

const float PI = 3.14159265359;

b)

#define PI 3.14159265359

3.

Floating point numbers are represented in memory as?.

a)

Binary numbers?.

b)

Binary numbers in scientific notation (sign, exponent & mantissa)

4.

What is the longest integer?.

a)

short int

b)

long int

c)

long long int

d)

int

5.

What is the longest floating point type?

a)

long double

b)

float

c)

double

d)

long long long double

6.

In the expression (3 + x / 2) where x is a float data type, the result is a floating point.

a)

False

b)

True

7.

if you declare: int i = 3.89; what is the result of cout << i;

a)

3.0

b)

3

c)

3.89

d)

3.89999

8.

What is the result of the command: cout << char(51);

a)

The number 51 as a character.

b)

The corresponding ASCII code for the number 51.

c)

The number 51 as a floating point

d)

You will get a syntax error.

9.

What the boolean function isalpha(char); does?.

a)

Returns false if char is alphabetic.

b)

Returns true if char is alphabetic.

c)

Returns true if char is numeric.

d)

Returns false is char is alpha-numeric.

10.

Can you read and write values to an enumeration type directly?

a)

Yes

b)

No