wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Types and IO in C++

Total questions: 26

Worksheet time: 20mins

Name
Class
Date
1.

Temp0 = 1;

(a)  

2.

temp1 = 5.4

(a)  

3.

Temp0 = -1;

(a)  

4.

temp1 = 5.444444444

(a)  

5.

What type is a whole number that is 2 bytes long

a)

Short

b)

Int

c)

Long int

d)

float

6.

What type is a whole number that is 4 bytes long

a)

Short

b)

Int

c)

Long int

d)

float

7.

What type is a decimal or floating point number that is 4 bytes long

a)

Short

b)

Int

c)

Long int

d)

float

8.

If you wanted to do operations on a string, what header would you include.

a)

#include <iostream>

b)

#include <string>

c)

#include <iomanip>

d)

#include <vector>

9.

If I wanted to do a cout or a cin what header do I need to include?

a)

#include <iostream>

b)

#include <i/o>

c)

print("hello world!")

d)

#include <format>

10.

aCharacter = 'A';

a)

Char

b)

string

c)

int

d)

float

11.

aCharacter = "A";

a)

Char

b)

string

c)

int

d)

float

12.

How long is a byte in bits?

(a)  

13.

What's the difference between a double and float

a)

A float is 4 bytes and a double is 8 bytes

b)

Heart Disease

c)

A float can hold 6 decimal places, and a double can hold 19 decimal places

d)

One is bigger than the other

14.

If Walter white wanted to store a constant value like PI in C, what would he do.

a)

#define PI 3.14

b)

const float PI = 3.14;

c)

float pi = 3.14;

d)

double pi = 3.14;

15.

If Gus Fring wanted to store a constant value like PI in C++, what would he do.

a)

#define PI 3.14

b)

const float PI = 3.14;

c)

float pi = 3.14;

d)

double pi = 3.14;

16.

If the great Emperor Calus "May the witness bless his name", wanted to store a decimal with more than 7 decimal places in C++ what type would he use?

a)

float

b)

double

c)

int

d)

an engram

17.

If Alex, wanted to store a number that has no negatives what would he use?

a)

float

b)

double

c)

int

d)

unsigned int

18.

If Eric Ramirez, wanted to store a very big number that has no negatives what would he use?

a)

float

b)

double

c)

size_t

d)

unsigned int

19.

Explain what a float is in your own words

4 lines
20.

Explain what a int is in your own words

4 lines
21.

Explain what a double is in your own words

4 lines
22.

A write a constant in C

4 lines
23.

A write a constant in C++

4 lines
24.

What would use a int for and not a float.

4 lines
25.

What would use a float for and not a int.

4 lines
26.

Explain what you learned in this session

4 lines