       Forum 101

C++ Level 2

# Practice Quiz 7 - Operators & Expressions

#### Question 1: Multiple Choice Which one of the following is the assignment operator?

==
=
:=

#### Question 2: Multiple Choice Which one of the following is NOT an operator?

int a
%

#### Question 3: Multiple Choice Which one of the following statements is false? int x = -3 - 4 * 2;     //results in x having the value of -11
int x = (-3 - 4) * 2;  //results in x having the value of -14
int x = -3 - 4 / 2;     //results in x having the value of -3.5
int x = (-3 - 4) / 2;   //results in x having the value of -3

#### Question 4: Multiple Choice Which one of the following is an increment operator?

+=
++int a
inc

#### Question 5: Multiple Choice Consider the code below.

15 / 10;

What is the datatype of the result of the operation?

#### Question 6: Multiple Choice Consider the code below.

```int x = 8; ``````      double y; ``````      y = x;```

What is the value of y?

#### Question 7: Multiple Choice Consider the code below.

```int x;             ``````double y = 10.2; ```      ```x =  (int) y;```

What is the value of y?

10
0.2

#### Question 8: Text Entry Consider the code below.

```      x = 5 + 3 + 8 * 10 + 6 / 3;```

What is the value of x?

#### Question 9: Text Entry Consider the code below.

```      int var1 = 5;       int var2 = 2; ``````      double result;```

```       result = 8 + var1 / var2 - 3;       cout << "The result is: " << result;```

What is the value of result?

#### Question 10: Text Entry Consider the code below.

```int x, y=3;             ``````double w= 10.2; ```      ```x =  (int) w * y;```

What is the value of x?

 ©2003 ADR