Operators

Operators

1st Grade

9 Qs

quiz-placeholder

Similar activities

Robótica 3 Básico b 1P

Robótica 3 Básico b 1P

1st - 3rd Grade

11 Qs

FSD-java

FSD-java

KG - University

13 Qs

JAVA 2

JAVA 2

1st - 3rd Grade

10 Qs

Computer Programming 11- Quiz 1

Computer Programming 11- Quiz 1

1st Grade

10 Qs

Java Lesson 2

Java Lesson 2

KG - Professional Development

7 Qs

the func equals

the func equals

KG - 1st Grade

10 Qs

TEPOO

TEPOO

1st Grade

12 Qs

FontysVenlo - PRC1 - W01

FontysVenlo - PRC1 - W01

1st - 3rd Grade

13 Qs

Operators

Operators

Assessment

Quiz

Computers

1st Grade

Hard

Created by

Jose Diaz

Used 1+ times

FREE Resource

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.

8.

MULTIPLE SELECT QUESTION

2 mins • 1 pt

Which of the following are also known as "short circuiting logical operators"?. Please select 2 options.

&

||

&&

|

^

9.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What will the following class print ?

class InitTest{

public static void main(String[] args){

int a = 10;

int b = 20;

a += (a = 4);

b = b + (b = 5);

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

}

}

Please select 1 option.

8, 25

4, 5

14, 5

4, 25

14, 25