What will the following write?
String str = "Hello World!" ;
str.substring(6);
System.out.println( str );
B4 - More about Strings
Quiz
•
Other
•
University
•
Easy
Ahmetcan türk
Used 7+ times
FREE Resource
16 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following write?
String str = "Hello World!" ;
str.substring(6);
System.out.println( str );
World!
Hello
Hello World!
The fragment will not compile.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Examine this code:
String str = "Hello World!" ;
System.out.println( str.substring(6) );
What will it write?
World!
Hello
Hello World!
The fragment will not compile.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Examine this code:
String str = "Hello World!" ;
System.out.println( str.length() );
What will it write?
0
10
11
12
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Examine this code:
String myString = "";
System.out.println( myString.length() );
What what will it write?
0
1
2
the code will not compile
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Examine this code:
String str = "Hello\tWorld!" ;
System.out.println( str.length() );
What will it write?
0
10
11
12
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Examine this code:
String str = "Hello World!" ;
What is the index of the character 'W' ?
0
5
6
7
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Examine this code:
String str = "One Fine Day" ;
String val = str.substring(4) ;
System.out.println( val );
What does the fragment print?
One Fine Day
Fine Day
Day
One Fine
20 questions
Java Simple - 1
Quiz
•
University
15 questions
Java Debugging Questions - M
Quiz
•
University
20 questions
Java Debugging Questions - H
Quiz
•
University
13 questions
MidQs - COMP112
Quiz
•
University
21 questions
Python 3
Quiz
•
University
15 questions
Spring Semester Quiz 6
Quiz
•
University
13 questions
Introduction to Python Programming Quiz 9E
Quiz
•
10th Grade - University
20 questions
Java Programming Challenge
Quiz
•
University
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade