Search Header Logo

Java Arithmetic Operations

Authored by ANISA CUROVIC

Computers

11th Grade

Used 1+ times

Java Arithmetic Operations
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public class GuessNumber {

public static void main(String[] args) {

int a = 42;

int b = -7;

int c = a % b;

int d = b % a;

System.out.println(c + ", " + d);

}

}

0,-6

0,6

-6,0

6,0

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

class MyClass

{

public static void main(String s[])

{

int a = 34.0;

int b = 7;


int c = a % b;


System.out.println("c = " + c );


}

}

c = 4

The program does not compile

k = 6

k = 0

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public class BigNumbers {

public static void main(String[] args) {

System.out.println(10 * 5 + 100 * (25 * 11) / (25 * 10) * 10 - 5 + 7 % 2);

int zx = (10 * 5 + 100 * (25 * 11));

int yz = ((25 * 10) * 10 - 5 + 7 % 2);

System.out.println(zx / yz);

}

}

1046

1046

1046

10

1146

1146

1146

11

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public class Mods {

public static void main(String[] args) {

int x = 15;

int y = x % 4;

int z = y * 24;

System.out.println(z / 2);

}

}

84

36

2

3

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Your code divides two integers: x = 55; y = 8. Which of the following will generate the real value (6.875)?

double z = x/y;

int z = double x / double y;

z = x/ double y

double z = ((double) x / (double) y)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

class Addition

{

public static void main(String s[])

{

int a = 4;

a -= 10;

a = -a;

a = 7 + a;

System.out.println(" a = " + a );

a %= a;

a = a * a - 3 ;

System.out.println(" a = " + a );

}

}

a = 13

a = -3

a = 33

a = 163

a = 33

a = 163

Program does not compile

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public class Relation {

public static void main(String args[]) {

int a = 10;

int b = 15;

a++;

b--;

int c = b % a;

System.out.println(c >= b);

}

}

true

false

Compilation Error

Runtime Error

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?