Folder101   Home Notes Quiz Assigns Info  
Forum Forum
101 Home 101
 
  C++ Level 2

Practice Quiz 7 - Operators & Expressions


There are 10 questions in this quiz

Question 1: Multiple Choice       

Which one of the following is the assignment operator?

Choice 1 ==
Choice 2 =:
Choice 3 =
Choice 4 :=

Question 2: Multiple Choice       

Which one of the following is NOT an operator?

Choice 1 +=
Choice 2 ++
Choice 3 int a
Choice 4 %

Question 3: Multiple Choice       

Which one of the following statements is false?

Choice 1 int x = -3 - 4 * 2;     //results in x having the value of -11
Choice 2 int x = (-3 - 4) * 2;  //results in x having the value of -14
Choice 3 int x = -3 - 4 / 2;     //results in x having the value of -3.5
Choice 4 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?

Choice 1 +=
Choice 2 ++
Choice 3
int a
Choice 4 inc

Question 5: Multiple Choice       

Consider the code below.

      15 / 10;

What is the datatype of the result of the operation?

Choice 1 integer
Choice 2 float
Choice 3 char
Choice 4 string

Question 6: Multiple Choice     

Consider the code below.

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

What is the value of y?

Choice 1 8
Choice 2 16
Choice 3 16.0
Choice 4 8.0

Question 7: Multiple Choice       

Consider the code below.

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

What is the value of y?

Choice 1 10.2
Choice 2 10
Choice 3 0.2
Choice 4 1

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?