Search Header Logo

Operators

Authored by Jose Diaz

Computers

1st Grade

Used 1+ times

Operators
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

9 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

2 mins • 1 pt

Given:

byte b = 1;

char c = 1;

short s = 1;

int i = 1;

which of the following expressions are valid?. Select 3 options.

s = b * b ;

i = b + b ;

s *= b ;

c = c + b ;

float f = 2%s+c;

2.

MULTIPLE SELECT QUESTION

2 mins • 1 pt

Which of the following statements will compile without any error?. Please select 3 options

System.out.println("a"+'b'+63);

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

System.out.println('b'+ Integer.valueOf(63));

String s = 63 + Integer.valueOf(10);

String valueStr = (String) (63 + Integer.valueof(10));

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Consider the following lines of code:

System.out.println(null + true); //1

System.out.println(true + null); //2

System.out.println(null + null); //3

Which of the following statements are correct?. Please select 1 option.

None of the 3 lines will compile.

All the 3 lines will compile and print nulltrue, truenull and nullnull respectively.

Line 1 and 2 won't compile but line 3 will print nullnull.

Line 3 won't compile but line 1 and 2 will print nulltrue and truenull respectively.

None of the above.

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What will the following code print?

int i1 = 1, i2 = 2, i3 = 3;

float i4 = i1 + (i2=i3 );

System.out.println((int)i4);

Please select 1 option.

4

4.0

4.0f

It will not compile.

5.

MULTIPLE SELECT QUESTION

2 mins • 1 pt

Which of the following operators can be used in conjunction with a String object?. Plese select 3 options

+

  • + +

+=

.

*

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Consider the following lines of code:

boolean greenLight = true;

boolean pedestrian = false;

boolean rightTurn = true;

boolean otherLane = false;

You can go ahead only if the following expression evaluates to 'true' :

(( (rightTurn && !pedestrian || otherLane)

|| ( ? && !pedestrian && greenLight ) ) == true )

What variables can you put in place of '?' so that you can go ahead?

Please select 1 option.

rightTurn

otherLane

Any variable would do.

None of the variable would allow to go.

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What will the following code print?

int i = 0;

int j = 1;

if( (i++ == 0) & (j++ == 2) ){

i = 12;

}

System.out.println(i+" "+j);

Please select 1 option.

1 2

2 3

12 2

12 1

It will not compile.

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?