3.1.1.3 Arithmetic operations in a programming language. Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Addition.

A

int num = 7 + 7;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Subtraction

A

int num = 7 - 4;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Multiplication.

A

int num = 7*5;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Real/Float Division.

A

int num1 = 9;
int num2 = 9;
Float v = (float) num1/num2;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Integer Division including Remainders.

A

int division:

int num = 7 /1;

Remainders:
int i = 10;
int j = 3;

int k = i%j;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Exponentiation.

A

An exponent is a quantity representing th power to which a given expression is to be raised e.g. 5^4

Math.pow(base , exponent );

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Rounding.

A

Math,round( );

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is truncation?

A

To trim or cut some digits of a float or double-type number or some character of a string from the right. Cn also be used to truncate the decimal portion completely that makes it an integer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Define the syntax for truncation.

A

truncateNumber(num, digits);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly