B4 - Increment, Decrement, and Assignment Operators

B4 - Increment, Decrement, and Assignment Operators

Assessment

Quiz

Other

University

Medium

Created by

R3g Gaming

Used 9+ times

FREE Resource

Student preview

quiz-placeholder

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the most common operation performed by a program?

Adding integer one to an integer variable.

Floating point division.

Object construction.

Internet access.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What two steps are performed when an assignment statement is executed?

  1. The expression on the right of the "=" is evaluated, "using" all the variables it contains.
  2. The result of evaluation is assigned to the variable on the left of the "=".
  1. All appropriate variables are incremented or decremented.
  2. The result is assigned to the variable on the left of the "=".
  1. All appropriate variables are incremented.
  2. All appropriate variables are decremented.
  1. The arithmetic expression is evaluated and assigned to the variable on the left of the "=".
  2. Variables are auto-incremented or auto-decremented.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the meaning of variable++ ?

Add one to the variable.

Add one to the variable after its current value has been used.

Add one to the variable before using its value.

Double the value in the variable.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following program output to the monitor:


int value = 0;

int count = 1;


value = count++ ;


System.out.println("value: "+ value " + count: " + count );

value: 0 count: 0

value: 0 count: 1

value: 1 count: 1

value: 1 count: 2

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following program output to the monitor:

int value = 0;

int count = 1;


value = ++ count ; /* note change from previous */


System.out.println("value: "+ value " + count: " + count );

value: 0 count: 1

value: 1 count: 1

value: 1 count: 2

value: 2 count: 2

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following:

int a = 0;

int b = 10;


a = --b ;


System.out.println("a: " + a + " b: " + b );

a: 9 b:11

a: 10 b: 9

a: 9 b:9

a: 0 b:9

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following program:

double w = 12.5 ;

w *= 2 ;


System.out.println( " w is " + w );

w is 12.5

w is 13.5

w is 25.0

w is 2

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?