Search Header Logo

Java Operators

Authored by GOKUL C [CIR]

Computers

University

Used 18+ times

Java Operators
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

129 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

1 min • 1 pt

Which statement(s) are equivalent to i = i + 1?

i += 1

i++

i -= 1

i--

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

++ increases the value of a variable by 1

assignment operator

decrement operator

increment operator

sentinel

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What's the value of below?


int i=5;

System.out.println(i++);

System.out.println(i);

System.out.println(++i);

5

6

7

6

6

7

6

7

8

5

5

6

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What would the new value of A be?

A=1;

a++;

1

2

3

4

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

Please write correct output in following space-

10

20

No Output

Error

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Find the output for the following.

public class IncDec

{

public static void main(String s[])

{

int a = 1;

int b = 2;

int c;

int d;


c = ++b;

d = a++;


c++;


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

System.out.print("b = " + b);

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

System.out.print("d = " + d);

}

}

a = 2 b = 3 c = 4 d = 1

a = 2 b = 3 c = 4 d = 1

Program does not compile.

a = 1 b = 2 c = 4 d = 2

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output of the program?

class Test

{

public static void main(String [] args)

{

int x=20;

String sup = (x < 15) ? "small" : (x < 22)? "tiny" : "huge";

System.out.println(sup);

}

}

small

tiny

huge

Compilation fails

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?

Discover more resources for Computers