Math Functions
Strings& Characters
Binary
Random Numbers
100

What do you include if you have to use math functions in a program?

#include<cmath>

100

True or false – Strings are written in single quotes(‘xyz’).

False

100

What is the purpose of binary?

The computer only understands 0s and 1s so every character is converted into binary for the computer to read.

100

The ____ function, in the C standard library, returns a random integer each time the function is called, in the range 0 to RAND_MAX.

rand()

200

Give an example of pow() function?

pow(2,3) = 2^3

200

What are the two ways of inputting a string?

cin way and the getline way

200

True or False – Binary numbers consist of 1 and 2.

False

200

How can you produce random numbers from 0 to 10? (including 10)

rand()%11

300

What is the output of fabs(99.108)?

99.108

300

What is the syntax of declaring a character variable?

char variableName;

300

Is the binary of 7 = 111?

Yes

300

Explain how we can produce random numbers between a range? (Is there a formula for it)

From x to y

[rand() % (x - y)] + x

400

What is the output of ceil(7.2)?

8.0

400

Name all the escape sequences.

/n,/t,/',/",//

400

What is the decimal value for 1101?

13

400

The function ____ returns the number of seconds since Jan 1, 1970.

time()

500

What is the output of floor(-2.4)?

-3.0

500

What is the purpose of escape sequences?

To have the symbols (that already have meaning) as characters.

500

What is the binary value of 16?

10000

500

Write a segment of code to find random numbers between 9 to 99.

[rand() % 90] + 9