Search Header Logo
Syntax

Syntax

Assessment

Presentation

Computers

9th - 10th Grade

Hard

Created by

Marisol Rio

Used 1+ times

FREE Resource

1 Slide • 9 Questions

1

Syntax & Some String Q's

review q's

Slide image

2

Multiple Choice

What is the output by the code below?


System.out.print("ac" );

1

a\tc

2

a c

3

atc

4

a\c

5

ac

3

Multiple Choice

What is the output by the code below?


System.out.print("ab\\\\ab" );

1

ab\ab

2

ab

3

ab\\ab

4

bab

5

abb

4

Multiple Choice

What is the output by the code below?


System.out.println( 3 + "\t" + 3 );

1

6

2

3 3

3

6 6

4

3" "3

5

3 3

5

Multiple Choice

What is output by the following code?


System.out.println(7 + "" + 5);

1

345

2

39

3

75

4

12

5

there is no output due to compile error

6

Multiple Choice

Consider the following code segment.


String s = "dogfood";

System.out.println( s.substring(0,3) );

1

food

2

dog

3

dogs

4

ood

5

gfo

7

Multiple Choice

Consider the following code segment.


String s = "dogfood";

System.out.println( s.length() );

1

3

2

7

3

4

4

5

5

6

8

Multiple Choice

Consider the following code segment.


String s = "dogfood";

System.out.println( s.substring(4) );

1

food

2

dog

3

dogs

4

ood

5

dr who

9

Multiple Choice

Consider the following code segment.


String s = "dogfood";

System.out.println( s.indexOf( "cat" ) );

1

3

2

2

3

-1

4

4

5

0

10

Multiple Choice

What is output by the code below?


String s = "abac-adae-bfbg-bhbi";

int index = s.indexOf("ae");

System.out.println( index );

1

8

2

-1

3

6

4

7

5

there is no output due to a syntax error

Syntax & Some String Q's

review q's

Slide image

Show answer

Auto Play

Slide 1 / 10

SLIDE